1
0

test_salt.py 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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. @pytest.mark.windows_whitelisted
  10. class SaltRunnerTest(ShellCase):
  11. """
  12. Test the salt runner
  13. """
  14. @pytest.mark.slow_test(seconds=5) # Test takes >1 and <=5 seconds
  15. def test_salt_cmd(self):
  16. """
  17. test return values of salt.cmd
  18. """
  19. ret = self.run_run_plus("salt.cmd", "test.ping")
  20. out_ret = ret.get("out")[0]
  21. return_ret = ret.get("return")
  22. self.assertEqual(out_ret, "True")
  23. self.assertTrue(return_ret)
  24. @pytest.mark.slow_test(seconds=5) # Test takes >1 and <=5 seconds
  25. def test_salt_cmd_invalid(self):
  26. """
  27. test return values of salt.cmd invalid parameters
  28. """
  29. ret = self.run_run_plus("salt.cmd")
  30. expected = "Passed invalid arguments:"
  31. self.assertIn(expected, ret["return"])