summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2013-10-21 20:20:22 +0200
committerJulian Andres Klode <jak@debian.org>2013-10-21 20:20:33 +0200
commit8a67219266605b39a522aee08bf7cd3b0b6c3a8c (patch)
treefe6fcb3ca511d9573e9c2e4320af72c7e1d70734 /tests
parentabc9feb18b268cbc4ddb79aabb30ce352e31b44a (diff)
downloadpython-apt-8a67219266605b39a522aee08bf7cd3b0b6c3a8c.tar.gz
aptsources: Correctly parse multiple options (LP: #1103200)
It's still not optimal and we do not support the arch+ and arch- options, but it's a beginning.
Diffstat (limited to 'tests')
-rw-r--r--tests/data/aptsources/sources.list1
-rw-r--r--tests/test_aptsources.py21
2 files changed, 20 insertions, 2 deletions
diff --git a/tests/data/aptsources/sources.list b/tests/data/aptsources/sources.list
index 376d6961..8ca68075 100644
--- a/tests/data/aptsources/sources.list
+++ b/tests/data/aptsources/sources.list
@@ -7,3 +7,4 @@ deb http://de.archive.ubuntu.com/ubuntu/ edgy universe
# multi-arch
deb [arch=amd64,i386] http://de.archive.ubuntu.com/ubuntu/ natty main
+deb [arch=amd64,i386 trusted=yes] http://de.archive.ubuntu.com/ubuntu/ natty main
diff --git a/tests/test_aptsources.py b/tests/test_aptsources.py
index 75dd91c1..5a174f3b 100644
--- a/tests/test_aptsources.py
+++ b/tests/test_aptsources.py
@@ -40,11 +40,11 @@ class TestAptSources(unittest.TestCase):
apt_pkg.config.set("Dir::Etc::sourcelist", "data/aptsources/"
"sources.list")
sources = aptsources.sourceslist.SourcesList(True, self.templates)
- self.assertEqual(len(sources.list), 9)
+ self.assertEqual(len(sources.list), 10)
# test load
sources.list = []
sources.load("data/aptsources/sources.list")
- self.assertEqual(len(sources.list), 9)
+ self.assertEqual(len(sources.list), 10)
def testSourcesListAdding(self):
"""aptsources: Test additions to sources.list"""
@@ -159,6 +159,23 @@ class TestAptSources(unittest.TestCase):
assert sources.list[8].dist == "natty"
assert sources.list[8].comps == ["main"]
assert sources.list[8].line.strip() == str(sources.list[8])
+ assert sources.list[8].trusted is None
+
+ def testMultipleOptions(self):
+ """aptsources: Test multi-arch parsing"""
+
+ apt_pkg.config.set("Dir::Etc::sourcelist", "data/aptsources/"
+ "sources.list")
+ sources = aptsources.sourceslist.SourcesList(True, self.templates)
+
+ assert sources.list[9].invalid == False
+ assert sources.list[9].type == "deb"
+ assert sources.list[9].architectures == ["amd64", "i386"]
+ self.assertEqual( sources.list[9].uri, "http://de.archive.ubuntu.com/ubuntu/")
+ assert sources.list[9].dist == "natty"
+ assert sources.list[9].comps == ["main"]
+ assert sources.list[9].trusted
+ assert sources.list[9].line.strip() == str(sources.list[9])
def test_enable_component(self):
from subprocess import Popen, PIPE