-
-
Save EdwardIII/ab80f8f2f9f73d35f340 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def lookup_xml_response(*args, **kwargs): | |
print args # returning (), which makes sense, because of how it's getting called on #15 | |
m = Mock() | |
m.status_code = 200 | |
m.text = '< .... />' // Do the stuff to determine what response to send back based on args/kwargs | |
return m | |
class MyTestCase(TestCase): | |
def setUp(self): | |
self.api = MyApi() | |
self.maxDiff = None | |
@patch('requests.post') | |
def test_search(self, requests_mock): | |
requests_mock.side_effect = lookup_xml_response | |
self.api.search('tasty things') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment