Use built-in logic to compare dictionaries
... to get rid of the thin utility method. Change-Id: I1b8d0f3f8df1c6bdae6973fa2e4905c76c545407
This commit is contained in:
parent
a6a89a6d4c
commit
7b2056456f
@ -137,14 +137,6 @@ class BaseTestCase(base.BaseTestCase):
|
||||
except (TypeError, AttributeError):
|
||||
self.fail("%s doesn't have length" % type(obj))
|
||||
|
||||
def assertDictContains(self, parent, child):
|
||||
"""Checks whether child dict is a subset of parent.
|
||||
|
||||
assertDictContainsSubset() in standard Python 2.7 has been deprecated
|
||||
since Python 3.2
|
||||
"""
|
||||
self.assertEqual(parent, dict(parent, **child))
|
||||
|
||||
@staticmethod
|
||||
def path_get(project_file=None):
|
||||
root = os.path.abspath(os.path.join(os.path.dirname(__file__),
|
||||
|
@ -50,7 +50,3 @@ class TestEvaluatorBase(base.BaseTestCase):
|
||||
def _assert_all_alarms(self, state):
|
||||
for alarm in self.alarms:
|
||||
self.assertEqual(state, alarm.state)
|
||||
|
||||
def assertDictContains(self, parent, child):
|
||||
"""Checks whether child dict is a subset of parent."""
|
||||
self.assertEqual(parent, dict(parent, **child))
|
||||
|
@ -156,8 +156,9 @@ class TestAlarmEvaluationService(tests_base.BaseTestCase):
|
||||
time.sleep(1)
|
||||
|
||||
child = {'enabled': True, 'type': {'ne': 'event'}}
|
||||
self.assertDictContains(svc.storage_conn.get_alarms.call_args[1],
|
||||
child)
|
||||
self.assertLessEqual(
|
||||
child.items(),
|
||||
svc.storage_conn.get_alarms.call_args[1].items())
|
||||
|
||||
def test_evaluation_cycle_no_coordination(self):
|
||||
alarm = mock.Mock(type='gnocchi_aggregation_by_metrics_threshold',
|
||||
|
Loading…
x
Reference in New Issue
Block a user