Added a unit test to cover diff_dicts in utils.py

The test verifies that diff_dicts returns correctly when a key is
missing in the first dictionary but is not missing in the second
dictionary.

Change-Id: I95d61cd7a890b767083a6eea7e1070c1458223bd
This commit is contained in:
Michael Sambol
2015-05-28 12:04:10 -05:00
parent e2143adbf8
commit 450b373ff1

View File

@@ -106,6 +106,16 @@ class CommonUtilsTest(TestCase):
self.cmpUtils.MISMATCH_VALUE2_LABEL: None}}},
self.cmpUtils.diff_dicts(expected, provided))
def test_compareutils_diff_dicts_missing_key_other_dict(self):
expected = {'server3': {'depends_on': ['server1', 'server2']}}
provided = {'server3': {'depends_on': ['server2', 'server1'],
'keyname': 'userkey'}}
self.assertEqual(
{'server3': {'keyname':
{self.cmpUtils.MISMATCH_VALUE1_LABEL: None,
self.cmpUtils.MISMATCH_VALUE2_LABEL: 'userkey'}}},
self.cmpUtils.diff_dicts(expected, provided))
def test_compareutils_diff_dicts_value_diff(self):
expected = \
{'output':