summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJames Tanner <tanner.jc@gmail.com>2013-10-30 10:50:16 -0400
committerJames Tanner <tanner.jc@gmail.com>2013-10-30 10:50:16 -0400
commitd154bf87812209409a673fd7f9848d75701e2f32 (patch)
tree8caf46dff6559ef86b697284f13529d7986817fb /test
parente0fbaea5663350af329c818dc1b69f99ca44fefb (diff)
downloadansible-d154bf87812209409a673fd7f9848d75701e2f32.tar.gz
Revert templating enhancements from 73dbab70 e6c28658 d409352c 9858b1f2 4587528b 9b1fe455 214b0b05 8d3db803 7f9504d1 5031104c 35cb9dc2 2bd8cb57 1e85c754
Diffstat (limited to 'test')
-rw-r--r--test/TestUtils.py21
1 files changed, 9 insertions, 12 deletions
diff --git a/test/TestUtils.py b/test/TestUtils.py
index 7b74d4d59e..e6c6c4ac1f 100644
--- a/test/TestUtils.py
+++ b/test/TestUtils.py
@@ -9,7 +9,6 @@ from nose.plugins.skip import SkipTest
import ansible.utils
import ansible.utils.template as template2
-import ansible.constants as C
class TestUtils(unittest.TestCase):
@@ -17,10 +16,6 @@ class TestUtils(unittest.TestCase):
### varReplace function tests
def test_varReplace_var_complex_var(self):
-
- old_setting = C.DEFAULT_LEGACY_PLAYBOOK_VARIABLES
- C.DEFAULT_LEGACY_PLAYBOOK_VARIABLES = True
-
vars = {
'x': '$y',
'y': {
@@ -31,8 +26,6 @@ class TestUtils(unittest.TestCase):
res = template2.template(None, template, vars)
assert res == 'result'
- C.DEFAULT_LEGACY_PLAYBOOK_VARIABLES = old_setting
-
#####################################
### template_ds function tests
@@ -60,9 +53,6 @@ class TestUtils(unittest.TestCase):
],
}
- old_setting = C.DEFAULT_LEGACY_PLAYBOOK_VARIABLES
- C.DEFAULT_LEGACY_PLAYBOOK_VARIABLES = True
-
template = '${data.var}'
res = template2.template(None, template, vars)
assert sorted(res) == sorted(vars['data']['var'])
@@ -79,8 +69,6 @@ class TestUtils(unittest.TestCase):
res = template2.template(None, template, vars)
assert res == template
- C.DEFAULT_LEGACY_PLAYBOOK_VARIABLES = old_setting
-
#####################################
### Template function tests
@@ -93,6 +81,15 @@ class TestUtils(unittest.TestCase):
assert res == 'hello world'
+ def test_template_whitespace(self):
+ vars = {
+ 'who': 'world',
+ }
+
+ res = template2.template_from_file("test", "template-whitespace", vars)
+
+ assert res == 'hello world\n'
+
def test_template_unicode(self):
vars = {
'who': u'wórld',