From 3761a448009467dd342bc0cb3ca3b182969def42 Mon Sep 17 00:00:00 2001 From: Vladyslav Drok Date: Mon, 16 Nov 2020 14:51:53 +0100 Subject: Fix vendor info retrieval for some versions of lshw There is one more place that relies on lshw json output being a dict, so let's fix the function that gets the dict rather than places it is being used in. Change-Id: Ia1c2c2e6a32c76ac0249e6a46e4cced18d6093a9 Task: 39527 Story: 2007588 --- ironic_python_agent/tests/unit/test_hardware.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'ironic_python_agent/tests') diff --git a/ironic_python_agent/tests/unit/test_hardware.py b/ironic_python_agent/tests/unit/test_hardware.py index 060e71b3..b69c80d1 100644 --- a/ironic_python_agent/tests/unit/test_hardware.py +++ b/ironic_python_agent/tests/unit/test_hardware.py @@ -4390,6 +4390,14 @@ class TestGenericHardwareManager(base.IronicAgentTest): self.assertEqual('1234567', vendor_info.serial_number) self.assertEqual('GENERIC', vendor_info.manufacturer) + @mock.patch.object(utils, 'execute', autospec=True) + def test_get_system_vendor_info_lshw_list(self, mocked_execute): + mocked_execute.return_value = (f"[{LSHW_JSON_OUTPUT_V2[0]}]", "") + vendor_info = self.hardware.get_system_vendor_info() + self.assertEqual('ABCD', vendor_info.product_name) + self.assertEqual('1234', vendor_info.serial_number) + self.assertEqual('ABCD', vendor_info.manufacturer) + @mock.patch.object(utils, 'execute', autospec=True) def test_get_system_vendor_info_failure(self, mocked_execute): mocked_execute.side_effect = processutils.ProcessExecutionError() -- cgit v1.2.1