Created
February 23, 2018 09:33
-
-
Save smoothml/a9f46399ec78f71721ae033238e9d121 to your computer and use it in GitHub Desktop.
2018-02-23 Serverless computing mocked_requests_get.py
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 mocked_requests_get(*args, **kwargs): | |
class MockResponse: | |
def __init__(self, json_data, status_code): | |
self.json_data = json_data | |
self.status_code = status_code | |
def json(self): | |
return self.json_data | |
if args[0] == "http://api.fixer.io/latest?base=GBP": | |
return MockResponse(TEST_RESPONSE, 200) | |
return MockResponse(None, 404) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment