diff options
author | James Cammarata <jimi@sngx.net> | 2016-06-06 09:26:07 +0200 |
---|---|---|
committer | James Cammarata <jimi@sngx.net> | 2016-06-06 17:52:39 +0200 |
commit | 61f132a6092951a86fab483ac24854814b78df40 (patch) | |
tree | 79977dadc9eb198c37f17f021f07f20f45b4ae58 /test/units/vars/test_variable_manager.py | |
parent | much more fine grained error messages (diff) | |
download | ansible-61f132a6092951a86fab483ac24854814b78df40.tar.xz ansible-61f132a6092951a86fab483ac24854814b78df40.zip |
Adding unit tests for playbook group/host vars
Diffstat (limited to 'test/units/vars/test_variable_manager.py')
-rw-r--r-- | test/units/vars/test_variable_manager.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/units/vars/test_variable_manager.py b/test/units/vars/test_variable_manager.py index c808262222..86890eed7f 100644 --- a/test/units/vars/test_variable_manager.py +++ b/test/units/vars/test_variable_manager.py @@ -274,16 +274,26 @@ class TestVariableManager(unittest.TestCase): fake_loader.push("/etc/ansible/host_vars/host1", """ host_var: host_var_from_host_vars_host1 """) + fake_loader.push("group_vars/group1", """ + playbook_group_var: playbook_group_var + """) + fake_loader.push("host_vars/host1", """ + playbook_host_var: playbook_host_var + """) v.add_group_vars_file("/etc/ansible/group_vars/all", loader=fake_loader) v.add_group_vars_file("/etc/ansible/group_vars/group1", loader=fake_loader) v.add_group_vars_file("/etc/ansible/group_vars/group2", loader=fake_loader) + v.add_group_vars_file("group_vars/group1", loader=fake_loader) v.add_host_vars_file("/etc/ansible/host_vars/host1", loader=fake_loader) + v.add_host_vars_file("host_vars/host1", loader=fake_loader) res = v.get_vars(loader=fake_loader, play=play1, host=h1) self.assertEqual(res['group_var'], 'group_var_from_group_vars_group1') self.assertEqual(res['group_var_all'], 'group_var_all_from_group_vars_all') + self.assertEqual(res['playbook_group_var'], 'playbook_group_var') self.assertEqual(res['host_var'], 'host_var_from_host_vars_host1') + self.assertEqual(res['playbook_host_var'], 'playbook_host_var') # add in the fact cache v._fact_cache['host1'] = dict(fact_cache_var="fact_cache_var_from_fact_cache") |