summaryrefslogtreecommitdiffstats
path: root/test/units/template
diff options
context:
space:
mode:
authorMartin Krizek <martin.krizek@gmail.com>2021-10-20 19:22:29 +0200
committerGitHub <noreply@github.com>2021-10-20 19:22:29 +0200
commit7621784b947adb497a24725259318506a102d1a4 (patch)
tree5194910123e52b4f36e90a0d5d8a00decab0a31d /test/units/template
parentDocs: fix link to 2.12 changelog (#76091) (diff)
downloadansible-7621784b947adb497a24725259318506a102d1a4.tar.xz
ansible-7621784b947adb497a24725259318506a102d1a4.zip
Require Jinja2 3.0.0 (#75881)
* Require Jinja2 3.0.0 ci_complete * Fix sanity * Remove Jinja min/max tests * ansible-test changes * ci_complete * More cleanup ci_complete * Revert _count_newlines_from_end :( and other stuff * Fix sanity * It's using host_vars ... * Unused import * Remove overridden groupby filter * environmentfilter -> pass_environment * Explain preserve_trailing_newlines * Add changelog * ci_complete * Deprecated ANSIBLE_JINJA2_NATIVE_WARNING * native_helpers.py cleanup * More cleanup in the find intgration test
Diffstat (limited to 'test/units/template')
-rw-r--r--test/units/template/test_vars.py50
1 files changed, 5 insertions, 45 deletions
diff --git a/test/units/template/test_vars.py b/test/units/template/test_vars.py
index 74e6783925..dbfba2ea28 100644
--- a/test/units/template/test_vars.py
+++ b/test/units/template/test_vars.py
@@ -29,53 +29,13 @@ class TestVars(unittest.TestCase):
def setUp(self):
self.mock_templar = MagicMock(name='mock_templar')
- def test(self):
- ajvars = AnsibleJ2Vars(None, None)
- print(ajvars)
-
- def test_globals_empty_2_8(self):
- ajvars = AnsibleJ2Vars(self.mock_templar, {})
- res28 = self._dict_jinja28(ajvars)
- self.assertIsInstance(res28, dict)
-
- def test_globals_empty_2_9(self):
+ def test_globals_empty(self):
ajvars = AnsibleJ2Vars(self.mock_templar, {})
- res29 = self._dict_jinja29(ajvars)
- self.assertIsInstance(res29, dict)
+ res = dict(ajvars)
+ self.assertIsInstance(res, dict)
- def _assert_globals(self, res):
+ def test_globals(self):
+ res = dict(AnsibleJ2Vars(self.mock_templar, {'foo': 'bar', 'blip': [1, 2, 3]}))
self.assertIsInstance(res, dict)
self.assertIn('foo', res)
self.assertEqual(res['foo'], 'bar')
-
- def test_globals_2_8(self):
- ajvars = AnsibleJ2Vars(self.mock_templar, {'foo': 'bar', 'blip': [1, 2, 3]})
- res28 = self._dict_jinja28(ajvars)
- self._assert_globals(res28)
-
- def test_globals_2_9(self):
- ajvars = AnsibleJ2Vars(self.mock_templar, {'foo': 'bar', 'blip': [1, 2, 3]})
- res29 = self._dict_jinja29(ajvars)
- self._assert_globals(res29)
-
- def _dicts(self, ajvars):
- print(ajvars)
- res28 = self._dict_jinja28(ajvars)
- res29 = self._dict_jinja29(ajvars)
- # res28_other = self._dict_jinja28(ajvars, {'other_key': 'other_value'})
- # other = {'other_key': 'other_value'}
- # res29_other = self._dict_jinja29(ajvars, *other)
- print('res28: %s' % res28)
- print('res29: %s' % res29)
- # print('res28_other: %s' % res28_other)
- # print('res29_other: %s' % res29_other)
- # return (res28, res29, res28_other, res29_other)
- # assert ajvars == res28
- # assert ajvars == res29
- return (res28, res29)
-
- def _dict_jinja28(self, *args, **kwargs):
- return dict(*args, **kwargs)
-
- def _dict_jinja29(self, the_vars):
- return dict(the_vars)