How to use the apiron.Endpoint 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_constructor_stores_passed_attributes(self):
        foo = apiron.Endpoint(path="/foo/", default_method="POST")
        assert "/foo/" == foo.path
        assert "POST" == foo.default_method
github ithaka / apiron / tests / test_endpoint.py View on Github external
def test_repr_method(self):
        foo = apiron.Endpoint(path="/bar/baz")
        assert repr(foo) == "Endpoint(path='/bar/baz')"
github ithaka / apiron / tests / test_endpoint.py View on Github external
def test_format_path_with_incorrect_kwargs(self):
        foo = apiron.Endpoint(path="/{one}/{two}/")
        path_kwargs = {"foo": "bar"}
        with pytest.warns(RuntimeWarning, match="An unknown path kwarg was supplied"):
            with pytest.raises(KeyError):
                foo.get_formatted_path(**path_kwargs)
github ithaka / apiron / tests / test_endpoint.py View on Github external
def test_call(self, service):
        service.foo = apiron.Endpoint()
        service.foo()
github ithaka / apiron / tests / test_endpoint.py View on Github external
def test_get_merged_params_with_empty_param(self):
        foo = apiron.Endpoint(default_params={"foo": "bar"}, required_params={"baz"})
        with pytest.warns(RuntimeWarning, match="endpoint was called with empty parameters"):
            assert {"foo": "bar", "baz": None} == foo.get_merged_params({"baz": None})
github ithaka / apiron / tests / test_endpoint.py View on Github external
def test_get_merged_params(self):
        foo = apiron.Endpoint(default_params={"foo": "bar"}, required_params={"baz"})
        assert {"foo": "bar", "baz": "qux"} == foo.get_merged_params({"baz": "qux"})
github ithaka / apiron / tests / service / test_base.py View on Github external
def test_endpoints_when_multiple_endpoints(self, service):
        foo = Endpoint(path="/foo")
        bar = Endpoint(path="/bar")

        service.foo = foo
        service.bar = bar

        assert service.endpoints == {foo, bar}
github ithaka / apiron / tests / test_endpoint.py View on Github external
def test_required_headers(self):
        foo = apiron.Endpoint()
        assert {} == foo.required_headers
github ithaka / apiron / src / apiron / service / base.py View on Github external
def endpoints(cls):
        return {attr for attr_name, attr in cls.__dict__.items() if isinstance(attr, Endpoint)}