Fix the test cases for latest sushy

This patch fixes the test cases which are dependent on
changes in sushy library version 3.12.0.

Closes-Bug: 1950421
Change-Id: I485010c613b0e8d5d4c9bcb96959730bae42dc88
This commit is contained in:
Nisha Agarwal 2021-11-08 03:58:50 -08:00 committed by paresh-sao
parent 2be2d0e18d
commit 9d96c5f294
12 changed files with 86 additions and 54 deletions

View File

@ -1,4 +1,4 @@
# Copyright 2020 Hewlett Packard Enterprise Development LP
# Copyright 2020-2022 Hewlett Packard Enterprise Development LP
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
@ -36,7 +36,8 @@ class SecurityParamsTestCase(testtools.TestCase):
path = ("/redfish/v1/Mangers/1/SecurityService/"
"SecurityDashboard/SecurityParams")
self.sec_param = security_params.SecurityParams(
self.conn, path, '1.0.2', None)
self.conn, path, redfish_version='1.0.2',
registries=None, root=None)
def test__parse_attributes(self):
self.sec_param._parse_attributes(self.json_doc)
@ -67,7 +68,7 @@ class SecurityParamsCollectionTestCase(testtools.TestCase):
self.conn,
('/redfish/v1/Managers/1/SecurityService/'
'SecurityDashboard/SecurityParams'),
redfish_version='1.0.2')
redfish_version='1.0.2', registries=None, root=None)
def test__parse_attributes(self):
self.sec_params_col._parse_attributes(self.json_doc)
@ -89,7 +90,8 @@ class SecurityParamsCollectionTestCase(testtools.TestCase):
self.sec_params_col._conn,
('/redfish/v1/Managers/1/SecurityService/SecurityDashboard/'
'SecurityParams/1'),
self.sec_params_col.redfish_version, None)
redfish_version=self.sec_params_col.redfish_version,
registries=None, root=self.sec_params_col.root)
@mock.patch.object(security_params, 'SecurityParams', autospec=True)
def test_get_members(self, mock_eth):
@ -99,9 +101,11 @@ class SecurityParamsCollectionTestCase(testtools.TestCase):
path2 = ('/redfish/v1/Managers/1/SecurityService/SecurityDashboard/'
'SecurityParams/1')
calls = [mock.call(self.sec_params_col._conn, path,
self.sec_params_col.redfish_version, None),
redfish_version=self.sec_params_col.redfish_version,
registries=None, root=self.sec_params_col.root),
mock.call(self.sec_params_col._conn, path2,
self.sec_params_col.redfish_version, None)]
redfish_version=self.sec_params_col.redfish_version,
registries=None, root=self.sec_params_col.root)]
mock_eth.assert_has_calls(calls)
self.assertIsInstance(members, list)
self.assertEqual(2, len(members))

View File

@ -1,4 +1,4 @@
# Copyright 2017 Hewlett Packard Enterprise Development LP
# Copyright 2017-2022 Hewlett Packard Enterprise Development LP
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
@ -34,7 +34,8 @@ class HPEArrayControllerTestCase(testtools.TestCase):
path = ("/redfish/v1/Systems/1/SmartStorage/ArrayControllers")
self.sys_stor = array_controller.HPEArrayController(
self.conn, path, '1.0.2', None)
self.conn, path, redfish_version='1.0.2',
registries=None, root=None)
def test__parse_attributes(self):
self.sys_stor._parse_attributes(self.json_doc)
@ -91,7 +92,7 @@ class HPEArrayControllerCollectionTestCase(testtools.TestCase):
self.conn.get.return_value.json.return_value = self.json_doc
self.sys_stor_col = array_controller.HPEArrayControllerCollection(
self.conn, '/redfish/v1/Systems/1/SmartStorage/ArrayControllers',
'1.0.2', None)
redfish_version='1.0.2', registries=None, root=None)
def test__parse_attributes(self):
self.sys_stor_col._parse_attributes(self.json_doc)
@ -108,7 +109,8 @@ class HPEArrayControllerCollectionTestCase(testtools.TestCase):
mock_eth.assert_called_once_with(
self.sys_stor_col._conn,
'/redfish/v1/Systems/1/SmartStorage/ArrayControllers/0',
self.sys_stor_col.redfish_version, None)
redfish_version=self.sys_stor_col.redfish_version,
registries=None, root=self.sys_stor_col.root)
@mock.patch.object(array_controller, 'HPEArrayController', autospec=True)
def test_get_members(self, mock_eth):
@ -116,7 +118,8 @@ class HPEArrayControllerCollectionTestCase(testtools.TestCase):
path = ("/redfish/v1/Systems/1/SmartStorage/ArrayControllers/0")
calls = [
mock.call(self.sys_stor_col._conn, path,
self.sys_stor_col.redfish_version, None),
redfish_version=self.sys_stor_col.redfish_version,
registries=None, root=self.sys_stor_col.root),
]
mock_eth.assert_has_calls(calls)
self.assertIsInstance(members, list)

