-
-
Save EdwardIII/da53fc07fd8ec395c221 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
class SomeTest(TestCase): | |
@patch('requests.post', requests_mock) | |
def testSomething: | |
requests_mock.return_value = { 'status_code': 200, 'text': '<some xml />' } | |
pretend = PretendObj() // a pretend object that uses requests.post behind the scenes | |
# I want to use the patched requests_mock here | |
self.assertEqual('<mocked xml />', pretend.getResult()); | |
# But then I want to be able to temporarily call an unmocked, real request here | |
self.assertEqual('<not mocked xml xml />', pretend.getResult()); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment