summaryrefslogtreecommitdiff
path: root/tests/unittests
diff options
context:
space:
mode:
authorJoshua Harlow <harlowja@yahoo-inc.com>2013-05-09 22:34:31 -0700
committerJoshua Harlow <harlowja@yahoo-inc.com>2013-05-09 22:34:31 -0700
commit2b351c5435939d16ba06ec0c45847d47f4b21d51 (patch)
tree15fb06e783875ff481fd3c148311eecde453bebb /tests/unittests
parentff232886555964220769da6d8b73198b5d51ef16 (diff)
downloadvyos-cloud-init-2b351c5435939d16ba06ec0c45847d47f4b21d51.tar.gz
vyos-cloud-init-2b351c5435939d16ba06ec0c45847d47f4b21d51.zip
Fix the cloud config merging so that it is backwards compat.
The new change for merging works well in the mergedict case but the default merging type for cloud config needs to reflect how yaml was loaded in bulk, which is the same as the replacing keys merging type that is now provided.
Diffstat (limited to 'tests/unittests')
-rw-r--r--tests/unittests/test_merging.py15
-rw-r--r--tests/unittests/test_userdata.py2
2 files changed, 16 insertions, 1 deletions
diff --git a/tests/unittests/test_merging.py b/tests/unittests/test_merging.py
index dddf8c6c..ba1c67d7 100644
--- a/tests/unittests/test_merging.py
+++ b/tests/unittests/test_merging.py
@@ -167,6 +167,21 @@ class TestSimpleRun(helpers.ResourceUsingTestCase):
d = util.mergemanydict([a, b])
self.assertEquals(c, d)
+ def test_compat_merges_dict(self):
+ a = {
+ 'Blah': 1,
+ 'Blah2': 2,
+ 'Blah3': 3,
+ }
+ b = {
+ 'Blah': 1,
+ 'Blah2': 2,
+ 'Blah3': [1],
+ }
+ c = _old_mergedict(a, b)
+ d = util.mergemanydict([a, b])
+ self.assertEquals(c, d)
+
def test_compat_merges_list(self):
a = {'b': [1, 2, 3]}
b = {'b': [4, 5]}
diff --git a/tests/unittests/test_userdata.py b/tests/unittests/test_userdata.py
index 5fb9acd9..0ebb0484 100644
--- a/tests/unittests/test_userdata.py
+++ b/tests/unittests/test_userdata.py
@@ -108,7 +108,7 @@ p: 1
contents = util.load_yaml(contents)
self.assertEquals(contents['run'], ['b', 'c', 'stuff', 'morestuff'])
self.assertEquals(contents['a'], 'be')
- self.assertEquals(contents['e'], 'fg')
+ self.assertEquals(contents['e'], [1, 2, 3])
self.assertEquals(contents['p'], 1)
def test_unhandled_type_warning(self):