summaryrefslogtreecommitdiff
path: root/ironic_python_agent/tests/unit/extensions/test_clean.py
diff options
context:
space:
mode:
Diffstat (limited to 'ironic_python_agent/tests/unit/extensions/test_clean.py')
-rw-r--r--ironic_python_agent/tests/unit/extensions/test_clean.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/ironic_python_agent/tests/unit/extensions/test_clean.py b/ironic_python_agent/tests/unit/extensions/test_clean.py
index 50299ce3..335f1f45 100644
--- a/ironic_python_agent/tests/unit/extensions/test_clean.py
+++ b/ironic_python_agent/tests/unit/extensions/test_clean.py
@@ -191,6 +191,34 @@ class TestCleanExtension(base.IronicAgentTest):
self.assertEqual(expected_result, async_result.command_result)
mock_cache_node.assert_called_once_with(self.node)
+ @mock.patch('ironic_python_agent.hardware.dispatch_to_managers',
+ autospec=True)
+ @mock.patch('ironic_python_agent.hardware.check_versions',
+ autospec=True)
+ def test_execute_clean_step_with_args(self, mock_version, mock_dispatch,
+ mock_cache_node):
+ result = 'cleaned'
+ mock_dispatch.return_value = result
+
+ step = self.step['GenericHardwareManager'][0]
+ step['args'] = {'foo': 'bar'}
+ expected_result = {
+ 'clean_step': step,
+ 'clean_result': result
+ }
+ async_result = self.agent_extension.execute_clean_step(
+ step=self.step['GenericHardwareManager'][0],
+ node=self.node, ports=self.ports,
+ clean_version=self.version)
+ async_result.join()
+
+ mock_version.assert_called_once_with(self.version)
+ mock_dispatch.assert_called_once_with(
+ self.step['GenericHardwareManager'][0]['step'],
+ self.node, self.ports, foo='bar')
+ self.assertEqual(expected_result, async_result.command_result)
+ mock_cache_node.assert_called_once_with(self.node)
+
@mock.patch('ironic_python_agent.hardware.check_versions',
autospec=True)
def test_execute_clean_step_no_step(self, mock_version, mock_cache_node):