View File

@ -1,4 +1,4 @@
# Copyright 2017 Hewlett Packard Enterprise Development LP
# Copyright 2017-2022 Hewlett Packard Enterprise Development LP
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
@ -35,7 +35,8 @@ class DriveTestCase(testtools.TestCase):
drive_path = ("/redfish/v1/Systems/437XR1138R2/Storage/1/"
"Drives/35D38F11ACEF7BD3")
self.sys_drive = drive.Drive(
self.conn, drive_path, redfish_version='1.0.2')
self.conn, drive_path, redfish_version='1.0.2',
registries=None, root=None)
def test__parse_attributes(self):
self.sys_drive._parse_attributes(self.json_doc['drive1'])

View File

@ -1,4 +1,4 @@
# Copyright 2017 Hewlett Packard Enterprise Development LP
# Copyright 2017-2022 Hewlett Packard Enterprise Development LP
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
@ -34,7 +34,7 @@ class HPELogicalDriveTestCase(testtools.TestCase):
path = ("/redfish/v1/Systems/1/SmartStorage/"
"ArrayControllers/0/LogicalDrives")
self.sys_stor = logical_drive.HPELogicalDrive(
self.conn, path, '1.0.2', None)
self.conn, path, '1.0.2', registries=None, root=None)
def test__parse_attributes(self):
self.sys_stor._parse_attributes(self.json_doc)
@ -53,7 +53,7 @@ class HPELogicalDriveCollectionTestCase(testtools.TestCase):
self.sys_stor_col = logical_drive.HPELogicalDriveCollection(
self.conn, ('/redfish/v1/Systems/1/SmartStorage/'
'ArrayControllers/0/LogicalDrives'),
redfish_version='1.0.2')
redfish_version='1.0.2', registries=None, root=None)
def test__parse_attributes(self):
self.sys_stor_col._parse_attributes(self.json_doc)
@ -75,7 +75,8 @@ class HPELogicalDriveCollectionTestCase(testtools.TestCase):
self.sys_stor_col._conn,
('/redfish/v1/Systems/1/SmartStorage/ArrayControllers/0/'
'LogicalDrives/1'),
self.sys_stor_col.redfish_version, None)
redfish_version=self.sys_stor_col.redfish_version,
registries=None, root=self.sys_stor_col.root)
@mock.patch.object(logical_drive, 'HPELogicalDrive', autospec=True)
def test_get_members(self, mock_eth):
@ -86,9 +87,11 @@ class HPELogicalDriveCollectionTestCase(testtools.TestCase):
"0/LogicalDrives/2")
calls = [
mock.call(self.sys_stor_col._conn, path1,
self.sys_stor_col.redfish_version, None),
redfish_version=self.sys_stor_col.redfish_version,
registries=None, root=self.sys_stor_col.root),
mock.call(self.sys_stor_col._conn, path2,
self.sys_stor_col.redfish_version, None),
redfish_version=self.sys_stor_col.redfish_version,
registries=None, root=self.sys_stor_col.root),
]
mock_eth.assert_has_calls(calls)
self.assertIsInstance(members, list)

View File

