test_saltcheck.py 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  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 SSHSaltcheckTest(SSHCase):
  11. '''
  12. testing saltcheck with salt-ssh
  13. '''
  14. def test_saltcheck_run_test(self):
  15. '''
  16. test saltcheck.run_test with salt-ssh
  17. '''
  18. saltcheck_test = {"module_and_function": "test.echo",
  19. "assertion": "assertEqual",
  20. "expected-return": "Test Works",
  21. "args": ["Test Works"]}
  22. ret = self.run_function('saltcheck.run_test', test=saltcheck_test)
  23. self.assertDictContainsSubset({'status': 'Pass'}, ret)
  24. def test_saltcheck_state(self):
  25. '''
  26. saltcheck.run_state_tests
  27. '''
  28. saltcheck_test = 'validate-saltcheck'
  29. ret = self.run_function('saltcheck.run_state_tests', [saltcheck_test])
  30. self.assertDictContainsSubset({'status': 'Pass'}, ret[0]['validate-saltcheck']['echo_test_hello'])