| 150 | |
| 151 | def mocked_req_post(*args, **kwargs): |
| 152 | class MockResponse: |
| 153 | def __init__(self, url=None, json_in=None, status_code=None): |
| 154 | self.url = url |
| 155 | self.json_in = json_in |
| 156 | self.status_code = status_code |
| 157 | |
| 158 | def json(self): |
| 159 | return self.json_in |
| 160 | |
| 161 | def raise_for_status(self): |
| 162 | if self.status_code != OK_STATUS: |
| 163 | raise requests.exceptions.HTTPError(TOK_HTTP_ERROR_MSG) |
| 164 | url = args[0] |
| 165 | if url == REQUEST_TOKEN_URL: |
| 166 | return MockResponse(url, OAUTH2_RESPONSE_BOGUS_BUT_OK, 200) |
no outgoing calls