diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/data/sources.list.testDistribution | 13 | ||||
| -rw-r--r-- | tests/test_aptsources.py | 40 |
2 files changed, 39 insertions, 14 deletions
diff --git a/tests/data/sources.list.testDistribution b/tests/data/sources.list.testDistribution index dd900645..1687c504 100644 --- a/tests/data/sources.list.testDistribution +++ b/tests/data/sources.list.testDistribution @@ -1,14 +1,11 @@ -# comment 1 deb http://de.archive.ubuntu.com/ubuntu/ edgy main -# comment 2 deb http://de.archive.ubuntu.com/ubuntu/ edgy restricted -# comment 3 deb http://de.archive.ubuntu.com/ubuntu/ edgy universe -# comment 4 deb http://de.archive.ubuntu.com/ubuntu/ edgy-updates universe multiverse -# comment 5 +deb http://de.archive.ubuntu.com/ubuntu/ edgy-updates restricted deb http://de.archive.ubuntu.com/ubuntu/ edgy-security main -# comment 6 +deb http://de.archive.ubuntu.com/ubuntu/ edgy-security multiverse deb http://ftp.debian.org/debian sid main -# comment 7 -deb http://de.archive.ubuntu.com/ubuntu/ breezy main
\ No newline at end of file +deb ftp://ubuntu.cs.utah.edu/pub/ubuntu/ubuntu/ breezy main +deb ftp://ubuntu.cs.utah.edu/pub/ubuntu/ubuntu/ breezy-backports main +deb http://archive.ubuntu.com/ubuntu/ hoary main diff --git a/tests/test_aptsources.py b/tests/test_aptsources.py index d5b5ff9f..3ee106be 100644 --- a/tests/test_aptsources.py +++ b/tests/test_aptsources.py @@ -81,19 +81,47 @@ class TestAptSources(unittest.TestCase): sources = aptsources.SourcesList() distro = aptsources.Distribution() distro.get_sources(sources) + # test if all suits of the current distro were detected correctly + dist_templates = set() + for s in sources: + if s.template: + dist_templates.add(s.template.name) + #print dist_templates + for d in ["edgy","edgy-security","edgy-updates","hoary","breezy", "breezy-backports"]: + self.assertTrue(d in dist_templates) + # test enable comp = "restricted" distro.enable_component(sources, comp) - found = 0 + found = {} for entry in sources: if (entry.type == "deb" and entry.uri == "http://de.archive.ubuntu.com/ubuntu/" and - entry.dist == "edgy"): + "edgy" in entry.dist): + for c in entry.comps: + if c == comp: + if not found.has_key(entry.dist): + found[entry.dist] = 0 + found[entry.dist] += 1 + #print "".join([s.str() for s in sources]) + for key in found: + self.assertEqual(found[key], 1) + + # add a not-already available component + comp = "multiverse" + distro.enable_component(sources, comp) + found = {} + for entry in sources: + if (entry.type == "deb" and + entry.template and + entry.template.name == "edgy"): for c in entry.comps: if c == comp: - found += 1 - print "".join([s.str() for s in sources]) - self.assertEqual(found, 1) - + if not found.has_key(entry.dist): + found[entry.dist] = 0 + found[entry.dist] += 1 + #print "".join([s.str() for s in sources]) + for key in found: + self.assertEqual(found[key], 1) if __name__ == "__main__": unittest.main() |