@ -1,4 +1,4 @@
# Copyright 2017 Hewlett Packard Enterprise Development LP
# Copyright 2017-2022 Hewlett Packard Enterprise Development LP
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
@ -35,7 +35,8 @@ class HPEPhysicalDriveTestCase(testtools.TestCase):
path = ("/redfish/v1/Systems/1/SmartStorage/"
"ArrayControllers/0/DiskDrives")
self.sys_stor = physical_drive.HPEPhysicalDrive(
self.conn, path, '1.0.2', None)
self.conn, path, redfish_version='1.0.2',
registries=None, root=None)
def test__parse_attributes(self):
self.sys_stor._parse_attributes(self.json_doc['drive1'])
@ -56,7 +57,7 @@ class HPEPhysicalDriveCollectionTestCase(testtools.TestCase):
self.sys_stor_col = physical_drive.HPEPhysicalDriveCollection(
self.conn, ('/redfish/v1/Systems/1/SmartStorage/'
'ArrayControllers/0/DiskDrives'),
redfish_version='1.0.2')
redfish_version='1.0.2', registries=None, root=None)
def test__parse_attributes(self):
self.sys_stor_col._parse_attributes(self.json_doc)
@ -78,7 +79,8 @@ class HPEPhysicalDriveCollectionTestCase(testtools.TestCase):
self.sys_stor_col._conn,
('/redfish/v1/Systems/1/SmartStorage/ArrayControllers/0/'
'DiskDrives/3'),
self.sys_stor_col.redfish_version, None)
redfish_version=self.sys_stor_col.redfish_version,
registries=None, root=self.sys_stor_col.root)
@mock.patch.object(physical_drive, 'HPEPhysicalDrive', autospec=True)
def test_get_members(self, mock_eth):
@ -89,9 +91,11 @@ class HPEPhysicalDriveCollectionTestCase(testtools.TestCase):
"0/DiskDrives/4")
calls = [
mock.call(self.sys_stor_col._conn, path,
self.sys_stor_col.redfish_version, None),
redfish_version=self.sys_stor_col.redfish_version,
registries=None, root=self.sys_stor_col.root),
mock.call(self.sys_stor_col._conn, path2,
self.sys_stor_col.redfish_version, None),
redfish_version=self.sys_stor_col.redfish_version,
registries=None, root=self.sys_stor_col.root),
]
mock_eth.assert_has_calls(calls)
self.assertIsInstance(members, list)

View File

@ -1,4 +1,4 @@
# Copyright 2017 Hewlett Packard Enterprise Development LP
# Copyright 2017-2022 Hewlett Packard Enterprise Development LP
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
@ -33,7 +33,8 @@ class SimpleStorageTestCase(testtools.TestCase):
simple_path = ("/redfish/v1/Systems/437XR1138R2/SimpleStorage/1")
self.sys_simple = simple_storage.SimpleStorage(
self.conn, simple_path, '1.0.2', None)
self.conn, simple_path, redfish_version='1.0.2',
registries=None, root=None)
def test__parse_attributes(self):
self.sys_simple._parse_attributes(self.json_doc)
@ -65,7 +66,7 @@ class SimpleStorageCollectionTestCase(testtools.TestCase):
self.conn.get.return_value.json.return_value = self.json_doc
self.sys_simple_col = simple_storage.SimpleStorageCollection(
self.conn, '/redfish/v1/Systems/437XR1138R2/SimpleStorage',
'1.0.2', None)
redfish_version='1.0.2', registries=None, root=None)
def test__parse_attributes(self):
self.sys_simple_col._parse_attributes(self.json_doc)
@ -82,7 +83,8 @@ class SimpleStorageCollectionTestCase(testtools.TestCase):
mock_simple.assert_called_once_with(
self.sys_simple_col._conn,
'/redfish/v1/Systems/437XR1138R2/SimpleStorage/1',
self.sys_simple_col.redfish_version, None)
redfish_version=self.sys_simple_col.redfish_version,
registries=None, root=self.sys_simple_col.root)
@mock.patch.object(simple_storage, 'SimpleStorage', autospec=True)
def test_get_members(self, mock_simple):
@ -90,7 +92,8 @@ class SimpleStorageCollectionTestCase(testtools.TestCase):
simple_path = ("/redfish/v1/Systems/437XR1138R2/SimpleStorage/1")
calls = [
mock.call(self.sys_simple_col._conn, simple_path,
self.sys_simple_col.redfish_version, None),
redfish_version=self.sys_simple_col.redfish_version,
registries=None, root=self.sys_simple_col.root),
]
mock_simple.assert_has_calls(calls)
self.assertIsInstance(members, list)

View File

@ -1,4 +1,4 @@
# Copyright 2017 Hewlett Packard Enterprise Development LP
# Copyright 2017-2022 Hewlett Packard Enterprise Development LP
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
@ -34,7 +34,7 @@ class HPESmartStorageTestCase(testtools.TestCase):
path = ("/redfish/v1/Systems/1/SmartStorage")
self.sys_stor = smart_storage.HPESmartStorage(
self.conn, path, '1.0.2', None)
self.conn, path, '1.0.2', registries=None, root=None)
def test__parse_attributes(self):
self.sys_stor._parse_attributes(self.json_doc)

View File

