Example #1
0
    def test_it_sets_status_code_from_error(self):
        request = testing.DummyRequest()
        exc = views.APIError("it exploded", status_code=429)

        views.error_api(exc, request)

        assert request.response.status_code == 429
Example #2
0
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
Example #3
0
    def test_it_returns_status_object(self):
        request = testing.DummyRequest()
        exc = views.APIError("it exploded", status_code=429)

        result = views.error_api(exc, request)

        assert result == {'status': 'failure', 'reason': 'it exploded'}
Example #4
0
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'}
Example #5
0
    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'}
Example #6
0
    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