diff options
| author | Michael Vogt <michael.vogt@ubuntu.com> | 2006-09-09 23:23:57 +0200 |
|---|---|---|
| committer | Michael Vogt <michael.vogt@ubuntu.com> | 2006-09-09 23:23:57 +0200 |
| commit | 522d72a3abeacee8b6070481738f9c9edd0a6161 (patch) | |
| tree | 1e1ec3525622062575ed6c156432a22eb1f1bd91 /tests | |
| parent | e4b06af1ace3bbb4281a9c762113f8a2699116c3 (diff) | |
| download | python-apt-522d72a3abeacee8b6070481738f9c9edd0a6161.tar.gz | |
* UpdateManager/Common/aptsources.py:
- fix "add_component" to correcly add components even under difficult conditions
* tests/data/sources.list.testDistribution:
- changed the sources.list to make it sufficiently difficult for aptsources
* tests/test_aptsources.py:
- added other testcase for add_component()
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/data/sources.list.testDistribution | 9 | ||||
| -rw-r--r-- | tests/test_aptsources.py | 31 |
2 files changed, 27 insertions, 13 deletions
diff --git a/tests/data/sources.list.testDistribution b/tests/data/sources.list.testDistribution index dd900645..031e4c51 100644 --- a/tests/data/sources.list.testDistribution +++ b/tests/data/sources.list.testDistribution @@ -1,14 +1,9 @@ -# 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 diff --git a/tests/test_aptsources.py b/tests/test_aptsources.py index d5b5ff9f..1db99e3c 100644 --- a/tests/test_aptsources.py +++ b/tests/test_aptsources.py @@ -83,17 +83,36 @@ class TestAptSources(unittest.TestCase): distro.get_sources(sources) 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.uri == "http://de.archive.ubuntu.com/ubuntu/" and + "edgy" in entry.dist): 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() |
