MCPcopy Index your code
hub / github.com/ryanmcgrath/twython / register_response

Method register_response

tests/test_core.py:29–39  ·  view source on GitHub ↗

Wrapper function for responses for simpler unit tests

(self, method, url, body='{}', match_querystring=False,
                          status=200, adding_headers=None, stream=False,
                          content_type='application/json; charset=utf-8')

Source from the content-addressed store, hash-verified

27 return '%s/%s.json' % (self.api.api_url % self.api.api_version, endpoint)
28
29 def register_response(self, method, url, body='{}', match_querystring=False,
30 status=200, adding_headers=None, stream=False,
31 content_type='application/json; charset=utf-8'):
32 """Wrapper function for responses for simpler unit tests"""
33
34 # responses uses BytesIO to hold the body so it needs to be in bytes
35 if not is_py2:
36 body = bytes(body, 'UTF-8')
37
38 responses.add(method, url, body, match_querystring,
39 status, adding_headers, stream, content_type)
40
41 @responses.activate
42 def test_request_should_handle_full_endpoint(self):

Calls

no outgoing calls

Tested by

no test coverage detected