def test_choose_host_raises_exception(self): service = mock.Mock() service.get_hosts.return_value = [] with pytest.raises(NoHostsAvailableException): ServiceCaller.choose_host(service)
def test_choose_host(self): hosts = ['foo', 'bar', 'baz'] service = mock.Mock() service.get_hosts.return_value = hosts assert ServiceCaller.choose_host(service) in hosts