

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

    class active_node_state():
        provision_state = 'active'
    active_return_value = dict(provision_state='active')
    mock_client.node.set_provision_state.return_value = None
    mock_client.node.get.return_value = active_node_state
    node_id = 'node01'
    return_value = self.cloud.node_set_provision_state(node_id, 'active', configdrive='http://127.0.0.1/file.iso')
    self.assertEqual(active_return_value, return_value)
    mock_client.node.set_provision_state.assert_called_with(node_uuid='node01', state='active', configdrive='http://127.0.0.1/file.iso')
    self.assertTrue(mock_client.node.get.called)

dataset/ETHPy150Open openstack-infra/shade/shade/tests/unit/test_shade_operator.py TestShadeOperator.test_node_set_provision_state/original