def test_untrusted_check_without_conffile_check(self): # ensure there is no conffile_prompt check apt.apt_pkg.config.set("DPkg::Options::", "--force-confold") # run it options = MockOptions() unattended_upgrade.DISTRO_DESC = "Ubuntu 10.04" unattended_upgrade.LOCK_FILE = "./u-u.lock" unattended_upgrade.main(options, rootdir=self.rootdir) # read the log to see what happend with open(self.log) as f: haystack = f.read() self.assertTrue( "pkg test-package is not from a trusted origin" in haystack) if unattended_upgrade.get_distro_codename() == "sid": self.assertFalse( "falling back to adjusting" in haystack) else: self.assertTrue( "falling back to adjusting" in haystack)
def test_macro(self): codename = get_distro_codename() s = "a=${distro_codename}" origin = self._get_mock_origin("Foo", archive=codename) self.assertTrue(match_whitelist_string(s, origin))