~ubuntu-branches/ubuntu/precise/update-manager/precise

« back to all changes in this revision

Viewing changes to tests/test_sources_list.py

  • Committer: Package Import Robot
  • Author(s): Michael Vogt, Michael Vogt, Brian Murray
  • Date: 2012-03-05 09:02:14 UTC
  • Revision ID: package-import@ubuntu.com-20120305090214-7xgvp4mcer057r6m
Tags: 1:0.156.7
[ Michael Vogt ]
* DistUpgrade/DistUpgradeCache.py:
  - fix nvidia detection, thanks to Brian Murray
* DistUpgrade/xorg_fix_proprietary.py:
  - fix crash when apt_pkg is not initialized (LP: #942106)
* DistUpgrade/DistUpgradeController.py, DistUpgrade/mirrors.cfg:
  - support upgrades with commercial-ppas in the sources.list
    (LP: #939461) and add tests
* UpdateManager/UpdateManager.py:
  - fix inaccurate string, thanks to JohnNapster (LP: #942590)

[ Brian Murray ]
* DistUpgrade/removal_blacklist.cfg: 
  - Only blacklist unity-2d, not all packages whose names start with
    unity-2d.  (LP: #940196)

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
from DistUpgrade.DistUpgradeViewNonInteractive import DistUpgradeViewNonInteractive
13
13
import logging
14
14
 
15
 
class testSourcesListUpdate(unittest.TestCase):
 
15
class TestSourcesListUpdate(unittest.TestCase):
16
16
 
17
17
    testdir = os.path.abspath("./data-sources-list-test/")
18
18
 
109
109
deb http://ports.ubuntu.com/ubuntu-ports/ gutsy main restricted multiverse universe
110
110
deb-src http://archive.ubuntu.com/ubuntu/ gutsy main restricted multiverse
111
111
 
112
 
deb http://ports.ubuntu.com/ubuntu-ports/ gutsy-security main restricted
 
112
deb http://ports.ubuntu.com/ubuntu-ports/ gutsy-security main restricted universe multiverse
113
113
""")
114
114
        apt_pkg.config.set("APT::Architecture",arch)
115
115
 
134
134
deb http://ports.ubuntu.com/ubuntu-ports/ hardy main restricted multiverse universe
135
135
deb-src http://archive.ubuntu.com/ubuntu/ hardy main restricted multiverse
136
136
 
137
 
deb http://ports.ubuntu.com/ubuntu-ports/ hardy-security main restricted
 
137
deb http://ports.ubuntu.com/ubuntu-ports/ hardy-security main restricted universe multiverse
138
138
""")
139
139
        apt_pkg.config.set("APT::Architecture",arch)
140
140
 
173
173
deb http://old-releases.ubuntu.com/ubuntu hoary main restricted multiverse universe
174
174
deb-src http://old-releases.ubuntu.com/ubuntu hoary main restricted multiverse
175
175
 
176
 
deb http://old-releases.ubuntu.com/ubuntu hoary-security main restricted
 
176
deb http://old-releases.ubuntu.com/ubuntu hoary-security main restricted universe multiverse
177
177
""")
178
178
 
179
179
    def testEOL2SupportedWithMirrorUpgrade(self):
196
196
deb http://de.archive.ubuntu.com/ubuntu hardy main restricted multiverse universe
197
197
deb-src http://de.archive.ubuntu.com/ubuntu hardy main restricted multiverse
198
198
 
199
 
deb http://de.archive.ubuntu.com/ubuntu hardy-security main restricted
 
199
deb http://de.archive.ubuntu.com/ubuntu hardy-security main restricted universe multiverse
200
200
""")
201
201
 
202
202
    def testEOL2SupportedUpgrade(self):
219
219
deb http://archive.ubuntu.com/ubuntu hardy main restricted multiverse universe
220
220
deb-src http://archive.ubuntu.com/ubuntu hardy main restricted multiverse
221
221
 
222
 
deb http://archive.ubuntu.com/ubuntu hardy-security main restricted
 
222
deb http://archive.ubuntu.com/ubuntu hardy-security main restricted universe multiverse
223
223
""")
224
224
 
225
225
    def test_partner_update(self):
245
245
deb http://archive.canonical.com/ubuntu gutsy partner
246
246
""")
247
247
 
 
248
    def test_private_ppa_transition(self):
 
249
        shutil.copy(
 
250
            os.path.join(self.testdir,"sources.list.commercial-ppa-uploaders"),
 
251
            os.path.join(self.testdir,"sources.list"))
 
252
        apt_pkg.config.set(
 
253
            "Dir::Etc::sourceparts",os.path.join(self.testdir,"sources.list.d"))
 
254
        v = DistUpgradeViewNonInteractive()
 
255
        d = DistUpgradeController(v,datadir=self.testdir)
 
256
        d.openCache(lock=False)
 
257
        res = d.updateSourcesList()
 
258
        self.assert_(res == True)
 
259
 
 
260
        # now test the result
 
261
        self._verifySources("""
 
262
deb http://archive.ubuntu.com/ubuntu/ gutsy main restricted multiverse universe
 
263
deb-src http://archive.ubuntu.com/ubuntu/ gutsy main restricted multiverse
 
264
 
 
265
deb http://security.ubuntu.com/ubuntu/ gutsy-security main restricted universe multiverse
 
266
 
 
267
# random one
 
268
# deb http://user:pass@private-ppa.launchpad.net/random-ppa gutsy main # disabled on upgrade to gutsy
 
269
 
 
270
# commercial PPA
 
271
deb https://user:pass@private-ppa.launchpad.net/commercial-ppa-uploaders gutsy main
 
272
""")
 
273
        
 
274
 
248
275
    def test_apt_cacher_and_apt_bittorent(self):
249
276
        """
250
277
        test transition of apt-cacher/apt-torrent uris
260
287
 
261
288
        # now test the result
262
289
        self._verifySources("""
263
 
deb http://localhost:9977/security.ubuntu.com/ubuntu gutsy-security main restricted
 
290
deb http://localhost:9977/security.ubuntu.com/ubuntu gutsy-security main restricted universe multiverse
264
291
deb http://localhost:9977/archive.canonical.com/ubuntu gutsy partner
265
292
deb http://localhost:9977/us.archive.ubuntu.com/ubuntu/ gutsy main
266
293
deb http://localhost:9977/archive.ubuntu.com/ubuntu/ gutsy main
278
305
    def _verifySources(self, expected):
279
306
        sources_list = open(apt_pkg.config.find_file("Dir::Etc::sourcelist")).read()
280
307
        for l in expected.split("\n"):
281
 
            self.assert_(l in sources_list,
 
308
            self.assert_(l in sources_list.split("\n"),
282
309
                         "expected entry '%s' in sources.list missing. got:\n'''%s'''" % (l, sources_list))
283
310
        
284
311