test_handle_error.py 855 B

1234567891011121314151617181920212223242526272829
  1. # -*- coding: utf-8 -*-
  2. """
  3. tests for host state
  4. """
  5. # Import Python libs
  6. from __future__ import absolute_import, print_function, unicode_literals
  7. # Import Salt Testing libs
  8. from tests.support.case import ModuleCase
  9. from tests.support.helpers import slowTest
  10. class HandleErrorTest(ModuleCase):
  11. """
  12. Validate that ordering works correctly
  13. """
  14. @slowTest
  15. def test_function_do_not_return_dictionary_type(self):
  16. """
  17. Handling a case when function returns anything but a dictionary type
  18. """
  19. ret = self.run_function("state.sls", ["issue-9983-handleerror"])
  20. self.assertTrue(
  21. "Data must be a dictionary type" in ret[[a for a in ret][0]]["comment"]
  22. )
  23. self.assertTrue(not ret[[a for a in ret][0]]["result"])
  24. self.assertTrue(ret[[a for a in ret][0]]["changes"] == {})