mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-05-07 17:51:29 -07:00
parent
02c9f70898
commit
50d7483632
3 changed files with 42 additions and 0 deletions
28
test/units/template/test_native_concat.py
Normal file
28
test/units/template/test_native_concat.py
Normal file
|
@ -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 }}")
|
Loading…
Add table
Add a link
Reference in a new issue