test_renderers.py 1.3 KB

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