def test_mirror(self): model = SubiquityModel('test') mirror_val = model.mirror.mirror = 'http://my-mirror' config = model.render('ident') val = self.configVal(config, 'apt.primary') self.assertEqual(len(val), 1) val = val[0] self.assertEqual(val['uri'], mirror_val)
def test_proxy_notset(self): model = SubiquityModel('test') config = model.render('ident') self.assertConfigDoesNotHaveVal(config, 'proxy.http_proxy') self.assertConfigDoesNotHaveVal(config, 'proxy.https_proxy') self.assertConfigDoesNotHaveVal(config, 'apt.http_proxy') self.assertConfigDoesNotHaveVal(config, 'apt.https_proxy') confs = self.writtenFilesMatchingContaining( config, 'etc/systemd/system/snapd.service.d/*.conf', 'HTTP_PROXY=') self.assertTrue(len(confs) == 0)
def test_mirror(self): model = SubiquityModel('test') mirror_val = 'http://my-mirror' model.mirror.set_mirror(mirror_val) config = model.render('ident') from curtin.commands.apt_config import get_mirror from curtin.util import get_architecture self.assertEqual( get_mirror(config["apt"], "primary", get_architecture()), mirror_val)
def test_write_netplan(self): model = SubiquityModel('test') config = model.render('ident') netplan_content = None for fspec in config['write_files'].values(): if fspec['path'].startswith('etc/netplan'): if netplan_content is not None: self.fail("writing two files to netplan?") netplan_content = fspec['content'] self.assertIsNot(netplan_content, None) netplan = yaml.safe_load(netplan_content) self.assertConfigHasVal(netplan, 'network.version', 2)
def test_proxy_set(self): model = SubiquityModel('test') proxy_val = 'http://my-proxy' model.proxy.proxy = proxy_val config = model.render('ident') self.assertConfigHasVal(config, 'proxy.http_proxy', proxy_val) self.assertConfigHasVal(config, 'proxy.https_proxy', proxy_val) self.assertConfigHasVal(config, 'apt.http_proxy', proxy_val) self.assertConfigHasVal(config, 'apt.https_proxy', proxy_val) confs = self.writtenFilesMatchingContaining( config, 'etc/systemd/system/snapd.service.d/*.conf', 'HTTP_PROXY=' + proxy_val) self.assertTrue(len(confs) > 0)
def test_keyboard(self): model = SubiquityModel('test') config = model.render('ident') self.assertConfigWritesFile(config, 'etc/default/keyboard')
def test_has_sources(self): model = SubiquityModel('test') config = model.render('ident') self.assertIn('sources', config)
def test_storage_version(self): model = SubiquityModel('test') config = model.render('ident') self.assertConfigHasVal(config, 'storage.version', 1)
def test_network_version(self): model = SubiquityModel('test') config = model.render('ident') self.assertConfigHasVal(config, 'network.version', 2)