1
0

test_pepa.py 857 B

1234567891011121314151617181920212223242526272829303132333435
  1. # -*- coding: utf-8 -*-
  2. # Import python libs
  3. from __future__ import absolute_import, print_function, unicode_literals
  4. # Import Salt Libs
  5. import salt.pillar.pepa as pepa
  6. # Import Salt Testing libs
  7. from tests.support.unit import TestCase
  8. try:
  9. from salt.utils.odict import OrderedDict
  10. except ImportError:
  11. from collections import OrderedDict
  12. class PepaPillarTestCase(TestCase):
  13. def test_repeated_keys(self):
  14. # fmt: off
  15. expected_result = {
  16. "foo": {
  17. "bar": {
  18. "foo": True,
  19. "baz": True,
  20. },
  21. },
  22. }
  23. data = OrderedDict([
  24. ('foo..bar..foo', True),
  25. ('foo..bar..baz', True),
  26. ])
  27. # fmt: on
  28. result = pepa.key_value_to_tree(data)
  29. self.assertDictEqual(result, expected_result)