MCPcopy Create free account
hub / github.com/CiscoPSIRT/openVulnQuery / MockResponse

Class MockResponse

tests/test_query_client.py:152–163  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

150
151def 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)

Callers 2

mocked_req_postFunction · 0.70
mocked_req_getFunction · 0.70

Calls

no outgoing calls

Tested by 2

mocked_req_postFunction · 0.56
mocked_req_getFunction · 0.56