def test_sls_micking_file_merging(self): def convert(obj): return yamlex.deserialize(yamlex.serialize(obj)) # let say that we have 2 pillar files src1 = dedent( """ a: first b: !aggregate first c: subkey1: first subkey2: !aggregate first """ ).strip() src2 = dedent( """ a: second b: !aggregate second c: subkey2: !aggregate second subkey3: second """ ).strip() sls_obj1 = yamlex.deserialize(src1) sls_obj2 = yamlex.deserialize(src2) sls_obj3 = yamlex.merge_recursive(sls_obj1, sls_obj2) assert sls_obj3 == { "a": "second", "b": ["first", "second"], "c": {"subkey2": ["first", "second"], "subkey3": "second"}, }, sls_obj3
def test_sls_micking_file_merging(self): def convert(obj): return yamlex.deserialize(yamlex.serialize(obj)) # let say that we have 2 pillar files src1 = dedent(""" a: first b: !aggregate first c: subkey1: first subkey2: !aggregate first """).strip() src2 = dedent(""" a: second b: !aggregate second c: subkey2: !aggregate second subkey3: second """).strip() sls_obj1 = yamlex.deserialize(src1) sls_obj2 = yamlex.deserialize(src2) sls_obj3 = yamlex.merge_recursive(sls_obj1, sls_obj2) assert sls_obj3 == { 'a': 'second', 'b': ['first', 'second'], 'c': { 'subkey2': ['first', 'second'], 'subkey3': 'second' } }, sls_obj3
def test_sls_micking_file_merging(self): def convert(obj): return yamlex.deserialize(yamlex.serialize(obj)) # let say that we have 2 pillar files src1 = dedent(""" a: first b: !aggregate first c: subkey1: first subkey2: !aggregate first """).strip() src2 = dedent(""" a: second b: !aggregate second c: subkey2: !aggregate second subkey3: second """).strip() sls_obj1 = yamlex.deserialize(src1) sls_obj2 = yamlex.deserialize(src2) sls_obj3 = yamlex.merge_recursive(sls_obj1, sls_obj2) assert sls_obj3 == { 'a': 'second', 'b': ['first', 'second'], 'c': { 'subkey2': ['first', 'second'], 'subkey3': 'second' } }, sls_obj3