def test_client_error_without_description(self): c = Credentials('id', 'secret') error = {'error': 'Bad thing'} response = mock_response(400, error) c.send = MagicMock(return_value=response) with pytest.raises(HTTPError): c.request_client_token()
def test_server_error_raises_http_error(self): c = Credentials('id', 'secret') response = mock_response(500, {}) c.send = MagicMock(return_value=response) with pytest.raises(HTTPError): c.request_client_token() c.close()
def test_refresh_pkce_token(self): c = Credentials('id') c.send = MagicMock(return_value=mock_response()) token = c.refresh_pkce_token('refresh') assert token.uses_pkce
def test_request_pkce_token(self): c = Credentials('id') c.send = MagicMock(return_value=mock_response()) token = c.request_pkce_token('scope', 'verifier') assert token.uses_pkce