AliSoftware / OHHTTPStubs

Stub your network requests easily! Test your apps with fake network data and custom response time, response code and headers!
MIT License
5.03k stars 601 forks source link

Mock Response of Image upload on S3 #272

Closed msalmanST closed 6 years ago

msalmanST commented 6 years ago

New Issue Checklist

Environment

Issue Description

Hi,

In the application I am working I am uploading image on s3 using aws ios sdk, I wanna confirm if there is a way my callback method can be triggered by OHHTTPStubs with stub response when I try to upload image.

  1. Provide an image to
Complete output when you encounter the issue (if any)
Liquidsoul commented 6 years ago

Hi @msalmanST,

Unfortunately, I do not think you can achieve that, data upload is one of the known limitations of OHHTTPStubs. You may be able to intercept the request using OHHTTPStubs but you would not be able to give the expected response to the SDK.

Even if you manage to make this work, I would advise against this kind of configuration because you do not have the ownership of the AWS SDK code and any change in the library may break it. The element you should mock is the SDK itself and have some kind of small abstraction layer over it. This would then be your mocking point for your tests.

msalmanST commented 6 years ago

@Liquidsoul Thanks for your quick response, I will look into it 👍