test for non-existance of tag changed to be more strict to the tags form i.e. check for tag_*_* form rather than tag_*

tag_none grouping is more like ec2 global groups. Thus, removed the children filter test.
This commit is contained in:
Chris Meyers 2015-01-16 14:01:56 -05:00
parent 6d10e31ea8
commit e822689ca1

View File

@ -1606,7 +1606,7 @@ class InventoryUpdatesTest(BaseTransactionTest):
self.assertFalse(name.startswith('type_'))
self.assertFalse(name.startswith('key_'))
self.assertFalse(name.startswith('security_group_'))
self.assertFalse(name.startswith('tag_'))
self.assertFalse(re.search(r'tag_.*?_', name))
self.assertFalse(name.startswith('ami-'))
self.assertFalse(name.startswith('vpc-'))
self.assertTrue('ec2' in child_names)
@ -1616,6 +1616,7 @@ class InventoryUpdatesTest(BaseTransactionTest):
self.assertTrue('security_groups' in child_names)
self.assertTrue('tags' in child_names)
self.assertTrue('images' in child_names)
self.assertTrue('tag_none' in child_names)
self.assertFalse('instances' in child_names)
# Make sure we clean up the cache path when finished (when one is not
# provided explicitly via source_vars).
@ -1645,7 +1646,7 @@ class InventoryUpdatesTest(BaseTransactionTest):
# Sync again with group_by set to include all possible groups.
cache_path2 = tempfile.mkdtemp(prefix='awx_ec2_')
self._temp_paths.append(cache_path2)
inventory_source.group_by = 'instance_id, region, availability_zone, ami_id, instance_type, key_pair, vpc_id, security_group, tag_keys'
inventory_source.group_by = 'instance_id, region, availability_zone, ami_id, instance_type, key_pair, vpc_id, security_group, tag_keys, tag_none'
inventory_source.source_vars = '---\n\ncache_path: %s\n' % cache_path2
inventory_source.overwrite = True
inventory_source.save()
@ -1654,6 +1655,7 @@ class InventoryUpdatesTest(BaseTransactionTest):
# Skip vpcs as selected inventory may or may not have any.
child_names = self.group.children.filter(active=True).values_list('name', flat=True)
self.assertTrue('ec2' in child_names)
self.assertTrue('tag_none' in child_names)
self.assertTrue('regions' in child_names)
self.assertTrue(self.group.children.get(name='regions').children.filter(active=True).count())
self.assertTrue('types' in child_names)