test_saltcheck.py 1.2 KB

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