

def test_down_hosts_are_skipped(self):
    active_host_names = ['active1', 'active2']
    down_host_names = ['down1', 'down2']
    down_hosts = [self._host(name, up=False) for name in down_host_names]
    active_hosts = [self._host(name) for name in active_host_names]
    all_hosts = (active_hosts + down_hosts)
    self.mock_client().services.list.return_value = all_hosts
    self.mock_client().hosts.list.return_value = all_hosts
    hosts = self.nova_client.get_compute_hosts()
    self.assertIsNotNone(hosts)
    self.assertTrue(isinstance(hosts, list))
    for active in active_host_names:
        self.assertIn(active, hosts)
    for down in down_host_names:
        self.assertNotIn(down, hosts)

dataset/ETHPy150Open MirantisWorkloadMobility/CloudFerry/tests/lib/os/compute/test_nova.py ComputeHostsTestCase.test_down_hosts_are_skipped/original