def test_it_skips_description_when_empty(self, pyramid_request): context = OAuthTokenError('', 'invalid_request') result = views.api_token_error(context, pyramid_request) assert 'error_description' not in result
def test_it_returns_the_error(self, pyramid_request): context = OAuthTokenError('', 'error_type') result = views.api_token_error(context, pyramid_request) assert result['error'] == 'error_type'
def test_it_returns_error_description(self, pyramid_request): context = OAuthTokenError('error description', 'error_type') result = views.api_token_error(context, pyramid_request) assert result['error_description'] == 'error description'
def test_it_sets_the_response_status_code(self, pyramid_request): context = OAuthTokenError('the error message', 'error_type', status_code=403) views.api_token_error(context, pyramid_request) assert pyramid_request.response.status_code == 403