def test_error_api_returns_status_object(): request = testing.DummyRequest() exc = views.APIError("it exploded", status_code=429) result = views.error_api(exc, request) assert result == {'status': 'failure', 'reason': 'it exploded'}
def test_error_api_sets_status_code_from_error(): request = testing.DummyRequest() exc = views.APIError("it exploded", status_code=429) views.error_api(exc, request) assert request.response.status_code == 429