summaryrefslogtreecommitdiff
path: root/ironicclient/tests/unit/osc/v1/test_baremetal_node.py
diff options
context:
space:
mode:
Diffstat (limited to 'ironicclient/tests/unit/osc/v1/test_baremetal_node.py')
-rw-r--r--ironicclient/tests/unit/osc/v1/test_baremetal_node.py56
1 files changed, 56 insertions, 0 deletions
diff --git a/ironicclient/tests/unit/osc/v1/test_baremetal_node.py b/ironicclient/tests/unit/osc/v1/test_baremetal_node.py
index 5a1b2fe..6426eef 100644
--- a/ironicclient/tests/unit/osc/v1/test_baremetal_node.py
+++ b/ironicclient/tests/unit/osc/v1/test_baremetal_node.py
@@ -4188,3 +4188,59 @@ class TestBIOSSettingShow(TestBaremetal):
'node_uuid', 'bios_name_1')
expected_data = ('bios_name_1', 'bios_value_1')
self.assertEqual(expected_data, tuple(data))
+
+
+class TestNodeHistoryEventList(TestBaremetal):
+ def setUp(self):
+ super(TestNodeHistoryEventList, self).setUp()
+
+ self.baremetal_mock.node.get_history_list.return_value = (
+ baremetal_fakes.NODE_HISTORY)
+
+ # Get the command object to test
+ self.cmd = baremetal_node.NodeHistoryList(self.app, None)
+
+ def test_baremetal_node_history_list(self):
+ arglist = ['node_uuid', '--long']
+ verifylist = [('node', 'node_uuid'), ('long', True)]
+
+ parsed_args = self.check_parser(self.cmd, arglist, verifylist)
+
+ columns, data = self.cmd.take_action(parsed_args)
+ self.baremetal_mock.node.get_history_list.assert_called_once_with(
+ 'node_uuid', True)
+ expected_columns = ('UUID', 'Created At', 'Severity',
+ 'Event Origin Type', 'Description of the event',
+ 'Conductor', 'User')
+ expected_data = (('abcdef1', 'time', 'info', 'purring', 'meow',
+ 'lap-conductor', '0191'),)
+ self.assertEqual(expected_columns, columns)
+ self.assertEqual(expected_data, tuple(data))
+
+
+class TestNodeHistoryEventGet(TestBaremetal):
+ def setUp(self):
+ super(TestNodeHistoryEventGet, self).setUp()
+
+ self.baremetal_mock.node.get_history_event.return_value = (
+ baremetal_fakes.NODE_HISTORY[0])
+
+ # Get the command object to test
+ self.cmd = baremetal_node.NodeHistoryEventGet(self.app, None)
+
+ def test_baremetal_node_history_list(self):
+ arglist = ['node_uuid', 'event_uuid']
+ verifylist = [('node', 'node_uuid'), ('event', 'event_uuid')]
+
+ parsed_args = self.check_parser(self.cmd, arglist, verifylist)
+
+ columns, data = self.cmd.take_action(parsed_args)
+ self.baremetal_mock.node.get_history_event.assert_called_once_with(
+ 'node_uuid', 'event_uuid')
+ expected_columns = ('conductor', 'created_at', 'event', 'event_type',
+ 'severity', 'user', 'uuid')
+ expected_data = ('lap-conductor', 'time', 'meow', 'purring', 'info',
+ '0191', 'abcdef1')
+
+ self.assertEqual(expected_columns, columns)
+ self.assertEqual(expected_data, tuple(data))