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

Class MockResponse

tests/test_query_client_cvrf.py:126–138  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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"]:

Callers 1

mocked_requests_lib_getFunction · 0.70

Calls

no outgoing calls

Tested by 1

mocked_requests_lib_getFunction · 0.56