summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2008-09-18 14:15:59 +0200
committerMichael Vogt <michael.vogt@ubuntu.com>2008-09-18 14:15:59 +0200
commit69751ac5d60b35daddfe62219283b535892c7007 (patch)
tree848ce2e5e15bca3d467b83524ca81640b42ff220
parent34fa87e70cd6967805ba6faebf146bc4dcd5c14c (diff)
downloadpython-apt-69751ac5d60b35daddfe62219283b535892c7007.tar.gz
* tests/test_aptsources.py:
- make the test work again
-rw-r--r--tests/data/sources.list.testDistribution20
-rw-r--r--tests/test_aptsources.py34
2 files changed, 31 insertions, 23 deletions
diff --git a/tests/data/sources.list.testDistribution b/tests/data/sources.list.testDistribution
index 1687c504..45c155e9 100644
--- a/tests/data/sources.list.testDistribution
+++ b/tests/data/sources.list.testDistribution
@@ -1,11 +1,11 @@
-deb http://de.archive.ubuntu.com/ubuntu/ edgy main
-deb http://de.archive.ubuntu.com/ubuntu/ edgy restricted
-deb http://de.archive.ubuntu.com/ubuntu/ edgy universe
-deb http://de.archive.ubuntu.com/ubuntu/ edgy-updates universe multiverse
-deb http://de.archive.ubuntu.com/ubuntu/ edgy-updates restricted
-deb http://de.archive.ubuntu.com/ubuntu/ edgy-security main
-deb http://de.archive.ubuntu.com/ubuntu/ edgy-security multiverse
+deb http://de.archive.ubuntu.com/ubuntu/ hardy main
+deb http://de.archive.ubuntu.com/ubuntu/ hardy restricted
+deb http://de.archive.ubuntu.com/ubuntu/ hardy universe
+deb http://de.archive.ubuntu.com/ubuntu/ hardy-updates universe multiverse
+deb http://de.archive.ubuntu.com/ubuntu/ hardy-updates restricted
+deb http://de.archive.ubuntu.com/ubuntu/ hardy-security main
+deb http://de.archive.ubuntu.com/ubuntu/ hardy-security multiverse
deb http://ftp.debian.org/debian sid main
-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
+deb http://ubuntu.cs.uaf.edu/ubuntu/ hardy main
+deb http://ubuntu.cs.uaf.edu/ubuntu/ hardy-backports main
+deb http://archive.ubuntu.com/ubuntu/ intrepid main
diff --git a/tests/test_aptsources.py b/tests/test_aptsources.py
index 3ee106be..4b2c7965 100644
--- a/tests/test_aptsources.py
+++ b/tests/test_aptsources.py
@@ -1,27 +1,32 @@
#!/usr/bin/env python
-import UpdateManager.Common.aptsources as aptsources
import unittest
import apt_pkg
import os
import copy
+import sys
+sys.path.insert(0, "../")
+import aptsources
+import aptsources.sourceslist
+import aptsources.distro
+
class TestAptSources(unittest.TestCase):
def __init__(self, methodName):
unittest.TestCase.__init__(self, methodName)
apt_pkg.init()
apt_pkg.Config.Set("Dir::Etc", os.getcwd())
- apt_pkg.Config.Set("Dir::Etc::sourceparts",".")
+ apt_pkg.Config.Set("Dir::Etc::sourceparts","/xxx")
def testIsMirror(self):
- self.assertTrue(aptsources.is_mirror("http://archive.ubuntu.com",
- "http://de.archive.ubuntu.com"))
- self.assertFalse(aptsources.is_mirror("http://archive.ubuntu.com",
- "http://ftp.debian.org"))
+ self.assertTrue(aptsources.sourceslist.is_mirror("http://archive.ubuntu.com",
+ "http://de.archive.ubuntu.com"))
+ self.assertFalse(aptsources.sourceslist.is_mirror("http://archive.ubuntu.com",
+ "http://ftp.debian.org"))
def testSourcesListReading(self):
apt_pkg.Config.Set("Dir::Etc::sourcelist","data/sources.list")
- sources = aptsources.SourcesList()
+ sources = aptsources.sourceslist.SourcesList()
self.assertEqual(len(sources.list), 6)
# test load
sources.list = []
@@ -30,7 +35,7 @@ class TestAptSources(unittest.TestCase):
def testSourcesListAdding(self):
apt_pkg.Config.Set("Dir::Etc::sourcelist","data/sources.list")
- sources = aptsources.SourcesList()
+ sources = aptsources.sourceslist.SourcesList()
# test to add something that is already there (main)
before = copy.deepcopy(sources)
sources.add("deb","http://de.archive.ubuntu.com/ubuntu/",
@@ -76,10 +81,13 @@ class TestAptSources(unittest.TestCase):
self.assertEqual(found_something, 1)
self.assertEqual(found_universe, 1)
+ def testMatcher(self):
+ apt_pkg.Config.Set("Dir::Etc::sourcelist","data/sources.list.testDistribution")
+
def testDistribution(self):
apt_pkg.Config.Set("Dir::Etc::sourcelist","data/sources.list.testDistribution")
- sources = aptsources.SourcesList()
- distro = aptsources.Distribution()
+ sources = aptsources.sourceslist.SourcesList()
+ distro = aptsources.distro.get_distro()
distro.get_sources(sources)
# test if all suits of the current distro were detected correctly
dist_templates = set()
@@ -87,11 +95,11 @@ class TestAptSources(unittest.TestCase):
if s.template:
dist_templates.add(s.template.name)
#print dist_templates
- for d in ["edgy","edgy-security","edgy-updates","hoary","breezy", "breezy-backports"]:
+ for d in ["hardy","hardy-security","hardy-updates","intrepid","hardy-backports"]:
self.assertTrue(d in dist_templates)
# test enable
comp = "restricted"
- distro.enable_component(sources, comp)
+ distro.enable_component(comp)
found = {}
for entry in sources:
if (entry.type == "deb" and
@@ -108,7 +116,7 @@ class TestAptSources(unittest.TestCase):
# add a not-already available component
comp = "multiverse"
- distro.enable_component(sources, comp)
+ distro.enable_component(comp)
found = {}
for entry in sources:
if (entry.type == "deb" and