diff options
Diffstat (limited to 'tests/test_aptsources.py')
| -rw-r--r-- | tests/test_aptsources.py | 34 |
1 files changed, 21 insertions, 13 deletions
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 |
