

@mock.patch.object(shade.OpenStackCloud, 'nova_client')
def test_list_hypervisors(self, mock_nova):
    'This test verifies that calling list_hypervisors results in a call\n        to nova client.'
    mock_nova.hypervisors.list.return_value = [fakes.FakeHypervisor('1', 'testserver1'), fakes.FakeHypervisor('2', 'testserver2')]
    r = self.cloud.list_hypervisors()
    mock_nova.hypervisors.list.assert_called_once_with()
    mock_nova.assertEquals(2, len(r))
    self.assertEquals('testserver1', r[0]['hypervisor_hostname'])
    self.assertEquals('testserver2', r[1]['hypervisor_hostname'])

dataset/ETHPy150Open openstack-infra/shade/shade/tests/unit/test_shade_operator.py TestShadeOperator.test_list_hypervisors/VarMisuse@76/150 `self`->`mock_nova`