@ -1,4 +1,4 @@
# Copyright 2017 Hewlett Packard Enterprise Development LP
# Copyright 2017-2022 Hewlett Packard Enterprise Development LP
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
@ -32,7 +32,8 @@ class StorageTestCase(testtools.TestCase):
path = ("/redfish/v1/Systems/437XR1138R2/Storage/1")
self.sys_stor = storage.Storage(
self.conn, path, redfish_version='1.0.2')
self.conn, path, redfish_version='1.0.2',
registries=None, root=None)
def test__parse_attributes(self):
self.sys_stor._parse_attributes(self.json_doc)
@ -154,7 +155,7 @@ class StorageCollectionTestCase(testtools.TestCase):
self.conn.get.return_value.json.return_value = self.json_doc
self.sys_stor_col = storage.StorageCollection(
self.conn, '/redfish/v1/Systems/437XR1138R2/Storage',
redfish_version='1.0.2')
redfish_version='1.0.2', registries=None, root=None)
def test__parse_attributes(self):
self.sys_stor_col._parse_attributes(self.json_doc)
@ -171,7 +172,8 @@ class StorageCollectionTestCase(testtools.TestCase):
mock_eth.assert_called_once_with(
self.sys_stor_col._conn,
('/redfish/v1/Systems/437XR1138R2/Storage/1'),
self.sys_stor_col.redfish_version, None)
redfish_version=self.sys_stor_col.redfish_version,
registries=None, root=self.sys_stor_col.root)
@mock.patch.object(storage, 'Storage', autospec=True)
def test_get_members(self, mock_eth):
@ -179,7 +181,8 @@ class StorageCollectionTestCase(testtools.TestCase):
path = ("/redfish/v1/Systems/437XR1138R2/Storage/1")
calls = [
mock.call(self.sys_stor_col._conn, path,
self.sys_stor_col.redfish_version, None),
redfish_version=self.sys_stor_col.redfish_version,
registries=None, root=self.sys_stor_col.root),
]
mock_eth.assert_has_calls(calls)
self.assertIsInstance(members, list)

View File

@ -1,4 +1,4 @@
# Copyright 2017 Hewlett Packard Enterprise Development LP
# Copyright 2017-2022 Hewlett Packard Enterprise Development LP
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
@ -32,7 +32,8 @@ class VolumeTestCase(testtools.TestCase):
vol_path = ("/redfish/v1/Systems/437XR1138R2/Storage/1/Volumes/1")
self.sys_vol = volume.Volume(
self.conn, vol_path, '1.0.2', None)
self.conn, vol_path, redfish_version='1.0.2',
registries=None, root=None)
def test__parse_attributes(self):
self.sys_vol._parse_attributes(self.json_doc)
@ -52,7 +53,7 @@ class VolumeCollectionTestCase(testtools.TestCase):
self.conn.get.return_value.json.return_value = self.json_doc
self.sys_vol_col = volume.VolumeCollection(
self.conn, '/redfish/v1/Systems/437XR1138R2/Storage/1/Volumes',
'1.0.2', None)
redfish_version='1.0.2', registries=None, root=None)
def test__parse_attributes(self):
self.sys_vol_col._parse_attributes(self.json_doc)
@ -69,7 +70,8 @@ class VolumeCollectionTestCase(testtools.TestCase):
mock_vol.assert_called_once_with(
self.sys_vol_col._conn,
('/redfish/v1/Systems/437XR1138R2/Volumes/1'),
self.sys_vol_col.redfish_version, None)
redfish_version=self.sys_vol_col.redfish_version,
registries=None, root=self.sys_vol_col.root)
@mock.patch.object(volume, 'Volume', autospec=True)
def test_get_members(self, mock_vol):
@ -77,7 +79,8 @@ class VolumeCollectionTestCase(testtools.TestCase):
vol_path = ("/redfish/v1/Systems/437XR1138R2/Storage/1/Volumes/1")
calls = [
mock.call(self.sys_vol_col._conn, vol_path,
self.sys_vol_col.redfish_version, None),
redfish_version=self.sys_vol_col.redfish_version,
registries=None, root=self.sys_vol_col.root),
]
mock_vol.assert_has_calls(calls)
self.assertIsInstance(members, list)

View File

