test_salt.py 892 B

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