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
This commit is contained in:
parent
2ee6d9a2d5
commit
61d491c73a
@ -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,
|
||||
|
@ -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(
|
||||
|
@ -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(
|
||||
|
@ -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(
|
||||
|
@ -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()))
|
||||
|
@ -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(
|
||||
|
@ -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):
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user