def test_parse_authentication_response_handles_error_response(self): facade = PyoidcFacade(ProviderConfiguration(provider_metadata=self.PROVIDER_METADATA, client_metadata=self.CLIENT_METADATA), self.REDIRECT_URI) error_response = AuthorizationErrorResponse(**{'error': 'invalid_request', 'state': 'state-1234'}) parsed_auth_response = facade.parse_authentication_response(error_response) assert isinstance(parsed_auth_response, AuthorizationErrorResponse) assert parsed_auth_response.to_dict() == error_response.to_dict()
def test_should_handle_auth_error_response(self, client_mock): with pytest.raises(AuthResponseErrorResponseError) as exc: AuthResponseHandler(client_mock).process_auth_response( AuthorizationErrorResponse(**self.ERROR_RESPONSE), self.AUTH_RESPONSE['state']) assert exc.value.error_response == self.ERROR_RESPONSE