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

Method test_paths

tests/api/test_api_clients.py:171–186  ·  view source on GitHub ↗

Path translation works.

(self, m)

Source from the content-addressed store, hash-verified

169
170 @requests_mock.Mocker()
171 def test_paths(self, m):
172 """Path translation works."""
173
174 baseurl = 'https://test.com'
175 config = dict(endpoint=baseurl)
176
177 path_a, path_b = 'a', 'b'
178 data_a, data_b = dict(answer='a'), dict(answer='b')
179
180 m.get(requests_mock.ANY, status_code=404)
181 m.get(f"{baseurl}/{path_a}", json=data_a)
182 m.get(f"{baseurl}/{path_b}", json=data_b)
183
184 with DWaveAPIClient(**config) as client:
185 self.assertEqual(client.session.get(path_a).json(), data_a)
186 self.assertEqual(client.session.get(path_b).json(), data_b)
187
188 @parameterized.expand([
189 ("mixin", make_session_class(LoggingSessionMixin, BaseUrlSession)),

Callers

nothing calls this directly

Calls 2

DWaveAPIClientClass · 0.90
getMethod · 0.45

Tested by

no test coverage detected