class documentation
Mock of httplib2.Http
Mocks a sequence of calls to request returning different responses for each call. Create an instance initialized with the desired response headers and content and then use as if an httplib2.Http instance.
- http = HttpMockSequence([
- ({'status': '401'}, ''), ({'status': '200'}, '{"access_token":"1/3w","expires_in":3600}'), ({'status': '200'}, 'echo_request_headers'), ])
resp, content = http.request("http://examples.com")
There are special values you can pass in for content to trigger behavours that are helpful in testing.
'echo_request_headers' means return the request headers in the response body 'echo_request_headers_as_json' means return the request headers in
the response body
'echo_request_body' means return the request body in the response body 'echo_request_uri' means return the request uri in the response body
| Method | __init__ |
No summary |
| Method | request |
Undocumented |
| Instance Variable | follow |
Undocumented |
| Instance Variable | request |
Undocumented |
| Instance Variable | _iterable |
Undocumented |
def request(self, uri, method='GET', body=None, headers=None, redirections=1, connection_type=None):
¶
Undocumented