-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #50750 from bewing/pepa12
Fix last key detection in pillar.pepa`key_value_to_tree`
- Loading branch information
Showing
2 changed files
with
31 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
# Import python libs | ||
from __future__ import absolute_import, print_function, unicode_literals | ||
from collections import OrderedDict | ||
|
||
# Import Salt Testing libs | ||
from tests.support.unit import TestCase | ||
|
||
# Import Salt Libs | ||
import salt.pillar.pepa as pepa | ||
|
||
|
||
class PepaPillarTestCase(TestCase): | ||
def test_repeated_keys(self): | ||
expected_result = { | ||
"foo": { | ||
"bar": { | ||
"foo": True, | ||
"baz": True, | ||
}, | ||
}, | ||
} | ||
data = OrderedDict([ | ||
('foo..bar..foo', True), | ||
('foo..bar..baz', True), | ||
]) | ||
result = pepa.key_value_to_tree(data) | ||
self.assertDictEqual(result, expected_result) |