How to use the apiron.StubEndpoint 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_call_without_service_raises_exception(self):
        stub_endpoint = apiron.StubEndpoint(stub_response="foo")
        with pytest.raises(TypeError):
            stub_endpoint()
github ithaka / apiron / tests / test_endpoint.py View on Github external
def test_str_method(self):
        foo = apiron.StubEndpoint(path="/bar/baz")
        assert str(foo) == "/bar/baz"
github ithaka / apiron / tests / test_endpoint.py View on Github external
def test_repr_method(self):
        foo = apiron.StubEndpoint(path="/bar/baz")
        assert repr(foo) == "StubEndpoint(path='/bar/baz')"
github ithaka / apiron / tests / test_endpoint.py View on Github external
def test_stub_default_response(self, service):
        service.stub_endpoint = apiron.StubEndpoint()
        assert service.stub_endpoint() == {"response": "StubEndpoint(path='/')"}
github ithaka / apiron / tests / test_endpoint.py View on Github external
def test_call_dynamic(self, test_call_kwargs, expected_response, service, stub_function):
        service.stub_endpoint = apiron.StubEndpoint(stub_response=stub_function)
        actual_response = service.stub_endpoint(**test_call_kwargs)
        assert actual_response == expected_response
github ithaka / apiron / tests / test_endpoint.py View on Github external
def test_call_static(self, service):
        service.stub_endpoint = apiron.StubEndpoint(stub_response="stub response")
        assert service.stub_endpoint() == "stub response"