|
|
|
@ -19,8 +19,6 @@
|
|
|
|
|
from __future__ import (absolute_import, division, print_function)
|
|
|
|
|
__metaclass__ = type
|
|
|
|
|
|
|
|
|
|
from jinja2.exceptions import UndefinedError
|
|
|
|
|
|
|
|
|
|
from ansible.compat.tests import unittest
|
|
|
|
|
from ansible.compat.tests.mock import patch, MagicMock
|
|
|
|
|
|
|
|
|
@ -75,8 +73,8 @@ class TestTemplar(unittest.TestCase):
|
|
|
|
|
#self.assertEqual(templar.template("{{lookup('file', '/path/to/my_file.txt')}}"), "foo")
|
|
|
|
|
|
|
|
|
|
# force errors
|
|
|
|
|
self.assertRaises(UndefinedError, templar.template, "{{bad_var}}")
|
|
|
|
|
self.assertRaises(UndefinedError, templar.template, "{{lookup('file', bad_var)}}")
|
|
|
|
|
self.assertRaises(AnsibloeUndefinedVariable, templar.template, "{{bad_var}}")
|
|
|
|
|
self.assertRaises(AnsibleUndefinedVariable, templar.template, "{{lookup('file', bad_var)}}")
|
|
|
|
|
self.assertRaises(AnsibleError, templar.template, "{{lookup('bad_lookup')}}")
|
|
|
|
|
self.assertRaises(AnsibleError, templar.template, "{{recursive}}")
|
|
|
|
|
self.assertRaises(AnsibleUndefinedVariable, templar.template, "{{foo-bar}}")
|
|
|
|
|