summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2011-09-28 16:24:03 +0200
committerMichael Vogt <michael.vogt@ubuntu.com>2011-09-28 16:24:03 +0200
commitd4829dd415cc26a4e9530f97e831939b79817e36 (patch)
treea99e0695124ed5aba17a5ecd62130a804dd973b3 /tests
parent8c5ea9518e38ac7fd3d5d4b547e0b6bad4b0c18d (diff)
downloadpython-apt-d4829dd415cc26a4e9530f97e831939b79817e36.tar.gz
add concept of "ParentComponent" for e.g. ubuntu/multiverse
that needs universe enabled as well (plus add test)
Diffstat (limited to 'tests')
-rw-r--r--tests/test_aptsources.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/test_aptsources.py b/tests/test_aptsources.py
index 193d3806..dcfb0682 100644
--- a/tests/test_aptsources.py
+++ b/tests/test_aptsources.py
@@ -160,6 +160,29 @@ class TestAptSources(unittest.TestCase):
assert sources.list[8].comps == ["main"]
assert sources.list[8].line.strip() == str(sources.list[8])
+ def test_enable_component(self):
+ from subprocess import Popen, PIPE
+ target = "./data/aptsources/sources.list.enable_comps"
+ line = "deb http://archive.ubuntu.com/ubuntu lucid main\n"
+ open(target, "w").write(line)
+ apt_pkg.config.set("Dir::Etc::sourcelist", target)
+ sources = aptsources.sourceslist.SourcesList(True, self.templates)
+ distro = aptsources.distro.get_distro(id="Ubuntu")
+ # make sure we are using the right distro
+ distro.codename = "lucid"
+ distro.id = "Ubuntu"
+ distro.release = "10.04"
+ # and get the sources
+ distro.get_sources(sources)
+ # test enable_component
+ comp = "multiverse"
+ distro.enable_component(comp)
+ comps = set()
+ for entry in sources:
+ comps = comps.union(set(entry.comps))
+ self.assertTrue("multiverse" in comps)
+ self.assertTrue("universe" in comps)
+
def testDistribution(self):
"""aptsources: Test distribution detection."""
apt_pkg.config.set("Dir::Etc::sourcelist", "data/aptsources/"