Fix hostname expansion bug in inventory parser

This commit is contained in:
Junegunn Choi
2012-12-16 01:49:12 +09:00
parent 23f2a7fc7e
commit 7fbb7e079a
3 changed files with 32 additions and 20 deletions

View File

@@ -150,6 +150,17 @@ class TestInventory(unittest.TestCase):
print expected
assert vars == expected
def test_complex_group_names(self):
inventory = self.complex_inventory()
tests = {
'host1': [ 'role1' ],
'host2': [ 'role1', 'role2' ],
'host3': [ 'role2' ]
}
for host, roles in tests.iteritems():
group_names = inventory.get_variables(host)['group_names']
assert sorted(group_names) == sorted(roles)
def test_complex_exclude(self):
inventory = self.complex_inventory()
hosts = inventory.list_hosts("nc:florida:!triangle:!orlando")