How to use the apiron.JsonEndpoint function in apiron

To help you get started, we’ve selected a few apiron examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ithaka / apiron / tests / test_endpoint.py View on Github external
def test_required_headers(self):
        foo = apiron.JsonEndpoint()
        assert {"Accept": "application/json"} == foo.required_headers
github ithaka / apiron / tests / test_endpoint.py View on Github external
def test_repr_method(self):
        foo = apiron.JsonEndpoint(path="/bar/baz")
        assert repr(foo) == "JsonEndpoint(path='/bar/baz')"
github ithaka / apiron / tests / test_endpoint.py View on Github external
def test_str_method(self):
        foo = apiron.JsonEndpoint(path="/bar/baz")
        assert str(foo) == "/bar/baz"
github ithaka / apiron / tests / test_endpoint.py View on Github external
def test_format_response_when_ordered(self):
        foo = apiron.JsonEndpoint(preserve_order=True)
        mock_response = mock.Mock()

        with mock.patch.object(mock_response, "json") as mock_json:
            mock_json.return_value = {"foo": "bar"}
            assert {"foo": "bar"} == foo.format_response(mock_response)
            mock_json.assert_called_once_with(object_pairs_hook=collections.OrderedDict)
github ithaka / apiron / tests / test_endpoint.py View on Github external
def test_format_response_when_unordered(self):
        foo = apiron.JsonEndpoint()
        mock_response = mock.Mock()

        with mock.patch.object(mock_response, "json") as mock_json:
            mock_json.return_value = {"foo": "bar"}
            assert {"foo": "bar"} == foo.format_response(mock_response)
            mock_json.assert_called_once_with(object_pairs_hook=None)