mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 08:58:59 +00:00
Revert "Move jinja templating tests alongside salt/utils/jinja.py's tests"
This reverts commit 6d9c2eb6b0
.
This commit is contained in:
parent
3057ca4b0b
commit
113d76e045
@ -1 +0,0 @@
|
|||||||
{% import '../../rescape' as xfail -%}
|
|
@ -1,2 +0,0 @@
|
|||||||
{% from './rmacro' import rmacro with context -%}
|
|
||||||
{{ rmacro('Hey') ~ rmacro(a|default('a'), b|default('b')) }}
|
|
@ -1,4 +0,0 @@
|
|||||||
{% from '../macro' import mymacro with context %}
|
|
||||||
{% macro rmacro(greeting, greetee='world') -%}
|
|
||||||
{{ mymacro(greeting, greetee) }}
|
|
||||||
{%- endmacro %}
|
|
@ -16,7 +16,6 @@ import tempfile
|
|||||||
# Import Salt Testing libs
|
# Import Salt Testing libs
|
||||||
from tests.support.unit import skipIf, TestCase
|
from tests.support.unit import skipIf, TestCase
|
||||||
from tests.support.case import ModuleCase
|
from tests.support.case import ModuleCase
|
||||||
from tests.support.helpers import flaky
|
|
||||||
from tests.support.mock import NO_MOCK, NO_MOCK_REASON, patch, MagicMock, Mock
|
from tests.support.mock import NO_MOCK, NO_MOCK_REASON, patch, MagicMock, Mock
|
||||||
from tests.support.paths import BASE_FILES, TMP, TMP_CONF_DIR
|
from tests.support.paths import BASE_FILES, TMP, TMP_CONF_DIR
|
||||||
|
|
||||||
@ -186,23 +185,6 @@ class TestSaltCacheLoader(TestCase):
|
|||||||
self.assertEqual(fc.requests[0]['path'], 'salt://hello_import')
|
self.assertEqual(fc.requests[0]['path'], 'salt://hello_import')
|
||||||
self.assertEqual(fc.requests[1]['path'], 'salt://macro')
|
self.assertEqual(fc.requests[1]['path'], 'salt://macro')
|
||||||
|
|
||||||
def test_relative_import(self):
|
|
||||||
'''
|
|
||||||
You can import using relative paths
|
|
||||||
issue-13889
|
|
||||||
'''
|
|
||||||
fc, jinja = self.get_test_saltenv()
|
|
||||||
tmpl = jinja.get_template('relative/rhello')
|
|
||||||
result = tmpl.render()
|
|
||||||
self.assertEqual(result, 'Hey world !a b !')
|
|
||||||
assert len(fc.requests) == 3
|
|
||||||
self.assertEqual(fc.requests[0]['path'], 'salt://relative/rhello')
|
|
||||||
self.assertEqual(fc.requests[1]['path'], 'salt://relative/rmacro')
|
|
||||||
self.assertEqual(fc.requests[2]['path'], 'salt://macro')
|
|
||||||
# This must fail when rendered: attempts to import from outside file root
|
|
||||||
template = jinja.get_template('relative/rescape')
|
|
||||||
self.assertRaises(exceptions.TemplateNotFound, template.render)
|
|
||||||
|
|
||||||
def test_include(self):
|
def test_include(self):
|
||||||
'''
|
'''
|
||||||
You can also include a template that imports and uses macros
|
You can also include a template that imports and uses macros
|
||||||
@ -765,7 +747,7 @@ class TestCustomExtensions(TestCase):
|
|||||||
'{{ document.foo }}').render(document="{foo: it works}")
|
'{{ document.foo }}').render(document="{foo: it works}")
|
||||||
self.assertEqual(rendered, "it works")
|
self.assertEqual(rendered, "it works")
|
||||||
|
|
||||||
with self.assertRaises((TypeError, exceptions.TemplateRuntimeError)):
|
with self.assertRaises(exceptions.TemplateRuntimeError):
|
||||||
env.from_string('{% set document = document|load_yaml %}'
|
env.from_string('{% set document = document|load_yaml %}'
|
||||||
'{{ document.foo }}').render(document={"foo": "it works"})
|
'{{ document.foo }}').render(document={"foo": "it works"})
|
||||||
|
|
||||||
@ -1102,7 +1084,6 @@ class TestCustomExtensions(TestCase):
|
|||||||
dict(opts=self.local_opts, saltenv='test', salt=self.local_salt))
|
dict(opts=self.local_opts, saltenv='test', salt=self.local_salt))
|
||||||
self.assertEqual(rendered, '16777216')
|
self.assertEqual(rendered, '16777216')
|
||||||
|
|
||||||
@flaky
|
|
||||||
def test_http_query(self):
|
def test_http_query(self):
|
||||||
'''
|
'''
|
||||||
Test the `http_query` Jinja filter.
|
Test the `http_query` Jinja filter.
|
||||||
|
Loading…
Reference in New Issue
Block a user