예제 #1
0
    def test_remove_group(self):
        inv = AwxInventory()

        inv.add_group('group1')
        inv.add_group('group2')

        inv.remove_group('group1')

        test_dict = {'group2': {}}

        self.assertDictEqual(inv.groups, test_dict)
예제 #2
0
    def test_remove_group_with_host_check_hosts_host_removed(self):
        inv = AwxInventory()

        inv.add_host('host1')
        inv.add_host('host2')
        inv.add_host('host3')

        inv.add_group('group1')
        inv.add_group('group2')

        inv.add_host_to_group('host1', 'group1')
        inv.add_host_to_group('host2', 'group2')
        inv.add_host_to_group('host3', 'group1')

        inv.remove_group('group1', delete_host=True)

        test_dict = {'host2': {}}

        self.assertDictEqual(inv.hosts, test_dict)