test_handle_error.py 884 B

123456789101112131415161718192021222324252627282930
  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 pytest
  8. # Import Salt Testing libs
  9. from tests.support.case import ModuleCase
  10. class HandleErrorTest(ModuleCase):
  11. """
  12. Validate that ordering works correctly
  13. """
  14. @pytest.mark.slow_test(seconds=5) # Test takes >1 and <=5 seconds
  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"] == {})