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

Class MockResponse

tests/test_authorization.py:32–43  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

30
31def mocked_req_post(*args, **kwargs):
32 class MockResponse:
33 def __init__(self, url=None, json_in=None, status_code=None):
34 self.url = url
35 self.json_in = json_in
36 self.status_code = status_code
37
38 def json(self):
39 return self.json_in
40
41 def raise_for_status(self):
42 if self.status_code != OK_STATUS:
43 raise requests.exceptions.HTTPError(HTTP_ERROR_MSG)
44 url = args[0]
45 if url == REQUEST_TOKEN_URL:
46 return MockResponse(url, OAUTH2_RESPONSE_BOGUS_BUT_OK, 200)

Callers 1

mocked_req_postFunction · 0.70

Calls

no outgoing calls

Tested by 1

mocked_req_postFunction · 0.56