Exemplo n.º 1
0
    def test_add_host_vars_host_not_exist_raises_exception(self):
        from inventory import HostDoesNotExist

        inv = AwxInventory()

        test_host_vars = {
            'var1': 'val1',
            'var2': 'val2',
        }

        with self.assertRaises(HostDoesNotExist):
            inv.add_host_vars('host1', test_host_vars)
Exemplo n.º 2
0
    def test_add_host_vars(self):

        inv = AwxInventory()
        inv.add_host('host1')

        test_host_vars = {
            'var1': 'val1',
            'var2': 'val2',
        }

        inv.add_host_vars('host1', test_host_vars)

        test_dict = {'host1': test_host_vars}

        self.assertDictEqual(inv.hosts, test_dict)