summaryrefslogtreecommitdiffstats
path: root/test/units/template/test_native_concat.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-14 20:03:01 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-14 20:03:01 +0000
commita453ac31f3428614cceb99027f8efbdb9258a40b (patch)
treef61f87408f32a8511cbd91799f9cececb53e0374 /test/units/template/test_native_concat.py
parentInitial commit. (diff)
downloadansible-upstream.tar.xz
ansible-upstream.zip
Adding upstream version 2.10.7+merged+base+2.10.8+dfsg.upstream/2.10.7+merged+base+2.10.8+dfsgupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test/units/template/test_native_concat.py')
-rw-r--r--test/units/template/test_native_concat.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/units/template/test_native_concat.py b/test/units/template/test_native_concat.py
new file mode 100644
index 00000000..db85a73b
--- /dev/null
+++ b/test/units/template/test_native_concat.py
@@ -0,0 +1,28 @@
+# Copyright: (c) 2019, Ansible Project
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
+
+# Make coding more python3-ish
+from __future__ import (absolute_import, division, print_function)
+__metaclass__ = type
+
+import pytest
+
+from ansible import constants as C
+from ansible.errors import AnsibleUndefinedVariable
+
+# need to mock DEFAULT_JINJA2_NATIVE here so native modules are imported
+# correctly within the template module
+C.DEFAULT_JINJA2_NATIVE = True
+from ansible.template import Templar
+
+from units.mock.loader import DictDataLoader
+
+
+# https://github.com/ansible/ansible/issues/52158
+def test_undefined_variable():
+ fake_loader = DictDataLoader({})
+ variables = {}
+ templar = Templar(loader=fake_loader, variables=variables)
+
+ with pytest.raises(AnsibleUndefinedVariable):
+ templar.template("{{ missing }}")