

@mock.patch.object(shade.OperatorCloud, 'ironic_client')
def test_inspect_machine_available_wait(self, mock_client):
    machine_uuid = '00000000-0000-0000-0000-000000000000'

    class available_machine():
        uuid = machine_uuid
        provision_state = 'available'

    class manageable_machine():
        uuid = machine_uuid
        provision_state = 'manageable'

    class inspecting_machine():
        uuid = expected_return_value
        provision_state = 'inspecting'
    mock_client.node.get.side_effect = iter([available_machine, available_machine, manageable_machine, inspecting_machine, manageable_machine, available_machine, available_machine])
    expected_return_value = dict(uuid=machine_uuid, provision_state='available')
    return_value = self.cloud.inspect_machine(machine_uuid, wait=True, timeout=1)
    self.assertTrue(mock_client.node.set_provision_state.called)
    self.assertEqual(mock_client.node.set_provision_state.call_count, 3)
    self.assertDictEqual(expected_return_value, return_value)

dataset/ETHPy150Open openstack-infra/shade/shade/tests/unit/test_shade_operator.py TestShadeOperator.test_inspect_machine_available_wait/VarMisuse@74/123 `machine_uuid`->`expected_return_value`