Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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)
def test_build_request_object_raises_no_host_exception(self):
service = mock.Mock()
service.get_hosts.return_value = []
with pytest.raises(NoHostsAvailableException):
client.build_request_object(None, service, None)