def test_it_returns_status_object(self, pyramid_request): exc = views.APIError("it exploded", status_code=429) result = views.error_api(exc, pyramid_request) assert result == {'status': 'failure', 'reason': 'it exploded'}
def test_it_sets_status_code_from_error(self, pyramid_request): exc = views.APIError("it exploded", status_code=429) views.error_api(exc, pyramid_request) assert pyramid_request.response.status_code == 429