Config options are respected when making requests.
(self, m)
| 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): |
nothing calls this directly
no test coverage detected