1
0

test_salt.py 958 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. # -*- coding: utf-8 -*-
  2. """
  3. Tests for the salt runner
  4. .. versionadded:: 2016.11.0
  5. """
  6. from __future__ import absolute_import, print_function, unicode_literals
  7. import pytest
  8. from tests.support.case import ShellCase
  9. from tests.support.helpers import slowTest
  10. @pytest.mark.windows_whitelisted
  11. class SaltRunnerTest(ShellCase):
  12. """
  13. Test the salt runner
  14. """
  15. @slowTest
  16. def test_salt_cmd(self):
  17. """
  18. test return values of salt.cmd
  19. """
  20. ret = self.run_run_plus("salt.cmd", "test.ping")
  21. out_ret = ret.get("out")[0]
  22. return_ret = ret.get("return")
  23. self.assertEqual(out_ret, "True")
  24. self.assertTrue(return_ret)
  25. @slowTest
  26. def test_salt_cmd_invalid(self):
  27. """
  28. test return values of salt.cmd invalid parameters
  29. """
  30. ret = self.run_run_plus("salt.cmd")
  31. expected = "Passed invalid arguments:"
  32. self.assertIn(expected, ret["return"])