@ -1,4 +1,4 @@
# Copyright 2017 Hewlett Packard Enterprise Development LP
# Copyright 2017-2022 Hewlett Packard Enterprise Development LP
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
@ -36,7 +36,8 @@ class EthernetInterfaceTestCase(testtools.TestCase):
eth_path = ("/redfish/v1/Systems/437XR1138R2/EthernetInterfaces/"
"12446A3B0411")
self.sys_eth = ethernet_interface.EthernetInterface(
self.conn, eth_path, '1.0.2', None)
self.conn, eth_path, redfish_version='1.0.2',
registries=None, root=None)
def test__parse_attributes(self):
self.sys_eth._parse_attributes(self.json_doc['default'])
@ -64,7 +65,7 @@ class EthernetInterfaceCollectionTestCase(testtools.TestCase):
self.conn.get.return_value.json.return_value = self.json_doc
self.sys_eth_col = ethernet_interface.EthernetInterfaceCollection(
self.conn, '/redfish/v1/Systems/437XR1138R2/EthernetInterfaces',
'1.0.2', None)
'1.0.2', registries=None, root=None)
def test__parse_attributes(self):
self.sys_eth_col._parse_attributes(self.json_doc)
@ -84,7 +85,8 @@ class EthernetInterfaceCollectionTestCase(testtools.TestCase):
self.sys_eth_col._conn,
('/redfish/v1/Systems/437XR1138R2/EthernetInterfaces/'
'12446A3B0411'),
self.sys_eth_col.redfish_version, None)
redfish_version=self.sys_eth_col.redfish_version, registries=None,
root=self.sys_eth_col.root)
@mock.patch.object(ethernet_interface, 'EthernetInterface', autospec=True)
def test_get_members(self, mock_eth):
@ -93,7 +95,9 @@ class EthernetInterfaceCollectionTestCase(testtools.TestCase):
"12446A3B0411")
calls = [
mock.call(self.sys_eth_col._conn, eth_path,
self.sys_eth_col.redfish_version, None),
redfish_version=self.sys_eth_col.redfish_version,
registries=None,
root=self.sys_eth_col.root),
]
mock_eth.assert_has_calls(calls)
self.assertIsInstance(members, list)

View File

@ -1,4 +1,4 @@
# Copyright 2017 Hewlett Packard Enterprise Development LP
# Copyright 2017-2022 Hewlett Packard Enterprise Development LP
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
@ -33,7 +33,8 @@ class PCIDeviceTestCase(testtools.TestCase):
pci_path = "/redfish/v1/Systems/1/PCIDevices/1"
self.sys_pci = pci_device.PCIDevice(
self.conn, pci_path, '1.0.2', None)
self.conn, pci_path, redfish_version='1.0.2',
registries=None, root=None)
def test__parse_attributes(self):
self.sys_pci._parse_attributes(self.json_doc)
@ -53,7 +54,7 @@ class PCIDeviceCollectionTestCase(testtools.TestCase):
self.conn.get.return_value.json.return_value = self.json_doc
self.sys_pci_col = pci_device.PCIDeviceCollection(
self.conn, '/redfish/v1/Systems/1/PCIDevices',
redfish_version='1.0.2')
redfish_version='1.0.2', registries=None, root=None)
def test__parse_attributes(self):
self.sys_pci_col._parse_attributes(self.json_doc)
@ -70,7 +71,8 @@ class PCIDeviceCollectionTestCase(testtools.TestCase):
mock_pci.assert_called_once_with(
self.sys_pci_col._conn,
('/redfish/v1/Systems/1/PCIDevices/1'),
self.sys_pci_col.redfish_version, None)
redfish_version=self.sys_pci_col.redfish_version,
registries=None, root=self.sys_pci_col.root)
@mock.patch.object(pci_device, 'PCIDevice', autospec=True)
def test_get_members(self, mock_pci):
@ -79,9 +81,11 @@ class PCIDeviceCollectionTestCase(testtools.TestCase):
"/redfish/v1/Systems/1/PCIDevices/6"]
calls = [
mock.call(self.sys_pci_col._conn, path_list[0],
self.sys_pci_col.redfish_version, None),
redfish_version=self.sys_pci_col.redfish_version,
registries=None, root=self.sys_pci_col.root),
mock.call(self.sys_pci_col._conn, path_list[1],
self.sys_pci_col.redfish_version, None)
redfish_version=self.sys_pci_col.redfish_version,
registries=None, root=self.sys_pci_col.root)
]
mock_pci.assert_has_calls(calls)
self.assertIsInstance(members, list)

View File

@ -9,5 +9,5 @@ retrying!=1.3.0,>=1.2.3 # Apache-2.0
pysnmp>=4.2.3,<5.0.0 # BSD
# Redfish communication uses the Sushy library
sushy>=3.1.0
sushy>=3.11.0,<4.0.0
pyOpenSSL>=19.1.0