summaryrefslogtreecommitdiff
path: root/test/TestUtils.py
diff options
context:
space:
mode:
authorJeroen Hoekx <jeroen.hoekx@hamok.be>2012-05-10 10:11:14 +0200
committerJeroen Hoekx <jeroen.hoekx@hamok.be>2012-05-10 10:11:14 +0200
commit74e21e61548267ded43769c9471b57010af285ae (patch)
tree1e302f200d78ee68f614eff70c6247485733b010 /test/TestUtils.py
parent262b35e7d34647d6269877c8bedabefb03bfdab7 (diff)
downloadansible-74e21e61548267ded43769c9471b57010af285ae.tar.gz
Fixup unicode varReplace templating.
The original patches should have conflicted? 53bde0bf517d1302c80f80180f85995efa36a00e vs efde61e53729964f3e740dcbb9c52f889186719d
Diffstat (limited to 'test/TestUtils.py')
-rw-r--r--test/TestUtils.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/TestUtils.py b/test/TestUtils.py
index 42953b854a..7f924da9b0 100644
--- a/test/TestUtils.py
+++ b/test/TestUtils.py
@@ -1,3 +1,5 @@
+# -*- coding: utf-8 -*-
+
import os
import unittest
@@ -131,6 +133,16 @@ class TestUtils(unittest.TestCase):
assert res == 'hello 2'
+ def test_varReplace_unicode(self):
+ template = 'hello $who'
+ vars = {
+ 'who': u'wórld',
+ }
+
+ res = ansible.utils.varReplace(template, vars)
+
+ assert res == u'hello wórld'
+
#####################################
### Template function tests
@@ -153,3 +165,13 @@ class TestUtils(unittest.TestCase):
res = ansible.utils.template(template, vars, {}, no_engine=False)
assert res == 'hello world\n'
+
+ def test_template_unicode(self):
+ template = 'hello {{ who }}'
+ vars = {
+ 'who': u'wórld',
+ }
+
+ res = ansible.utils.template(template, vars, {}, no_engine=False)
+
+ assert res == u'hello wórld'