MCPcopy Create free account
hub / github.com/dwavesystems/dwave-cloud-client / test_request

Method test_request

tests/api/test_api_clients.py:153–168  ·  view source on GitHub ↗

Config options are respected when making requests.

(self, m)

Source from the content-addressed store, hash-verified

151
152 @requests_mock.Mocker()
153 def test_request(self, m):
154 """Config options are respected when making requests."""
155
156 config = dict(endpoint='https://test.com/path/',
157 token=str(uuid.uuid4()),
158 headers={'Custom': 'Field 123'})
159
160 auth_headers = {'X-Auth-Token': config['token']}
161 data = dict(answer=123)
162
163 m.get(requests_mock.ANY, status_code=401)
164 m.get(requests_mock.ANY, status_code=404, request_headers=auth_headers)
165 m.get(config['endpoint'], json=data, request_headers=config['headers'])
166
167 with DWaveAPIClient(**config) as client:
168 self.assertEqual(client.session.get('').json(), data)
169
170 @requests_mock.Mocker()
171 def test_paths(self, m):

Callers

nothing calls this directly

Calls 2

DWaveAPIClientClass · 0.90
getMethod · 0.45

Tested by

no test coverage detected