def test_api_key_http_ok(self): """ Verifies that test_api_key does not raise an error when HTTP OK is returned from the server. """ client = Client(api_key='some-api-key') response = MockResponse(HTTPStatus.OK) with patch.object(client._session, 'get', return_value=response): client.test_api_key()
def test_api_key_http_unauthorized(self): """ Verifies that test_api_key raises UnauthorizedError when HTTP Unauthorized is returned from the server. """ client = Client(api_key='some-api-key') response = MockResponse(HTTPStatus.UNAUTHORIZED) with patch.object(client._session, 'get', return_value=response): with self.assertRaises(UnauthorizedError): client.test_api_key()