From 7488ae2048045082777522ebb958eb6891d56820 Mon Sep 17 00:00:00 2001 From: Aparna Date: Wed, 12 Jul 2017 09:42:23 +0000 Subject: [PATCH] Restructing redfish resource test files This commit restructures the test files in redfish/resources. Also renaming the function 'get_member_from_device' to 'get_member_device' in redfish virtual media resource. Change-Id: I6365d72c5f9f43747120c28b9dcef81a03cad4da --- proliantutils/redfish/redfish.py | 6 +++--- proliantutils/redfish/resources/manager/virtual_media.py | 2 +- proliantutils/tests/redfish/resources/manager/__init__.py | 0 .../tests/redfish/resources/{ => manager}/test_manager.py | 0 .../redfish/resources/{ => manager}/test_virtual_media.py | 4 ++-- proliantutils/tests/redfish/resources/system/__init__.py | 0 .../tests/redfish/resources/{ => system}/test_bios.py | 0 .../tests/redfish/resources/{ => system}/test_system.py | 0 8 files changed, 6 insertions(+), 6 deletions(-) create mode 100644 proliantutils/tests/redfish/resources/manager/__init__.py rename proliantutils/tests/redfish/resources/{ => manager}/test_manager.py (100%) rename proliantutils/tests/redfish/resources/{ => manager}/test_virtual_media.py (97%) create mode 100644 proliantutils/tests/redfish/resources/system/__init__.py rename proliantutils/tests/redfish/resources/{ => system}/test_bios.py (100%) rename proliantutils/tests/redfish/resources/{ => system}/test_system.py (100%) diff --git a/proliantutils/redfish/redfish.py b/proliantutils/redfish/redfish.py index 25fe542c..b1f6b11d 100644 --- a/proliantutils/redfish/redfish.py +++ b/proliantutils/redfish/redfish.py @@ -349,7 +349,7 @@ class RedfishOperations(operations.IloOperations): manager = self._get_sushy_manager(PROLIANT_MANAGER_ID) try: vmedia_device = ( - manager.virtual_media.get_member_from_device( + manager.virtual_media.get_member_device( VIRTUAL_MEDIA_MAP[device])) if not vmedia_device.inserted: LOG.debug(self._("No media available in the device '%s' to " @@ -379,7 +379,7 @@ class RedfishOperations(operations.IloOperations): manager = self._get_sushy_manager(PROLIANT_MANAGER_ID) try: vmedia_device = ( - manager.virtual_media.get_member_from_device( + manager.virtual_media.get_member_device( VIRTUAL_MEDIA_MAP[device])) if vmedia_device.inserted: vmedia_device.eject_vmedia() @@ -425,7 +425,7 @@ class RedfishOperations(operations.IloOperations): manager = self._get_sushy_manager(PROLIANT_MANAGER_ID) try: vmedia_device = ( - manager.virtual_media.get_member_from_device( + manager.virtual_media.get_member_device( VIRTUAL_MEDIA_MAP[device])) vmedia_device.set_vm_status(BOOT_OPTION_MAP[boot_option]) except sushy.exceptions.SushyError as e: diff --git a/proliantutils/redfish/resources/manager/virtual_media.py b/proliantutils/redfish/resources/manager/virtual_media.py index 42216513..b0edd1c2 100644 --- a/proliantutils/redfish/resources/manager/virtual_media.py +++ b/proliantutils/redfish/resources/manager/virtual_media.py @@ -111,7 +111,7 @@ class VirtualMediaCollection(base.ResourceCollectionBase): def _resource_type(self): return VirtualMedia - def get_member_from_device(self, device): + def get_member_device(self, device): """Returns the given virtual media device object. :param device: virtual media device to be queried diff --git a/proliantutils/tests/redfish/resources/manager/__init__.py b/proliantutils/tests/redfish/resources/manager/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/proliantutils/tests/redfish/resources/test_manager.py b/proliantutils/tests/redfish/resources/manager/test_manager.py similarity index 100% rename from proliantutils/tests/redfish/resources/test_manager.py rename to proliantutils/tests/redfish/resources/manager/test_manager.py diff --git a/proliantutils/tests/redfish/resources/test_virtual_media.py b/proliantutils/tests/redfish/resources/manager/test_virtual_media.py similarity index 97% rename from proliantutils/tests/redfish/resources/test_virtual_media.py rename to proliantutils/tests/redfish/resources/manager/test_virtual_media.py index c701fed7..e1310de9 100644 --- a/proliantutils/tests/redfish/resources/test_virtual_media.py +++ b/proliantutils/tests/redfish/resources/manager/test_virtual_media.py @@ -39,13 +39,13 @@ class VirtualMediaCollectionTestCase(testtools.TestCase): self.conn, '/redfish/v1/Managers/1/VirtualMedia', redfish_version='1.0.2') - def test_get_member_from_device(self): + def test_get_member_device(self): with open('proliantutils/tests/redfish/' 'json_samples/vmedia.json', 'r') as f: self.conn.get.return_value.json.return_value = ( json.loads(f.read())['default']) - obj = self.vmedia_coll_inst.get_member_from_device( + obj = self.vmedia_coll_inst.get_member_device( constants.VIRTUAL_MEDIA_CD) self.assertIsInstance(obj, virtual_media.VirtualMedia) diff --git a/proliantutils/tests/redfish/resources/system/__init__.py b/proliantutils/tests/redfish/resources/system/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/proliantutils/tests/redfish/resources/test_bios.py b/proliantutils/tests/redfish/resources/system/test_bios.py similarity index 100% rename from proliantutils/tests/redfish/resources/test_bios.py rename to proliantutils/tests/redfish/resources/system/test_bios.py diff --git a/proliantutils/tests/redfish/resources/test_system.py b/proliantutils/tests/redfish/resources/system/test_system.py similarity index 100% rename from proliantutils/tests/redfish/resources/test_system.py rename to proliantutils/tests/redfish/resources/system/test_system.py