When we mock HTTP requests using HTTPretty, it returns an
httpretty.Response object. We can generate the following responses through callbacks:
Rotating responses are the responses we receive in a given order when we send a request to a server with the same URL and same request method. We can define as many responses as we wish with the responses argument.
The following snippet explains the mocking of Rotating Responses:
import httpretty import requests from sure import expect @httpretty.activate def rotating_responses_example(): URL = "http://example.com/some/path" RESPONSE_1 = "This is Response 1." RESPONSE_2 = "This is Response 2." RESPONSE_3 = "This ...