How to use the apiron.client.choose_host 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_client.py View on Github external
def test_choose_host_raises_exception_when_no_hosts_available(self):
        service = mock.Mock()
        service.get_hosts.return_value = []
        with pytest.raises(NoHostsAvailableException):
            client.choose_host(service)
github ithaka / apiron / tests / test_client.py View on Github external
def test_choose_host_returns_one_of_the_available_hosts(self):
        hosts = ["foo", "bar", "baz"]
        service = mock.Mock()
        service.get_hosts.return_value = hosts
        assert client.choose_host(service) in hosts