Rename metric_definitions file to metric_definition
Follow the convention to rename "metric_definitions" file to "metric_definition" as the same as others. Change-Id: Ia438419b4dd735c65161043af74f094d11255a2b
This commit is contained in:
@@ -88,7 +88,7 @@ class MetricDefinition(base.ResourceBase):
|
||||
"""The wildcards of the sensor"""
|
||||
|
||||
|
||||
class MetricDefinitionsCollection(base.ResourceCollectionBase):
|
||||
class MetricDefinitionCollection(base.ResourceCollectionBase):
|
||||
|
||||
@property
|
||||
def _resource_type(self):
|
||||
@@ -16,7 +16,7 @@
|
||||
from sushy.resources import base
|
||||
from sushy import utils
|
||||
|
||||
from rsd_lib.resources.v2_2.telemetry import metric_definitions
|
||||
from rsd_lib.resources.v2_2.telemetry import metric_definition
|
||||
from rsd_lib.resources.v2_2.telemetry import metric_report_definition
|
||||
from rsd_lib import utils as rsd_lib_utils
|
||||
|
||||
@@ -59,7 +59,7 @@ class Telemetry(base.ResourceBase):
|
||||
It is calculated once the first time it is queried. On refresh,
|
||||
this property is reset.
|
||||
"""
|
||||
return metric_definitions.MetricDefinitionsCollection(
|
||||
return metric_definition.MetricDefinitionCollection(
|
||||
self._conn, self._get_metric_definitions_path(),
|
||||
redfish_version=self.redfish_version)
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ import json
|
||||
import mock
|
||||
import testtools
|
||||
|
||||
from rsd_lib.resources.v2_2.telemetry import metric_definitions
|
||||
from rsd_lib.resources.v2_2.telemetry import metric_definition
|
||||
|
||||
|
||||
class MetricDefinitionTestCase(testtools.TestCase):
|
||||
@@ -29,7 +29,7 @@ class MetricDefinitionTestCase(testtools.TestCase):
|
||||
'metric_definition.json', 'r') as f:
|
||||
self.conn.get.return_value.json.return_value = json.loads(f.read())
|
||||
|
||||
self.metric_definition_inst = metric_definitions.MetricDefinition(
|
||||
self.metric_definition_inst = metric_definition.MetricDefinition(
|
||||
self.conn,
|
||||
'/redfish/v1/TelemetryService/MetricDefinitions/1-md-6',
|
||||
redfish_version='1.1.0')
|
||||
@@ -186,7 +186,7 @@ class MetricDefinitionsCollectionTestCase(testtools.TestCase):
|
||||
with open('rsd_lib/tests/unit/json_samples/v2_2/'
|
||||
'metric_definitions.json', 'r') as f:
|
||||
self.conn.get.return_value.json.return_value = json.loads(f.read())
|
||||
self.metric_def_col = metric_definitions.MetricDefinitionsCollection(
|
||||
self.metric_def_col = metric_definition.MetricDefinitionCollection(
|
||||
self.conn, '/redfish/v1/TelemetryService/MetricDefinitions',
|
||||
redfish_version='1.1.0')
|
||||
|
||||
@@ -199,7 +199,7 @@ class MetricDefinitionsCollectionTestCase(testtools.TestCase):
|
||||
'/redfish/v1/TelemetryService/MetricDefinitions/CPUBandwidth'),
|
||||
self.metric_def_col.members_identities)
|
||||
|
||||
@mock.patch.object(metric_definitions, 'MetricDefinition', autospec=True)
|
||||
@mock.patch.object(metric_definition, 'MetricDefinition', autospec=True)
|
||||
def test_get_member(self, mock_metric_definition):
|
||||
self.metric_def_col.get_member(
|
||||
'/redfish/v1/TelemetryService/MetricDefinitions/CPUTemperature')
|
||||
@@ -208,7 +208,7 @@ class MetricDefinitionsCollectionTestCase(testtools.TestCase):
|
||||
'/redfish/v1/TelemetryService/MetricDefinitions/CPUTemperature',
|
||||
redfish_version=self.metric_def_col.redfish_version)
|
||||
|
||||
@mock.patch.object(metric_definitions, 'MetricDefinition', autospec=True)
|
||||
@mock.patch.object(metric_definition, 'MetricDefinition', autospec=True)
|
||||
def test_get_members(self, mock_metric_definition):
|
||||
members = self.metric_def_col.get_members()
|
||||
|
||||
@@ -19,7 +19,7 @@ import testtools
|
||||
|
||||
from sushy import exceptions
|
||||
|
||||
from rsd_lib.resources.v2_2.telemetry import metric_definitions
|
||||
from rsd_lib.resources.v2_2.telemetry import metric_definition
|
||||
from rsd_lib.resources.v2_2.telemetry import metric_report_definition
|
||||
from rsd_lib.resources.v2_2.telemetry import telemetry
|
||||
|
||||
@@ -68,7 +68,7 @@ class TelemetryTestCase(testtools.TestCase):
|
||||
actual_metric_definitions = self.telemetry_inst.metric_definitions
|
||||
# | THEN |
|
||||
self.assertIsInstance(actual_metric_definitions,
|
||||
metric_definitions.MetricDefinitionsCollection)
|
||||
metric_definition.MetricDefinitionCollection)
|
||||
self.conn.get.return_value.json.assert_called_once_with()
|
||||
|
||||
# reset mock
|
||||
@@ -86,7 +86,7 @@ class TelemetryTestCase(testtools.TestCase):
|
||||
self.conn.get.return_value.json.return_value = json.loads(f.read())
|
||||
# | WHEN & THEN |
|
||||
self.assertIsInstance(self.telemetry_inst.metric_definitions,
|
||||
metric_definitions.MetricDefinitionsCollection)
|
||||
metric_definition.MetricDefinitionCollection)
|
||||
|
||||
# On refreshing the telemetry service instance...
|
||||
with open('rsd_lib/tests/unit/json_samples/v2_2/'
|
||||
@@ -102,7 +102,7 @@ class TelemetryTestCase(testtools.TestCase):
|
||||
self.conn.get.return_value.json.return_value = json.loads(f.read())
|
||||
# | WHEN & THEN |
|
||||
self.assertIsInstance(self.telemetry_inst.metric_definitions,
|
||||
metric_definitions.MetricDefinitionsCollection)
|
||||
metric_definition.MetricDefinitionCollection)
|
||||
|
||||
def test__get_metric_report_definitions_path_path(self):
|
||||
self.assertEqual(
|
||||
|
||||
Reference in New Issue
Block a user