def test_compat_release(self): debian = DebianDistroInfo() self.build_tree_contents([ ("debian/", ), ( "debian/lintian-brush.conf", """\ compat-release = testing """, ), ]) cfg = Config("debian/lintian-brush.conf") self.assertEqual(debian.testing(), cfg.compat_release())
class DebianDistroInfoTestCase(unittest.TestCase): """TestCase object for distro_info.DebianDistroInfo""" #pylint: disable=C0103 def setUp(self): self._distro_info = DebianDistroInfo() self._date = datetime.date(2011, 1, 10) #pylint: enable=C0103 def test_all(self): """Test: List all known Debian distributions.""" all_distros = set(["buzz", "rex", "bo", "hamm", "slink", "potato", "woody", "sarge", "etch", "lenny", "squeeze", "sid", "experimental"]) self.assertEqual(all_distros - set(self._distro_info.all), set()) def test_devel(self): """Test: Get latest development Debian distribution.""" self.assertEqual(self._distro_info.devel(self._date), "sid") def test_old(self): """Test: Get old (stable) Debian distribution.""" self.assertEqual(self._distro_info.old(self._date), "etch") def test_stable(self): """Test: Get latest stable Debian distribution.""" self.assertEqual(self._distro_info.stable(self._date), "lenny") def test_supported(self): """Test: List all supported Debian distribution.""" self.assertEqual(self._distro_info.supported(self._date), ["lenny", "squeeze", "sid", "experimental"]) def test_testing(self): """Test: Get latest testing Debian distribution.""" self.assertEqual(self._distro_info.testing(self._date), "squeeze") def test_valid(self): """Test: Check for valid Debian distribution.""" self.assertTrue(self._distro_info.valid("sid")) self.assertTrue(self._distro_info.valid("stable")) self.assertFalse(self._distro_info.valid("foobar")) def test_unsupported(self): """Test: List all unsupported Debian distribution.""" unsupported = ["buzz", "rex", "bo", "hamm", "slink", "potato", "woody", "sarge", "etch"] self.assertEqual(self._distro_info.unsupported(self._date), unsupported) def test_codename(self): """Test: Codename decoding""" self.assertIsNone(self._distro_info.codename('foobar')) self.assertEqual(self._distro_info.codename('testing', self._date), self._distro_info.testing(self._date)) def test_codename_result(self): """Test: Check result set to codename.""" self.assertEqual(self._distro_info.old(self._date, "codename"), "etch") self.assertEqual(self._distro_info.devel(self._date, result="codename"), "sid") def test_fullname(self): """Test: Check result set to fullname.""" self.assertEqual(self._distro_info.stable(self._date, "fullname"), 'Debian 5.0 "Lenny"') result = self._distro_info.testing(self._date, result="fullname") self.assertEqual(result, 'Debian 6.0 "Squeeze"') def test_release(self): """Test: Check result set to release.""" self.assertEqual(self._distro_info.devel(self._date, "release"), "") self.assertEqual(self._distro_info.testing(self._date, "release"), "6.0") self.assertEqual(self._distro_info.stable(self._date, result="release"), "5.0")