test_handle_error.py 775 B

123456789101112131415161718192021222324
  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. class HandleErrorTest(ModuleCase):
  10. '''
  11. Validate that ordering works correctly
  12. '''
  13. def test_function_do_not_return_dictionary_type(self):
  14. '''
  15. Handling a case when function returns anything but a dictionary type
  16. '''
  17. ret = self.run_function('state.sls', ['issue-9983-handleerror'])
  18. self.assertTrue('Data must be a dictionary type' in ret[[a for a in ret][0]]['comment'])
  19. self.assertTrue(not ret[[a for a in ret][0]]['result'])
  20. self.assertTrue(ret[[a for a in ret][0]]['changes'] == {})