test_renderers.py 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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.helpers import flaky, slowTest
  11. from tests.support.unit import skipIf
  12. @pytest.mark.windows_whitelisted
  13. class TestJinjaRenderer(ModuleCase):
  14. """
  15. Validate that ordering works correctly
  16. """
  17. @slowTest
  18. def test_dot_notation(self):
  19. """
  20. Test the Jinja dot-notation syntax for calling execution modules
  21. """
  22. ret = self.run_function("state.sls", ["jinja_dot_notation"])
  23. for state_ret in ret.values():
  24. self.assertTrue(state_ret["result"])
  25. @flaky
  26. @skipIf(
  27. salt.utils.platform.is_darwin() and six.PY2, "This test hangs on OS X on Py2"
  28. )
  29. @slowTest
  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"])