From d4829dd415cc26a4e9530f97e831939b79817e36 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Wed, 28 Sep 2011 16:24:03 +0200 Subject: add concept of "ParentComponent" for e.g. ubuntu/multiverse that needs universe enabled as well (plus add test) --- tests/test_aptsources.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'tests') 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/" -- cgit v1.2.3