test_renderers.py 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. # coding: utf-8
  2. '''
  3. Integration tests for renderer functions
  4. '''
  5. # Import Python Libs
  6. from __future__ import absolute_import, unicode_literals, print_function
  7. # Import Salt Testing libs
  8. from tests.support.case import ModuleCase
  9. from tests.support.helpers import flaky
  10. from tests.support.unit import skipIf
  11. # Import Salt libs
  12. import salt.utils.platform
  13. # Import 3rd-party libs
  14. from salt.ext import six
  15. class TestJinjaRenderer(ModuleCase):
  16. '''
  17. Validate that ordering works correctly
  18. '''
  19. def test_dot_notation(self):
  20. '''
  21. Test the Jinja dot-notation syntax for calling execution modules
  22. '''
  23. ret = self.run_function('state.sls', ['jinja_dot_notation'])
  24. for state_ret in ret.values():
  25. self.assertTrue(state_ret['result'])
  26. @flaky
  27. @skipIf(salt.utils.platform.is_darwin() and six.PY2, 'This test hangs on OS X on Py2')
  28. def test_salt_contains_function(self):
  29. '''
  30. Test if we are able to check if a function exists inside the "salt"
  31. wrapper (AliasLoader) which is available on Jinja templates.
  32. '''
  33. ret = self.run_function('state.sls', ['jinja_salt_contains_function'])
  34. for state_ret in ret.values():
  35. self.assertTrue(state_ret['result'])