From 450b373ff1bb47cac0da3916bc4db6d4352e2394 Mon Sep 17 00:00:00 2001 From: Michael Sambol Date: Thu, 28 May 2015 12:04:10 -0500 Subject: [PATCH] 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 --- translator/tests/test_utils.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/translator/tests/test_utils.py b/translator/tests/test_utils.py index b919ce4..eee8238 100644 --- a/translator/tests/test_utils.py +++ b/translator/tests/test_utils.py @@ -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':