mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Update tests to reflect new API
This commit is contained in:
parent
9f93839d13
commit
031c75e53a
3 changed files with 32 additions and 33 deletions
|
@ -203,39 +203,6 @@ class TestUtils(unittest.TestCase):
|
|||
|
||||
assert res == 'hello world'
|
||||
|
||||
#####################################
|
||||
### Template function tests
|
||||
|
||||
def test_template_basic(self):
|
||||
template = 'hello {{ who }}'
|
||||
vars = {
|
||||
'who': 'world',
|
||||
}
|
||||
|
||||
res = ansible.utils.template(template, vars, {}, no_engine=False)
|
||||
|
||||
assert res == 'hello world'
|
||||
|
||||
def test_template_whitespace(self):
|
||||
template = 'hello {{ who }}\n'
|
||||
vars = {
|
||||
'who': 'world',
|
||||
}
|
||||
|
||||
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'
|
||||
|
||||
def test_template_varReplace_iterated(self):
|
||||
template = 'hello $who'
|
||||
vars = {
|
||||
|
@ -247,6 +214,36 @@ class TestUtils(unittest.TestCase):
|
|||
|
||||
assert res == u'hello oh great one'
|
||||
|
||||
#####################################
|
||||
### Template function tests
|
||||
|
||||
def test_template_basic(self):
|
||||
vars = {
|
||||
'who': 'world',
|
||||
}
|
||||
|
||||
res = ansible.utils.template_from_file("test", "template-basic", vars, {})
|
||||
|
||||
assert res == 'hello world'
|
||||
|
||||
def test_template_whitespace(self):
|
||||
vars = {
|
||||
'who': 'world',
|
||||
}
|
||||
|
||||
res = ansible.utils.template_from_file("test", "template-whitespace", vars, {})
|
||||
|
||||
assert res == 'hello world\n'
|
||||
|
||||
def test_template_unicode(self):
|
||||
vars = {
|
||||
'who': u'wórld',
|
||||
}
|
||||
|
||||
res = ansible.utils.template_from_file("test", "template-basic", vars, {})
|
||||
|
||||
assert res == u'hello wórld'
|
||||
|
||||
#####################################
|
||||
### key-value parsing
|
||||
|
||||
|
|
1
test/template-basic
Normal file
1
test/template-basic
Normal file
|
@ -0,0 +1 @@
|
|||
hello {{ who }}
|
1
test/template-whitespace
Normal file
1
test/template-whitespace
Normal file
|
@ -0,0 +1 @@
|
|||
hello {{ who }}
|
Loading…
Reference in a new issue