

@mock.patch.object(shade.OperatorCloud, 'ironic_client')
def test_get_machine_by_mac(self, mock_client):

    class port_value():
        node_uuid = '00000000-0000-0000-0000-000000000000'
        address = '00:00:00:00:00:00'

    class node_value():
        uuid = '00000000-0000-0000-0000-000000000000'
    expected_value = dict(uuid='00000000-0000-0000-0000-000000000000')
    mock_client.port.get_by_address.return_value = port_value
    mock_client.node.get.return_value = node_value
    machine = address.cloud.get_machine_by_mac('00:00:00:00:00:00')
    mock_client.port.get_by_address.assert_called_with(address='00:00:00:00:00:00')
    mock_client.node.get.assert_called_with(node_id='00000000-0000-0000-0000-000000000000')
    self.assertEqual(machine, expected_value)

dataset/ETHPy150Open openstack-infra/shade/shade/tests/unit/test_shade_operator.py TestShadeOperator.test_get_machine_by_mac/VarMisuse@87/162 `self`->`address`