Add v2.3 support for get_resource method
Change-Id: I8745f401b3b3d17522d40a63f9dd51a9a720af82
This commit is contained in:
@@ -17,6 +17,7 @@ import json
|
||||
import mock
|
||||
import testtools
|
||||
|
||||
from rsd_lib.exceptions import NoMatchingResourceError
|
||||
from rsd_lib.resources.v2_1.chassis import chassis as v2_1_chassis
|
||||
from rsd_lib.resources.v2_1.event_service import event_service \
|
||||
as v2_1_event_service
|
||||
@@ -219,3 +220,32 @@ class RSDLibV2_3TestCase(testtools.TestCase):
|
||||
# mock_telemetry_service.assert_called_once_with(
|
||||
# self.rsd._conn, '/redfish/v1/TelemetryService',
|
||||
# redfish_version=self.rsd.redfish_version)
|
||||
|
||||
def test_get_resource(self):
|
||||
with mock.patch.object(
|
||||
self.rsd,
|
||||
"_get_resource_class_from_path",
|
||||
return_value=v2_3_storage_service.storage_pool.StoragePool,
|
||||
):
|
||||
with open(
|
||||
"rsd_lib/tests/unit/json_samples/v2_3/storage_pool.json",
|
||||
"r"
|
||||
) as f:
|
||||
self.conn.get.return_value.json.return_value = json.loads(
|
||||
f.read()
|
||||
)
|
||||
self.assertIsInstance(
|
||||
self.rsd.get_resource(
|
||||
"/redfish/v1/TelemetryService"),
|
||||
v2_3_storage_service.storage_pool.StoragePool
|
||||
)
|
||||
|
||||
def test_get_resource_with_no_class_match(self):
|
||||
with mock.patch.object(
|
||||
self.rsd, "_get_resource_class_from_path", return_value=None
|
||||
):
|
||||
self.assertRaises(
|
||||
NoMatchingResourceError,
|
||||
self.rsd.get_resource,
|
||||
"/redfish/v1/chassis/1",
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user