def test_get_config_dns_suffixes(self): """Tests if get_network_config_from_conf properly generates nameservers and dns settings from a specified configuration""" cf = ConfigFile("tests/data/vmware/cust-dhcp-2nic.cfg") config = Config(cf) network_config = get_network_config_from_conf(config, False) self.assertEqual(1, network_config.get('version')) config_types = network_config.get('config') name_servers = None dns_suffixes = None for type in config_types: if type.get('type') == 'nameserver': name_servers = type.get('address') dns_suffixes = type.get('search') break self.assertEqual([], name_servers, "dns") self.assertEqual(['eng.vmware.com'], dns_suffixes, "suffixes")
def test_get_config_nameservers(self): """Tests DNS and nameserver settings in a configuration.""" cf = ConfigFile("tests/data/vmware/cust-static-2nic.cfg") config = Config(cf) network_config = get_network_config_from_conf(config, False) self.assertEqual(1, network_config.get('version')) config_types = network_config.get('config') name_servers = None dns_suffixes = None for type in config_types: if type.get('type') == 'nameserver': name_servers = type.get('address') dns_suffixes = type.get('search') break self.assertEqual(['10.20.145.1', '10.20.145.2'], name_servers, "dns") self.assertEqual(['eng.vmware.com', 'proxy.vmware.com'], dns_suffixes, "suffixes")
def test_get_config_nameservers(self): """Tests DNS and nameserver settings in a configuration.""" cf = ConfigFile("tests/data/vmware/cust-static-2nic.cfg") config = Config(cf) network_config = get_network_config_from_conf(config, False) self.assertEqual(1, network_config.get("version")) config_types = network_config.get("config") name_servers = None dns_suffixes = None for type in config_types: if type.get("type") == "nameserver": name_servers = type.get("address") dns_suffixes = type.get("search") break self.assertEqual(["10.20.145.1", "10.20.145.2"], name_servers, "dns") self.assertEqual(["eng.vmware.com", "proxy.vmware.com"], dns_suffixes, "suffixes")