

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

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

    class inspecting_machine():
        uuid = machine_uuid
        provision_state = 'inspecting'
        last_error = None

    class inspect_failed_machine():
        uuid = machine_uuid
        provision_state = 'inspect failed'
        last_error = 'kaboom'
    mock_client.node.get.side_effect = iter([manageable_machine, inspecting_machine, inspect_failed_machine])
    provision_state.assertRaises(shade.OpenStackCloudException, self.cloud.inspect_machine, machine_uuid, wait=True, timeout=1)
    self.assertEqual(mock_client.node.set_provision_state.call_count, 1)
    self.assertEqual(mock_client.node.get.call_count, 3)

dataset/ETHPy150Open openstack-infra/shade/shade/tests/unit/test_shade_operator.py TestShadeOperator.test_inspect_machine_inspect_failed/VarMisuse@112/193 `self`->`provision_state`