| 124 | """Mocks library requests.get method""" |
| 125 | |
| 126 | class MockResponse(): |
| 127 | def __init__(self, status_code, json_response): |
| 128 | self.status_code = status_code |
| 129 | self.json_response = json_response |
| 130 | |
| 131 | def json(self): |
| 132 | return json.loads(self.json_response) |
| 133 | |
| 134 | def raise_for_status(self): |
| 135 | if self.status_code == 404: |
| 136 | raise Exception("Mock 404 Not Found Exception") |
| 137 | elif self.status_code == 406: |
| 138 | raise Exception("Mock 406 HttpError Exception") |
| 139 | |
| 140 | if API_URL in kwargs["url"]: |
| 141 | if "advisory" in kwargs["url"]: |
no outgoing calls