356
355
# FIXME: we need to test with a real proxy, I can't find a way so simulate
357
356
# CONNECT without leaving one server hanging the test :-/ Since that maybe
358
357
# related to the leaking tests problems, I'll punt for now -- vila 20091030
360
class TestDebuntuExpansions(TestCaseInTempDir):
361
"""Test expansions for ubuntu: and debianlp: schemes."""
364
tests.TestCase.setUp(self)
365
self.directory = LaunchpadDirectory()
367
def _make_factory(self, package='foo', distro='ubuntu', series=None):
369
path = '%s/%s' % (distro, package)
370
url_suffix = '~branch/%s/%s' % (distro, package)
372
path = '%s/%s/%s' % (distro, series, package)
373
url_suffix = '~branch/%s/%s/%s' % (distro, series, package)
374
return FakeResolveFactory(
375
self, path, dict(urls=[
376
'http://bazaar.launchpad.net/' + url_suffix]))
378
def assertURL(self, expected_url, shortcut, package='foo', distro='ubuntu',
380
factory = self._make_factory(package=package, distro=distro,
382
self.assertEqual('http://bazaar.launchpad.net/~branch/' + expected_url,
383
self.directory._resolve(shortcut, factory))
387
def test_bogus_distro(self):
388
self.assertRaises(errors.InvalidURL,
389
self.directory._resolve, 'gentoo:foo')
391
def test_trick_bogus_distro_u(self):
392
self.assertRaises(errors.InvalidURL,
393
self.directory._resolve, 'utube:foo')
395
def test_trick_bogus_distro_d(self):
396
self.assertRaises(errors.InvalidURL,
397
self.directory._resolve, 'debuntu:foo')
399
def test_missing_ubuntu_distroseries_without_project(self):
400
# Launchpad does not hold source packages for Intrepid. Missing or
401
# bogus distroseries with no project name is treated like a project.
402
self.assertURL('ubuntu/intrepid', 'ubuntu:intrepid', package='intrepid')
404
def test_missing_ubuntu_distroseries_with_project(self):
405
# Launchpad does not hold source packages for Intrepid. Missing or
406
# bogus distroseries with a project name is treated like an unknown
407
# series (i.e. we keep it verbatim).
408
self.assertURL('ubuntu/intrepid/foo',
409
'ubuntu:intrepid/foo', series='intrepid')
411
def test_missing_debian_distroseries(self):
412
# Launchpad does not hold source packages for unstable. Missing or
413
# bogus distroseries is treated like a project.
414
self.assertURL('debian/sid',
415
'debianlp:sid', package='sid', distro='debian')
417
# Ubuntu Default distro series.
419
def test_ubuntu_default_distroseries_expansion(self):
420
self.assertURL('ubuntu/foo', 'ubuntu:foo')
422
def test_ubuntu_natty_distroseries_expansion(self):
423
self.assertURL('ubuntu/natty/foo', 'ubuntu:natty/foo', series='natty')
425
def test_ubuntu_n_distroseries_expansion(self):
426
self.assertURL('ubuntu/natty/foo', 'ubuntu:n/foo', series='natty')
428
def test_ubuntu_maverick_distroseries_expansion(self):
429
self.assertURL('ubuntu/maverick/foo', 'ubuntu:maverick/foo',
432
def test_ubuntu_m_distroseries_expansion(self):
433
self.assertURL('ubuntu/maverick/foo', 'ubuntu:m/foo', series='maverick')
435
def test_ubuntu_lucid_distroseries_expansion(self):
436
self.assertURL('ubuntu/lucid/foo', 'ubuntu:lucid/foo', series='lucid')
438
def test_ubuntu_l_distroseries_expansion(self):
439
self.assertURL('ubuntu/lucid/foo', 'ubuntu:l/foo', series='lucid')
441
def test_ubuntu_karmic_distroseries_expansion(self):
442
self.assertURL('ubuntu/karmic/foo', 'ubuntu:karmic/foo',
445
def test_ubuntu_k_distroseries_expansion(self):
446
self.assertURL('ubuntu/karmic/foo', 'ubuntu:k/foo', series='karmic')
448
def test_ubuntu_jaunty_distroseries_expansion(self):
449
self.assertURL('ubuntu/jaunty/foo', 'ubuntu:jaunty/foo',
452
def test_ubuntu_j_distroseries_expansion(self):
453
self.assertURL('ubuntu/jaunty/foo', 'ubuntu:j/foo', series='jaunty')
455
def test_ubuntu_hardy_distroseries_expansion(self):
456
self.assertURL('ubuntu/hardy/foo', 'ubuntu:hardy/foo', series='hardy')
458
def test_ubuntu_h_distroseries_expansion(self):
459
self.assertURL('ubuntu/hardy/foo', 'ubuntu:h/foo', series='hardy')
461
def test_ubuntu_dapper_distroseries_expansion(self):
462
self.assertURL('ubuntu/dapper/foo', 'ubuntu:dapper/foo',
465
def test_ubuntu_d_distroseries_expansion(self):
466
self.assertURL('ubuntu/dapper/foo', 'ubuntu:d/foo', series='dapper')
468
# Debian default distro series.
470
def test_debian_default_distroseries_expansion(self):
471
self.assertURL('debian/foo', 'debianlp:foo', distro='debian')
473
def test_debian_squeeze_distroseries_expansion(self):
474
self.assertURL('debian/squeeze/foo', 'debianlp:squeeze/foo',
475
distro='debian', series='squeeze')
477
def test_debian_lenny_distroseries_expansion(self):
478
self.assertURL('debian/lenny/foo', 'debianlp:lenny/foo',
479
distro='debian', series='lenny')