test_renderers.py 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. import pytest
  16. @pytest.mark.windows_whitelisted
  17. class TestJinjaRenderer(ModuleCase):
  18. '''
  19. Validate that ordering works correctly
  20. '''
  21. def test_dot_notation(self):
  22. '''
  23. Test the Jinja dot-notation syntax for calling execution modules
  24. '''
  25. ret = self.run_function('state.sls', ['jinja_dot_notation'])
  26. for state_ret in ret.values():
  27. self.assertTrue(state_ret['result'])
  28. @flaky
  29. @skipIf(salt.utils.platform.is_darwin() and six.PY2, 'This test hangs on OS X on Py2')
  30. def test_salt_contains_function(self):
  31. '''
  32. Test if we are able to check if a function exists inside the "salt"
  33. wrapper (AliasLoader) which is available on Jinja templates.
  34. '''
  35. ret = self.run_function('state.sls', ['jinja_salt_contains_function'])
  36. for state_ret in ret.values():
  37. self.assertTrue(state_ret['result'])