test_pillar.py 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. # -*- coding: utf-8 -*-
  2. from __future__ import absolute_import, print_function, unicode_literals
  3. import salt.utils.platform
  4. from tests.support.case import SSHCase
  5. from tests.support.helpers import slowTest
  6. from tests.support.unit import skipIf
  7. @skipIf(salt.utils.platform.is_windows(), "salt-ssh not available on Windows")
  8. class SSHPillarTest(SSHCase):
  9. """
  10. testing pillar with salt-ssh
  11. """
  12. @slowTest
  13. def test_pillar_items(self):
  14. """
  15. test pillar.items with salt-ssh
  16. """
  17. ret = self.run_function("pillar.items")
  18. self.assertDictContainsSubset({"monty": "python"}, ret)
  19. self.assertDictContainsSubset(
  20. {"knights": ["Lancelot", "Galahad", "Bedevere", "Robin"]}, ret
  21. )
  22. @slowTest
  23. def test_pillar_get(self):
  24. """
  25. test pillar.get with salt-ssh
  26. """
  27. ret = self.run_function("pillar.get", ["monty"])
  28. self.assertEqual(ret, "python")
  29. @slowTest
  30. def test_pillar_get_doesnotexist(self):
  31. """
  32. test pillar.get when pillar does not exist with salt-ssh
  33. """
  34. ret = self.run_function("pillar.get", ["doesnotexist"])
  35. self.assertEqual(ret, "")