1
0

test_pillar.py 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. # -*- coding: utf-8 -*-
  2. # Import Python libs
  3. from __future__ import absolute_import, print_function, unicode_literals
  4. # Import Salt Testing Libs
  5. from tests.support.case import SSHCase
  6. from tests.support.unit import skipIf
  7. # Import Salt Libs
  8. import salt.utils.platform
  9. @skipIf(salt.utils.platform.is_windows(), 'salt-ssh not available on Windows')
  10. class SSHPillarTest(SSHCase):
  11. '''
  12. testing pillar with salt-ssh
  13. '''
  14. def test_pillar_items(self):
  15. '''
  16. test pillar.items with salt-ssh
  17. '''
  18. ret = self.run_function('pillar.items')
  19. self.assertDictContainsSubset({'monty': 'python'}, ret)
  20. self.assertDictContainsSubset(
  21. {'knights': ['Lancelot', 'Galahad', 'Bedevere', 'Robin']},
  22. ret)
  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. def test_pillar_get_doesnotexist(self):
  30. '''
  31. test pillar.get when pillar does not exist with salt-ssh
  32. '''
  33. ret = self.run_function('pillar.get', ['doesnotexist'])
  34. self.assertEqual(ret, '')