From 61d491c73a6a43d955a1b1845973f3679888e3fc Mon Sep 17 00:00:00 2001 From: Lin Yang Date: Mon, 12 Feb 2018 16:22:12 -0800 Subject: [PATCH] Create new v2_1 folder for current json_samples It would be clear to place json_samples file of each RSD version into different folder. Change-Id: Idb8ab06190fabd462f862d47f28425d9e4250ab2 --- .../unit/json_samples/{ => v2_1}/chassis.json | 0 .../{ => v2_1}/chassis_collection.json | 0 .../json_samples/{ => v2_1}/endpoint.json | 0 .../{ => v2_1}/endpoint_collection.json | 0 .../unit/json_samples/{ => v2_1}/fabric.json | 0 .../{ => v2_1}/fabric_collection.json | 0 .../{ => v2_1}/logical_drive.json | 0 .../{ => v2_1}/logical_drive_collection.json | 0 .../unit/json_samples/{ => v2_1}/node.json | 0 .../{ => v2_1}/node_collection.json | 0 .../{ => v2_1}/physical_drive.json | 0 .../{ => v2_1}/physical_drive_collection.json | 0 .../json_samples/{ => v2_1}/processor.json | 0 .../json_samples/{ => v2_1}/processor2.json | 0 .../{ => v2_1}/processor_collection.json | 0 .../{ => v2_1}/remote_target.json | 0 .../{ => v2_1}/remote_target_collection.json | 0 .../unit/json_samples/{ => v2_1}/root.json | 0 .../{ => v2_1}/storage_service.json | 0 .../storage_service_collection.json | 0 .../unit/json_samples/{ => v2_1}/system.json | 0 .../unit/json_samples/{ => v2_1}/zone.json | 0 .../{ => v2_1}/zone_collection.json | 0 .../resources/v2_1/chassis/test_chassis.py | 6 ++-- .../resources/v2_1/fabric/test_endpoint.py | 4 +-- .../unit/resources/v2_1/fabric/test_fabric.py | 20 ++++++------- .../unit/resources/v2_1/fabric/test_zone.py | 7 +++-- .../unit/resources/v2_1/node/test_node.py | 12 ++++---- .../storage_service/test_storage_service.py | 28 +++++++++---------- .../unit/resources/v2_1/test_rsdlib_v2_1.py | 8 +++++- rsd_lib/tests/unit/test_main.py | 2 +- 31 files changed, 47 insertions(+), 40 deletions(-) rename rsd_lib/tests/unit/json_samples/{ => v2_1}/chassis.json (100%) rename rsd_lib/tests/unit/json_samples/{ => v2_1}/chassis_collection.json (100%) rename rsd_lib/tests/unit/json_samples/{ => v2_1}/endpoint.json (100%) rename rsd_lib/tests/unit/json_samples/{ => v2_1}/endpoint_collection.json (100%) rename rsd_lib/tests/unit/json_samples/{ => v2_1}/fabric.json (100%) rename rsd_lib/tests/unit/json_samples/{ => v2_1}/fabric_collection.json (100%) rename rsd_lib/tests/unit/json_samples/{ => v2_1}/logical_drive.json (100%) rename rsd_lib/tests/unit/json_samples/{ => v2_1}/logical_drive_collection.json (100%) rename rsd_lib/tests/unit/json_samples/{ => v2_1}/node.json (100%) rename rsd_lib/tests/unit/json_samples/{ => v2_1}/node_collection.json (100%) rename rsd_lib/tests/unit/json_samples/{ => v2_1}/physical_drive.json (100%) rename rsd_lib/tests/unit/json_samples/{ => v2_1}/physical_drive_collection.json (100%) rename rsd_lib/tests/unit/json_samples/{ => v2_1}/processor.json (100%) rename rsd_lib/tests/unit/json_samples/{ => v2_1}/processor2.json (100%) rename rsd_lib/tests/unit/json_samples/{ => v2_1}/processor_collection.json (100%) rename rsd_lib/tests/unit/json_samples/{ => v2_1}/remote_target.json (100%) rename rsd_lib/tests/unit/json_samples/{ => v2_1}/remote_target_collection.json (100%) rename rsd_lib/tests/unit/json_samples/{ => v2_1}/root.json (100%) rename rsd_lib/tests/unit/json_samples/{ => v2_1}/storage_service.json (100%) rename rsd_lib/tests/unit/json_samples/{ => v2_1}/storage_service_collection.json (100%) rename rsd_lib/tests/unit/json_samples/{ => v2_1}/system.json (100%) rename rsd_lib/tests/unit/json_samples/{ => v2_1}/zone.json (100%) rename rsd_lib/tests/unit/json_samples/{ => v2_1}/zone_collection.json (100%) diff --git a/rsd_lib/tests/unit/json_samples/chassis.json b/rsd_lib/tests/unit/json_samples/v2_1/chassis.json similarity index 100% rename from rsd_lib/tests/unit/json_samples/chassis.json rename to rsd_lib/tests/unit/json_samples/v2_1/chassis.json diff --git a/rsd_lib/tests/unit/json_samples/chassis_collection.json b/rsd_lib/tests/unit/json_samples/v2_1/chassis_collection.json similarity index 100% rename from rsd_lib/tests/unit/json_samples/chassis_collection.json rename to rsd_lib/tests/unit/json_samples/v2_1/chassis_collection.json diff --git a/rsd_lib/tests/unit/json_samples/endpoint.json b/rsd_lib/tests/unit/json_samples/v2_1/endpoint.json similarity index 100% rename from rsd_lib/tests/unit/json_samples/endpoint.json rename to rsd_lib/tests/unit/json_samples/v2_1/endpoint.json diff --git a/rsd_lib/tests/unit/json_samples/endpoint_collection.json b/rsd_lib/tests/unit/json_samples/v2_1/endpoint_collection.json similarity index 100% rename from rsd_lib/tests/unit/json_samples/endpoint_collection.json rename to rsd_lib/tests/unit/json_samples/v2_1/endpoint_collection.json diff --git a/rsd_lib/tests/unit/json_samples/fabric.json b/rsd_lib/tests/unit/json_samples/v2_1/fabric.json similarity index 100% rename from rsd_lib/tests/unit/json_samples/fabric.json rename to rsd_lib/tests/unit/json_samples/v2_1/fabric.json diff --git a/rsd_lib/tests/unit/json_samples/fabric_collection.json b/rsd_lib/tests/unit/json_samples/v2_1/fabric_collection.json similarity index 100% rename from rsd_lib/tests/unit/json_samples/fabric_collection.json rename to rsd_lib/tests/unit/json_samples/v2_1/fabric_collection.json diff --git a/rsd_lib/tests/unit/json_samples/logical_drive.json b/rsd_lib/tests/unit/json_samples/v2_1/logical_drive.json similarity index 100% rename from rsd_lib/tests/unit/json_samples/logical_drive.json rename to rsd_lib/tests/unit/json_samples/v2_1/logical_drive.json diff --git a/rsd_lib/tests/unit/json_samples/logical_drive_collection.json b/rsd_lib/tests/unit/json_samples/v2_1/logical_drive_collection.json similarity index 100% rename from rsd_lib/tests/unit/json_samples/logical_drive_collection.json rename to rsd_lib/tests/unit/json_samples/v2_1/logical_drive_collection.json diff --git a/rsd_lib/tests/unit/json_samples/node.json b/rsd_lib/tests/unit/json_samples/v2_1/node.json similarity index 100% rename from rsd_lib/tests/unit/json_samples/node.json rename to rsd_lib/tests/unit/json_samples/v2_1/node.json diff --git a/rsd_lib/tests/unit/json_samples/node_collection.json b/rsd_lib/tests/unit/json_samples/v2_1/node_collection.json similarity index 100% rename from rsd_lib/tests/unit/json_samples/node_collection.json rename to rsd_lib/tests/unit/json_samples/v2_1/node_collection.json diff --git a/rsd_lib/tests/unit/json_samples/physical_drive.json b/rsd_lib/tests/unit/json_samples/v2_1/physical_drive.json similarity index 100% rename from rsd_lib/tests/unit/json_samples/physical_drive.json rename to rsd_lib/tests/unit/json_samples/v2_1/physical_drive.json diff --git a/rsd_lib/tests/unit/json_samples/physical_drive_collection.json b/rsd_lib/tests/unit/json_samples/v2_1/physical_drive_collection.json similarity index 100% rename from rsd_lib/tests/unit/json_samples/physical_drive_collection.json rename to rsd_lib/tests/unit/json_samples/v2_1/physical_drive_collection.json diff --git a/rsd_lib/tests/unit/json_samples/processor.json b/rsd_lib/tests/unit/json_samples/v2_1/processor.json similarity index 100% rename from rsd_lib/tests/unit/json_samples/processor.json rename to rsd_lib/tests/unit/json_samples/v2_1/processor.json diff --git a/rsd_lib/tests/unit/json_samples/processor2.json b/rsd_lib/tests/unit/json_samples/v2_1/processor2.json similarity index 100% rename from rsd_lib/tests/unit/json_samples/processor2.json rename to rsd_lib/tests/unit/json_samples/v2_1/processor2.json diff --git a/rsd_lib/tests/unit/json_samples/processor_collection.json b/rsd_lib/tests/unit/json_samples/v2_1/processor_collection.json similarity index 100% rename from rsd_lib/tests/unit/json_samples/processor_collection.json rename to rsd_lib/tests/unit/json_samples/v2_1/processor_collection.json diff --git a/rsd_lib/tests/unit/json_samples/remote_target.json b/rsd_lib/tests/unit/json_samples/v2_1/remote_target.json similarity index 100% rename from rsd_lib/tests/unit/json_samples/remote_target.json rename to rsd_lib/tests/unit/json_samples/v2_1/remote_target.json diff --git a/rsd_lib/tests/unit/json_samples/remote_target_collection.json b/rsd_lib/tests/unit/json_samples/v2_1/remote_target_collection.json similarity index 100% rename from rsd_lib/tests/unit/json_samples/remote_target_collection.json rename to rsd_lib/tests/unit/json_samples/v2_1/remote_target_collection.json diff --git a/rsd_lib/tests/unit/json_samples/root.json b/rsd_lib/tests/unit/json_samples/v2_1/root.json similarity index 100% rename from rsd_lib/tests/unit/json_samples/root.json rename to rsd_lib/tests/unit/json_samples/v2_1/root.json diff --git a/rsd_lib/tests/unit/json_samples/storage_service.json b/rsd_lib/tests/unit/json_samples/v2_1/storage_service.json similarity index 100% rename from rsd_lib/tests/unit/json_samples/storage_service.json rename to rsd_lib/tests/unit/json_samples/v2_1/storage_service.json diff --git a/rsd_lib/tests/unit/json_samples/storage_service_collection.json b/rsd_lib/tests/unit/json_samples/v2_1/storage_service_collection.json similarity index 100% rename from rsd_lib/tests/unit/json_samples/storage_service_collection.json rename to rsd_lib/tests/unit/json_samples/v2_1/storage_service_collection.json diff --git a/rsd_lib/tests/unit/json_samples/system.json b/rsd_lib/tests/unit/json_samples/v2_1/system.json similarity index 100% rename from rsd_lib/tests/unit/json_samples/system.json rename to rsd_lib/tests/unit/json_samples/v2_1/system.json diff --git a/rsd_lib/tests/unit/json_samples/zone.json b/rsd_lib/tests/unit/json_samples/v2_1/zone.json similarity index 100% rename from rsd_lib/tests/unit/json_samples/zone.json rename to rsd_lib/tests/unit/json_samples/v2_1/zone.json diff --git a/rsd_lib/tests/unit/json_samples/zone_collection.json b/rsd_lib/tests/unit/json_samples/v2_1/zone_collection.json similarity index 100% rename from rsd_lib/tests/unit/json_samples/zone_collection.json rename to rsd_lib/tests/unit/json_samples/v2_1/zone_collection.json diff --git a/rsd_lib/tests/unit/resources/v2_1/chassis/test_chassis.py b/rsd_lib/tests/unit/resources/v2_1/chassis/test_chassis.py index ce8f1c2..78e1c5b 100644 --- a/rsd_lib/tests/unit/resources/v2_1/chassis/test_chassis.py +++ b/rsd_lib/tests/unit/resources/v2_1/chassis/test_chassis.py @@ -25,7 +25,7 @@ class TestChassis(base.TestCase): super(TestChassis, self).setUp() self.conn = mock.Mock() - with open('rsd_lib/tests/unit/json_samples/chassis.json', + with open('rsd_lib/tests/unit/json_samples/v2_1/chassis.json', 'r') as f: self.conn.get.return_value.json.return_value = json.loads(f.read()) @@ -58,8 +58,8 @@ class TestChassisCollection(base.TestCase): super(TestChassisCollection, self).setUp() self.conn = mock.Mock() - with open('rsd_lib/tests/unit/json_samples/chassis_collection.json', - 'r') as f: + with open('rsd_lib/tests/unit/json_samples/v2_1/' + 'chassis_collection.json', 'r') as f: self.conn.get.return_value.json.return_value = json.loads(f.read()) self.chassis_col = chassis.ChassisCollection(self.conn, diff --git a/rsd_lib/tests/unit/resources/v2_1/fabric/test_endpoint.py b/rsd_lib/tests/unit/resources/v2_1/fabric/test_endpoint.py index 5cce510..b428eb2 100644 --- a/rsd_lib/tests/unit/resources/v2_1/fabric/test_endpoint.py +++ b/rsd_lib/tests/unit/resources/v2_1/fabric/test_endpoint.py @@ -26,7 +26,7 @@ class EndpointTestCase(testtools.TestCase): def setUp(self): super(EndpointTestCase, self).setUp() self.conn = mock.Mock() - with open('rsd_lib/tests/unit/json_samples/endpoint.json', + with open('rsd_lib/tests/unit/json_samples/v2_1/endpoint.json', 'r') as f: self.conn.get.return_value.json.return_value = json.loads(f.read()) @@ -70,7 +70,7 @@ class EndpointCollectionTestCase(testtools.TestCase): def setUp(self): super(EndpointCollectionTestCase, self).setUp() self.conn = mock.Mock() - with open('rsd_lib/tests/unit/json_samples/' + with open('rsd_lib/tests/unit/json_samples/v2_1/' 'endpoint_collection.json', 'r') as f: self.conn.get.return_value.json.return_value = json.loads(f.read()) self.endpoint_col = endpoint.EndpointCollection( diff --git a/rsd_lib/tests/unit/resources/v2_1/fabric/test_fabric.py b/rsd_lib/tests/unit/resources/v2_1/fabric/test_fabric.py index 83d80f1..5777c86 100644 --- a/rsd_lib/tests/unit/resources/v2_1/fabric/test_fabric.py +++ b/rsd_lib/tests/unit/resources/v2_1/fabric/test_fabric.py @@ -29,7 +29,7 @@ class FabricTestCase(testtools.TestCase): def setUp(self): super(FabricTestCase, self).setUp() self.conn = mock.Mock() - with open('rsd_lib/tests/unit/json_samples/fabric.json', + with open('rsd_lib/tests/unit/json_samples/v2_1/fabric.json', 'r') as f: self.conn.get.return_value.json.return_value = json.loads(f.read()) @@ -61,7 +61,7 @@ class FabricTestCase(testtools.TestCase): self.assertIsNone(self.fabric_inst._endpoints) # | GIVEN | self.conn.get.return_value.json.reset_mock() - with open('rsd_lib/tests/unit/json_samples/' + with open('rsd_lib/tests/unit/json_samples/v2_1/' 'endpoint_collection.json', 'r') as f: self.conn.get.return_value.json.return_value = json.loads(f.read()) # | WHEN | @@ -81,7 +81,7 @@ class FabricTestCase(testtools.TestCase): def test_endpoints_on_refresh(self): # | GIVEN | - with open('rsd_lib/tests/unit/json_samples/' + with open('rsd_lib/tests/unit/json_samples/v2_1/' 'endpoint_collection.json', 'r') as f: self.conn.get.return_value.json.return_value = json.loads(f.read()) # | WHEN & THEN | @@ -89,7 +89,7 @@ class FabricTestCase(testtools.TestCase): endpoint.EndpointCollection) # On refreshing the fabric instance... - with open('rsd_lib/tests/unit/json_samples/' + with open('rsd_lib/tests/unit/json_samples/v2_1/' 'fabric.json', 'r') as f: self.conn.get.return_value.json.return_value = json.loads(f.read()) self.fabric_inst.refresh() @@ -98,7 +98,7 @@ class FabricTestCase(testtools.TestCase): self.assertIsNone(self.fabric_inst._endpoints) # | GIVEN | - with open('rsd_lib/tests/unit/json_samples/' + with open('rsd_lib/tests/unit/json_samples/v2_1/' 'endpoint_collection.json', 'r') as f: self.conn.get.return_value.json.return_value = json.loads(f.read()) # | WHEN & THEN | @@ -116,7 +116,7 @@ class FabricTestCase(testtools.TestCase): self.assertIsNone(self.fabric_inst._zones) # | GIVEN | self.conn.get.return_value.json.reset_mock() - with open('rsd_lib/tests/unit/json_samples/' + with open('rsd_lib/tests/unit/json_samples/v2_1/' 'zone_collection.json', 'r') as f: self.conn.get.return_value.json.return_value = json.loads(f.read()) # | WHEN | @@ -136,7 +136,7 @@ class FabricTestCase(testtools.TestCase): def test_zones_on_refresh(self): # | GIVEN | - with open('rsd_lib/tests/unit/json_samples/' + with open('rsd_lib/tests/unit/json_samples/v2_1/' 'zone_collection.json', 'r') as f: self.conn.get.return_value.json.return_value = json.loads(f.read()) # | WHEN & THEN | @@ -144,7 +144,7 @@ class FabricTestCase(testtools.TestCase): zone.ZoneCollection) # On refreshing the fabric instance... - with open('rsd_lib/tests/unit/json_samples/' + with open('rsd_lib/tests/unit/json_samples/v2_1/' 'fabric.json', 'r') as f: self.conn.get.return_value.json.return_value = json.loads(f.read()) self.fabric_inst.refresh() @@ -153,7 +153,7 @@ class FabricTestCase(testtools.TestCase): self.assertIsNone(self.fabric_inst._zones) # | GIVEN | - with open('rsd_lib/tests/unit/json_samples/' + with open('rsd_lib/tests/unit/json_samples/v2_1/' 'zone_collection.json', 'r') as f: self.conn.get.return_value.json.return_value = json.loads(f.read()) # | WHEN & THEN | @@ -166,7 +166,7 @@ class FabricCollectionTestCase(testtools.TestCase): def setUp(self): super(FabricCollectionTestCase, self).setUp() self.conn = mock.Mock() - with open('rsd_lib/tests/unit/json_samples/' + with open('rsd_lib/tests/unit/json_samples/v2_1/' 'fabric_collection.json', 'r') as f: self.conn.get.return_value.json.return_value = json.loads(f.read()) self.fabric_col = fabric.FabricCollection( diff --git a/rsd_lib/tests/unit/resources/v2_1/fabric/test_zone.py b/rsd_lib/tests/unit/resources/v2_1/fabric/test_zone.py index bc01c77..3a67c9e 100644 --- a/rsd_lib/tests/unit/resources/v2_1/fabric/test_zone.py +++ b/rsd_lib/tests/unit/resources/v2_1/fabric/test_zone.py @@ -26,7 +26,7 @@ class ZoneTestCase(testtools.TestCase): def setUp(self): super(ZoneTestCase, self).setUp() self.conn = mock.Mock() - with open('rsd_lib/tests/unit/json_samples/zone.json', + with open('rsd_lib/tests/unit/json_samples/v2_1/zone.json', 'r') as f: self.conn.get.return_value.json.return_value = json.loads(f.read()) @@ -50,7 +50,8 @@ class ZoneTestCase(testtools.TestCase): def test_get_endpoints(self): self.conn.get.return_value.json.reset_mock() - with open('rsd_lib/tests/unit/json_samples/endpoint.json', 'r') as f: + with open('rsd_lib/tests/unit/json_samples/v2_1/' + 'endpoint.json', 'r') as f: self.conn.get.return_value.json.return_value = json.loads(f.read()) endpoints = self.zone_inst.get_endpoints() self.assertEqual(endpoints[0].identity, 'NVMeDrivePF1') @@ -61,7 +62,7 @@ class ZoneCollectionTestCase(testtools.TestCase): def setUp(self): super(ZoneCollectionTestCase, self).setUp() self.conn = mock.Mock() - with open('rsd_lib/tests/unit/json_samples/' + with open('rsd_lib/tests/unit/json_samples/v2_1/' 'zone_collection.json', 'r') as f: self.conn.get.return_value.json.return_value = json.loads(f.read()) self.zone_col = zone.ZoneCollection( diff --git a/rsd_lib/tests/unit/resources/v2_1/node/test_node.py b/rsd_lib/tests/unit/resources/v2_1/node/test_node.py index b561261..6a2c99b 100644 --- a/rsd_lib/tests/unit/resources/v2_1/node/test_node.py +++ b/rsd_lib/tests/unit/resources/v2_1/node/test_node.py @@ -31,7 +31,7 @@ class NodeTestCase(testtools.TestCase): def setUp(self): super(NodeTestCase, self).setUp() self.conn = mock.Mock() - with open('rsd_lib/tests/unit/json_samples/node.json', 'r') as f: + with open('rsd_lib/tests/unit/json_samples/v2_1/node.json', 'r') as f: self.conn.get.return_value.json.return_value = json.loads(f.read()) self.node_inst = node.Node( @@ -362,7 +362,7 @@ class NodeTestCase(testtools.TestCase): self.assertIsNone(self.node_inst._system) # | GIVEN | self.conn.get.return_value.json.reset_mock() - with open('rsd_lib/tests/unit/json_samples/system.json', + with open('rsd_lib/tests/unit/json_samples/v2_1/system.json', 'r') as f: self.conn.get.return_value.json.return_value = json.loads(f.read()) # | WHEN | @@ -382,7 +382,7 @@ class NodeTestCase(testtools.TestCase): def test_system_on_refresh(self): # | GIVEN | - with open('rsd_lib/tests/unit/json_samples/system.json', + with open('rsd_lib/tests/unit/json_samples/v2_1/system.json', 'r') as f: self.conn.get.return_value.json.return_value = json.loads(f.read()) # | WHEN & THEN | @@ -390,7 +390,7 @@ class NodeTestCase(testtools.TestCase): system.System) # On refreshing the system instance... - with open('rsd_lib/tests/unit/json_samples/node.json', 'r') as f: + with open('rsd_lib/tests/unit/json_samples/v2_1/node.json', 'r') as f: self.conn.get.return_value.json.return_value = json.loads(f.read()) self.node_inst.refresh() @@ -398,7 +398,7 @@ class NodeTestCase(testtools.TestCase): self.assertIsNone(self.node_inst._system) # | GIVEN | - with open('rsd_lib/tests/unit/json_samples/system.json', + with open('rsd_lib/tests/unit/json_samples/v2_1/system.json', 'r') as f: self.conn.get.return_value.json.return_value = json.loads(f.read()) # | WHEN & THEN | @@ -415,7 +415,7 @@ class NodeCollectionTestCase(testtools.TestCase): def setUp(self): super(NodeCollectionTestCase, self).setUp() self.conn = mock.Mock() - with open('rsd_lib/tests/unit/json_samples/node_collection.json', + with open('rsd_lib/tests/unit/json_samples/v2_1/node_collection.json', 'r') as f: self.conn.get.return_value = request_fakes.fake_request_get( json.loads(f.read())) diff --git a/rsd_lib/tests/unit/resources/v2_1/storage_service/test_storage_service.py b/rsd_lib/tests/unit/resources/v2_1/storage_service/test_storage_service.py index aa36c65..f0fa756 100644 --- a/rsd_lib/tests/unit/resources/v2_1/storage_service/test_storage_service.py +++ b/rsd_lib/tests/unit/resources/v2_1/storage_service/test_storage_service.py @@ -30,7 +30,7 @@ class StorageServiceTestCase(testtools.TestCase): def setUp(self): super(StorageServiceTestCase, self).setUp() self.conn = mock.Mock() - with open('rsd_lib/tests/unit/json_samples/storage_service.json', + with open('rsd_lib/tests/unit/json_samples/v2_1/storage_service.json', 'r') as f: self.conn.get.return_value.json.return_value = json.loads(f.read()) @@ -63,7 +63,7 @@ class StorageServiceTestCase(testtools.TestCase): self.assertIsNone(self.storage_service_inst._logical_drives) # | GIVEN | self.conn.get.return_value.json.reset_mock() - with open('rsd_lib/tests/unit/json_samples/' + with open('rsd_lib/tests/unit/json_samples/v2_1/' 'logical_drive_collection.json', 'r') as f: self.conn.get.return_value.json.return_value = json.loads(f.read()) # | WHEN | @@ -83,7 +83,7 @@ class StorageServiceTestCase(testtools.TestCase): def test_logical_drives_on_refresh(self): # | GIVEN | - with open('rsd_lib/tests/unit/json_samples/' + with open('rsd_lib/tests/unit/json_samples/v2_1/' 'logical_drive_collection.json', 'r') as f: self.conn.get.return_value.json.return_value = json.loads(f.read()) # | WHEN & THEN | @@ -91,7 +91,7 @@ class StorageServiceTestCase(testtools.TestCase): logical_drive.LogicalDriveCollection) # On refreshing the storage service instance... - with open('rsd_lib/tests/unit/json_samples/' + with open('rsd_lib/tests/unit/json_samples/v2_1/' 'storage_service.json', 'r') as f: self.conn.get.return_value.json.return_value = json.loads(f.read()) self.storage_service_inst.refresh() @@ -100,7 +100,7 @@ class StorageServiceTestCase(testtools.TestCase): self.assertIsNone(self.storage_service_inst._logical_drives) # | GIVEN | - with open('rsd_lib/tests/unit/json_samples/' + with open('rsd_lib/tests/unit/json_samples/v2_1/' 'logical_drive_collection.json', 'r') as f: self.conn.get.return_value.json.return_value = json.loads(f.read()) # | WHEN & THEN | @@ -118,7 +118,7 @@ class StorageServiceTestCase(testtools.TestCase): self.assertIsNone(self.storage_service_inst._physical_drives) # | GIVEN | self.conn.get.return_value.json.reset_mock() - with open('rsd_lib/tests/unit/json_samples/' + with open('rsd_lib/tests/unit/json_samples/v2_1/' 'physical_drive_collection.json', 'r') as f: self.conn.get.return_value.json.return_value = json.loads(f.read()) # | WHEN | @@ -138,7 +138,7 @@ class StorageServiceTestCase(testtools.TestCase): def test_physical_drives_on_refresh(self): # | GIVEN | - with open('rsd_lib/tests/unit/json_samples/' + with open('rsd_lib/tests/unit/json_samples/v2_1/' 'physical_drive_collection.json', 'r') as f: self.conn.get.return_value.json.return_value = json.loads(f.read()) # | WHEN & THEN | @@ -146,7 +146,7 @@ class StorageServiceTestCase(testtools.TestCase): physical_drive.PhysicalDriveCollection) # On refreshing the storage service instance... - with open('rsd_lib/tests/unit/json_samples/' + with open('rsd_lib/tests/unit/json_samples/v2_1/' 'storage_service.json', 'r') as f: self.conn.get.return_value.json.return_value = json.loads(f.read()) self.storage_service_inst.refresh() @@ -155,7 +155,7 @@ class StorageServiceTestCase(testtools.TestCase): self.assertIsNone(self.storage_service_inst._physical_drives) # | GIVEN | - with open('rsd_lib/tests/unit/json_samples/' + with open('rsd_lib/tests/unit/json_samples/v2_1/' 'physical_drive_collection.json', 'r') as f: self.conn.get.return_value.json.return_value = json.loads(f.read()) # | WHEN & THEN | @@ -173,7 +173,7 @@ class StorageServiceTestCase(testtools.TestCase): self.assertIsNone(self.storage_service_inst._remote_targets) # | GIVEN | self.conn.get.return_value.json.reset_mock() - with open('rsd_lib/tests/unit/json_samples/' + with open('rsd_lib/tests/unit/json_samples/v2_1/' 'remote_target_collection.json', 'r') as f: self.conn.get.return_value.json.return_value = json.loads(f.read()) # | WHEN | @@ -193,7 +193,7 @@ class StorageServiceTestCase(testtools.TestCase): def test_remote_targets_on_refresh(self): # | GIVEN | - with open('rsd_lib/tests/unit/json_samples/' + with open('rsd_lib/tests/unit/json_samples/v2_1/' 'remote_target_collection.json', 'r') as f: self.conn.get.return_value.json.return_value = json.loads(f.read()) # | WHEN & THEN | @@ -201,7 +201,7 @@ class StorageServiceTestCase(testtools.TestCase): remote_target.RemoteTargetCollection) # On refreshing the storage service instance... - with open('rsd_lib/tests/unit/json_samples/' + with open('rsd_lib/tests/unit/json_samples/v2_1/' 'storage_service.json', 'r') as f: self.conn.get.return_value.json.return_value = json.loads(f.read()) self.storage_service_inst.refresh() @@ -210,7 +210,7 @@ class StorageServiceTestCase(testtools.TestCase): self.assertIsNone(self.storage_service_inst._remote_targets) # | GIVEN | - with open('rsd_lib/tests/unit/json_samples/' + with open('rsd_lib/tests/unit/json_samples/v2_1/' 'remote_target_collection.json', 'r') as f: self.conn.get.return_value.json.return_value = json.loads(f.read()) # | WHEN & THEN | @@ -223,7 +223,7 @@ class StorageServiceCollectionTestCase(testtools.TestCase): def setUp(self): super(StorageServiceCollectionTestCase, self).setUp() self.conn = mock.Mock() - with open('rsd_lib/tests/unit/json_samples/' + with open('rsd_lib/tests/unit/json_samples/v2_1/' 'storage_service_collection.json', 'r') as f: self.conn.get.return_value.json.return_value = json.loads(f.read()) self.storage_service_col = storage_service.StorageServiceCollection( diff --git a/rsd_lib/tests/unit/resources/v2_1/test_rsdlib_v2_1.py b/rsd_lib/tests/unit/resources/v2_1/test_rsdlib_v2_1.py index 2048387..3b6650e 100644 --- a/rsd_lib/tests/unit/resources/v2_1/test_rsdlib_v2_1.py +++ b/rsd_lib/tests/unit/resources/v2_1/test_rsdlib_v2_1.py @@ -28,7 +28,7 @@ class RSDLibV2_1TestCase(testtools.TestCase): def setUp(self): super(RSDLibV2_1TestCase, self).setUp() self.conn = mock.Mock() - with open('rsd_lib/tests/unit/json_samples/root.json', 'r') as f: + with open('rsd_lib/tests/unit/json_samples/v2_1/root.json', 'r') as f: self.conn.get.return_value.json.return_value = json.loads(f.read()) self.rsd = v2_1.RSDLibV2_1(self.conn) @@ -36,6 +36,12 @@ class RSDLibV2_1TestCase(testtools.TestCase): self.rsd._parse_attributes() self.assertEqual("2.1.0", self.rsd._rsd_api_version) self.assertEqual("1.0.2", self.rsd._redfish_version) + self.assertEqual("/redfish/v1/Systems", self.rsd._systems_path) + self.assertEqual("/redfish/v1/Nodes", self.rsd._nodes_path) + self.assertEqual("/redfish/v1/Chassis", self.rsd._chassis_path) + self.assertEqual("/redfish/v1/Services", + self.rsd._storage_service_path) + self.assertEqual("/redfish/v1/Fabrics", self.rsd._fabrics_path) @mock.patch.object(node, 'NodeCollection', autospec=True) def test_get_node_collection(self, mock_node_collection): diff --git a/rsd_lib/tests/unit/test_main.py b/rsd_lib/tests/unit/test_main.py index f52fe0a..97966db 100644 --- a/rsd_lib/tests/unit/test_main.py +++ b/rsd_lib/tests/unit/test_main.py @@ -30,7 +30,7 @@ class RSDLibTestCase(testtools.TestCase): super(RSDLibTestCase, self).setUp() self.conn = mock.Mock() mock_connector.return_value = self.conn - with open('rsd_lib/tests/unit/json_samples/root.json', 'r') as f: + with open('rsd_lib/tests/unit/json_samples/v2_1/root.json', 'r') as f: self.conn.get.return_value.json.return_value = json.loads(f.read()) self.rsd = main.RSDLib('http://foo.bar:8442', username='foo', password='bar', verify=True)