~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/plugins/launchpad/test_lp_directory.py

  • Committer: Patch Queue Manager
  • Date: 2016-04-21 04:10:52 UTC
  • mfrom: (6616.1.1 fix-en-user-guide)
  • Revision ID: pqm@pqm.ubuntu.com-20160421041052-clcye7ns1qcl2n7w
(richard-wilbur) Ensure build of English use guide always uses English text
 even when user's locale specifies a different language. (Jelmer Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2007-2010 Canonical Ltd
 
1
# Copyright (C) 2007-2012, 2016 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
19
19
import os
20
20
import xmlrpclib
21
21
 
 
22
import bzrlib
22
23
from bzrlib import (
 
24
    debug,
23
25
    errors,
24
26
    tests,
25
27
    transport,
27
29
from bzrlib.branch import Branch
28
30
from bzrlib.directory_service import directories
29
31
from bzrlib.tests import (
 
32
    features,
 
33
    ssl_certs,
30
34
    TestCaseInTempDir,
31
35
    TestCaseWithMemoryTransport
32
36
)
37
41
from bzrlib.plugins.launchpad.lp_directory import (
38
42
    LaunchpadDirectory)
39
43
from bzrlib.plugins.launchpad.account import get_lp_login, set_lp_login
40
 
from bzrlib.tests import (
41
 
    http_server,
42
 
    http_utils,
43
 
    )
 
44
from bzrlib.tests import http_server
44
45
 
45
46
 
46
47
def load_tests(standard_tests, module, loader):
52
53
    transport_scenarios = [
53
54
        ('http', dict(server_class=PreCannedHTTPServer,)),
54
55
        ]
55
 
    if tests.HTTPSServerFeature.available():
 
56
    if features.HTTPSServerFeature.available():
56
57
        transport_scenarios.append(
57
58
            ('https', dict(server_class=PreCannedHTTPSServer,)),
58
59
            )
65
66
 
66
67
 
67
68
class FakeResolveFactory(object):
 
69
 
68
70
    def __init__(self, test, expected_path, result):
69
71
        self._test = test
70
72
        self._expected_path = expected_path
71
73
        self._result = result
 
74
        self._submitted = False
72
75
 
73
76
    def __call__(self, path):
74
77
        self._test.assertEqual(self._expected_path, path)
76
79
 
77
80
    def submit(self, service):
78
81
        self._service_url = service.service_url
 
82
        self._submitted = True
79
83
        return self._result
80
84
 
81
85
 
 
86
class LocalDirectoryURLTests(TestCaseInTempDir):
 
87
    """Tests for branch urls that we try to pass through local resolution."""
 
88
 
 
89
    def assertResolve(self, expected, url, submitted=False):
 
90
        path = url[url.index(':')+1:].lstrip('/')
 
91
        factory = FakeResolveFactory(self, path,
 
92
                    dict(urls=['bzr+ssh://fake-resolved']))
 
93
        directory = LaunchpadDirectory()
 
94
        self.assertEqual(expected,
 
95
            directory._resolve(url, factory, _lp_login='user'))
 
96
        # We are testing local resolution, and the fallback when necessary.
 
97
        self.assertEqual(submitted, factory._submitted)
 
98
 
 
99
    def test_short_form(self):
 
100
        self.assertResolve('bzr+ssh://bazaar.launchpad.net/+branch/apt',
 
101
                           'lp:apt')
 
102
 
 
103
    def test_two_part_form(self):
 
104
        self.assertResolve('bzr+ssh://bazaar.launchpad.net/+branch/apt/2.2',
 
105
                           'lp:apt/2.2')
 
106
 
 
107
    def test_two_part_plus_subdir(self):
 
108
        # We allow you to pass more than just what resolves. That way you can
 
109
        # do things like "bzr log lp:apt/2.2/BUGS"
 
110
        # Though the virtual FS implementation currently aborts when given a
 
111
        # URL like this, rather than letting you recurse upwards to find the
 
112
        # real branch at lp:apt/2.2
 
113
        self.assertResolve('bzr+ssh://bazaar.launchpad.net/+branch/apt/2.2/BUGS',
 
114
                           'lp:apt/2.2/BUGS')
 
115
 
 
116
    def test_user_expansion(self):
 
117
        self.assertResolve('bzr+ssh://bazaar.launchpad.net/~user/apt/foo',
 
118
                           'lp:~/apt/foo')
 
119
 
 
120
    def test_ubuntu(self):
 
121
        # Confirmed against xmlrpc. If you don't have a ~user, xmlrpc doesn't
 
122
        # care that you are asking for 'ubuntu'
 
123
        self.assertResolve('bzr+ssh://bazaar.launchpad.net/+branch/ubuntu',
 
124
                           'lp:ubuntu')
 
125
 
 
126
    def test_ubuntu_invalid(self):
 
127
        """Invalid ubuntu urls don't crash.
 
128
 
 
129
        :seealso: http://pad.lv/843900
 
130
        """
 
131
        # This ought to be natty-updates.
 
132
        self.assertRaises(errors.InvalidURL,
 
133
            self.assertResolve,
 
134
            '',
 
135
            'ubuntu:natty/updates/smartpm')
 
136
 
 
137
    def test_ubuntu_apt(self):
 
138
        self.assertResolve('bzr+ssh://bazaar.launchpad.net/+branch/ubuntu/apt',
 
139
                           'lp:ubuntu/apt')
 
140
 
 
141
    def test_ubuntu_natty_apt(self):
 
142
        self.assertResolve(
 
143
            'bzr+ssh://bazaar.launchpad.net/+branch/ubuntu/natty/apt',
 
144
            'lp:ubuntu/natty/apt')
 
145
 
 
146
    def test_ubuntu_natty_apt_filename(self):
 
147
        self.assertResolve(
 
148
            'bzr+ssh://bazaar.launchpad.net/+branch/ubuntu/natty/apt/filename',
 
149
            'lp:ubuntu/natty/apt/filename')
 
150
 
 
151
    def test_user_two_part(self):
 
152
        # We fall back to the ResolveFactory. The real Launchpad one will raise
 
153
        # InvalidURL for this case.
 
154
        self.assertResolve('bzr+ssh://fake-resolved', 'lp:~jameinel/apt',
 
155
                           submitted=True)
 
156
 
 
157
    def test_user_three_part(self):
 
158
        self.assertResolve('bzr+ssh://bazaar.launchpad.net/~jameinel/apt/foo',
 
159
                           'lp:~jameinel/apt/foo')
 
160
 
 
161
    def test_user_three_part_plus_filename(self):
 
162
        self.assertResolve(
 
163
            'bzr+ssh://bazaar.launchpad.net/~jameinel/apt/foo/fname',
 
164
            'lp:~jameinel/apt/foo/fname')
 
165
 
 
166
    def test_user_ubuntu_two_part(self):
 
167
        self.assertResolve('bzr+ssh://fake-resolved', 'lp:~jameinel/ubuntu',
 
168
                           submitted=True)
 
169
        self.assertResolve('bzr+ssh://fake-resolved', 'lp:~jameinel/debian',
 
170
                           submitted=True)
 
171
 
 
172
    def test_user_ubuntu_three_part(self):
 
173
        self.assertResolve('bzr+ssh://fake-resolved',
 
174
                           'lp:~jameinel/ubuntu/natty', submitted=True)
 
175
        self.assertResolve('bzr+ssh://fake-resolved',
 
176
                           'lp:~jameinel/debian/sid', submitted=True)
 
177
 
 
178
    def test_user_ubuntu_four_part(self):
 
179
        self.assertResolve('bzr+ssh://fake-resolved',
 
180
                           'lp:~jameinel/ubuntu/natty/project', submitted=True)
 
181
        self.assertResolve('bzr+ssh://fake-resolved',
 
182
                           'lp:~jameinel/debian/sid/project', submitted=True)
 
183
 
 
184
    def test_user_ubuntu_five_part(self):
 
185
        self.assertResolve(
 
186
            'bzr+ssh://bazaar.launchpad.net/~jameinel/ubuntu/natty/apt/branch',
 
187
            'lp:~jameinel/ubuntu/natty/apt/branch')
 
188
        self.assertResolve(
 
189
            'bzr+ssh://bazaar.launchpad.net/~jameinel/debian/sid/apt/branch',
 
190
            'lp:~jameinel/debian/sid/apt/branch')
 
191
 
 
192
    def test_user_ubuntu_five_part_plus_subdir(self):
 
193
        self.assertResolve(
 
194
            'bzr+ssh://bazaar.launchpad.net/~jameinel/ubuntu/natty/apt/branch/f',
 
195
            'lp:~jameinel/ubuntu/natty/apt/branch/f')
 
196
        self.assertResolve(
 
197
            'bzr+ssh://bazaar.launchpad.net/~jameinel/debian/sid/apt/branch/f',
 
198
            'lp:~jameinel/debian/sid/apt/branch/f')
 
199
 
 
200
    def test_handles_special_lp(self):
 
201
        self.assertResolve('bzr+ssh://bazaar.launchpad.net/+branch/apt', 'lp:apt')
 
202
        self.assertResolve('bzr+ssh://bazaar.launchpad.net/+branch/apt',
 
203
                           'lp:///apt')
 
204
        self.assertResolve('bzr+ssh://bazaar.launchpad.net/+branch/apt',
 
205
                           'lp://production/apt')
 
206
        self.assertResolve('bzr+ssh://bazaar.launchpad.dev/+branch/apt',
 
207
                           'lp://dev/apt')
 
208
        self.assertResolve('bzr+ssh://bazaar.staging.launchpad.net/+branch/apt',
 
209
                           'lp://staging/apt')
 
210
        self.assertResolve('bzr+ssh://bazaar.qastaging.launchpad.net/+branch/apt',
 
211
                           'lp://qastaging/apt')
 
212
        self.assertResolve('bzr+ssh://bazaar.demo.launchpad.net/+branch/apt',
 
213
                           'lp://demo/apt')
 
214
 
 
215
    def test_debug_launchpad_uses_resolver(self):
 
216
        self.assertResolve('bzr+ssh://bazaar.launchpad.net/+branch/bzr',
 
217
                           'lp:bzr', submitted=False)
 
218
        debug.debug_flags.add('launchpad')
 
219
        self.addCleanup(debug.debug_flags.discard, 'launchpad')
 
220
        self.assertResolve('bzr+ssh://fake-resolved', 'lp:bzr', submitted=True)
 
221
 
 
222
 
82
223
class DirectoryUrlTests(TestCaseInTempDir):
83
224
    """Tests for branch urls through Launchpad.net directory"""
84
225
 
88
229
            self, 'apt', dict(urls=[
89
230
                    'http://bazaar.launchpad.net/~apt/apt/devel']))
90
231
        directory = LaunchpadDirectory()
91
 
        self.assertEquals('http://bazaar.launchpad.net/~apt/apt/devel',
 
232
        self.assertEqual('http://bazaar.launchpad.net/~apt/apt/devel',
92
233
                          directory._resolve('lp:apt', factory))
93
234
        # Make sure that resolve went to the production server.
94
 
        self.assertEquals('https://xmlrpc.launchpad.net/bazaar/',
 
235
        self.assertEqual('https://xmlrpc.launchpad.net/bazaar/',
 
236
                          factory._service_url)
 
237
 
 
238
    def test_qastaging(self):
 
239
        """A launchpad url should map to a http url"""
 
240
        factory = FakeResolveFactory(
 
241
            self, 'apt', dict(urls=[
 
242
                    'http://bazaar.qastaging.launchpad.net/~apt/apt/devel']))
 
243
        url = 'lp://qastaging/apt'
 
244
        directory = LaunchpadDirectory()
 
245
        self.assertEqual('http://bazaar.qastaging.launchpad.net/~apt/apt/devel',
 
246
                          directory._resolve(url, factory))
 
247
        # Make sure that resolve went to the qastaging server.
 
248
        self.assertEqual('https://xmlrpc.qastaging.launchpad.net/bazaar/',
95
249
                          factory._service_url)
96
250
 
97
251
    def test_staging(self):
101
255
                    'http://bazaar.staging.launchpad.net/~apt/apt/devel']))
102
256
        url = 'lp://staging/apt'
103
257
        directory = LaunchpadDirectory()
104
 
        self.assertEquals('http://bazaar.staging.launchpad.net/~apt/apt/devel',
 
258
        self.assertEqual('http://bazaar.staging.launchpad.net/~apt/apt/devel',
105
259
                          directory._resolve(url, factory))
106
260
        # Make sure that resolve went to the staging server.
107
 
        self.assertEquals('https://xmlrpc.staging.launchpad.net/bazaar/',
 
261
        self.assertEqual('https://xmlrpc.staging.launchpad.net/bazaar/',
108
262
                          factory._service_url)
109
263
 
110
264
    def test_url_from_directory(self):
113
267
            self, 'apt', dict(urls=[
114
268
                    'http://bazaar.launchpad.net/~apt/apt/devel']))
115
269
        directory = LaunchpadDirectory()
116
 
        self.assertEquals('http://bazaar.launchpad.net/~apt/apt/devel',
 
270
        self.assertEqual('http://bazaar.launchpad.net/~apt/apt/devel',
117
271
                          directory._resolve('lp:///apt', factory))
118
272
 
119
273
    def test_directory_skip_bad_schemes(self):
123
277
                    'http://bazaar.launchpad.net/~apt/apt/devel',
124
278
                    'http://another/location']))
125
279
        directory = LaunchpadDirectory()
126
 
        self.assertEquals('http://bazaar.launchpad.net/~apt/apt/devel',
 
280
        self.assertEqual('http://bazaar.launchpad.net/~apt/apt/devel',
127
281
                          directory._resolve('lp:///apt', factory))
128
282
 
129
283
    def test_directory_no_matching_schemes(self):
155
309
                    'bzr+ssh://bazaar.launchpad.net/~apt/apt/devel',
156
310
                    'http://bazaar.launchpad.net/~apt/apt/devel']))
157
311
        directory = LaunchpadDirectory()
158
 
        self.assertEquals('http://bazaar.launchpad.net/~apt/apt/devel',
 
312
        self.assertEqual('http://bazaar.launchpad.net/~apt/apt/devel',
159
313
                          directory._resolve('lp:///apt', factory))
160
314
 
161
315
    def test_skip_sftp_launchpad_net_when_anonymous(self):
167
321
                    'sftp://bazaar.launchpad.net/~apt/apt/devel',
168
322
                    'http://bazaar.launchpad.net/~apt/apt/devel']))
169
323
        directory = LaunchpadDirectory()
170
 
        self.assertEquals('http://bazaar.launchpad.net/~apt/apt/devel',
 
324
        self.assertEqual('http://bazaar.launchpad.net/~apt/apt/devel',
171
325
                          directory._resolve('lp:///apt', factory))
172
326
 
173
 
    def test_rewrite_bzr_ssh_launchpad_net(self):
 
327
    def test_with_login_avoid_resolve_factory(self):
174
328
        # Test that bzr+ssh URLs get rewritten to include the user's
175
329
        # Launchpad ID (assuming we know the Launchpad ID).
176
330
        factory = FakeResolveFactory(
177
331
            self, 'apt', dict(urls=[
178
 
                    'bzr+ssh://bazaar.launchpad.net/~apt/apt/devel',
 
332
                    'bzr+ssh://my-super-custom/special/devel',
179
333
                    'http://bazaar.launchpad.net/~apt/apt/devel']))
180
334
        directory = LaunchpadDirectory()
181
 
        self.assertEquals(
182
 
            'bzr+ssh://bazaar.launchpad.net/~apt/apt/devel',
 
335
        self.assertEqual(
 
336
            'bzr+ssh://bazaar.launchpad.net/+branch/apt',
183
337
            directory._resolve('lp:///apt', factory, _lp_login='username'))
184
338
 
185
339
    def test_no_rewrite_of_other_bzr_ssh(self):
190
344
                    'bzr+ssh://example.com/~apt/apt/devel',
191
345
                    'http://bazaar.launchpad.net/~apt/apt/devel']))
192
346
        directory = LaunchpadDirectory()
193
 
        self.assertEquals('bzr+ssh://example.com/~apt/apt/devel',
 
347
        self.assertEqual('bzr+ssh://example.com/~apt/apt/devel',
194
348
                          directory._resolve('lp:///apt', factory))
195
349
 
196
350
    # TODO: check we get an error if the url is unreasonable
202
356
    def test_resolve_tilde_to_user(self):
203
357
        factory = FakeResolveFactory(
204
358
            self, '~username/apt/test', dict(urls=[
205
 
                    'bzr+ssh://bazaar.launchpad.net/~username/apt/test']))
 
359
                'bzr+ssh://bazaar.launchpad.net/~username/apt/test']))
206
360
        directory = LaunchpadDirectory()
207
 
        self.assertEquals(
 
361
        self.assertEqual(
208
362
            'bzr+ssh://bazaar.launchpad.net/~username/apt/test',
209
363
            directory._resolve('lp:~/apt/test', factory, _lp_login='username'))
210
364
        # Should also happen when the login is just set by config
211
365
        set_lp_login('username')
212
 
        self.assertEquals(
 
366
        self.assertEqual(
213
367
            'bzr+ssh://bazaar.launchpad.net/~username/apt/test',
214
368
            directory._resolve('lp:~/apt/test', factory))
215
369
 
219
373
                    'bzr+ssh://bazaar.launchpad.net/~username/apt/test']))
220
374
        self.assertIs(None, get_lp_login())
221
375
        directory = LaunchpadDirectory()
222
 
        e = self.assertRaises(errors.InvalidURL,
223
 
            directory._resolve, 'lp:~/apt/test', factory)
 
376
        self.assertRaises(errors.InvalidURL,
 
377
                          directory._resolve, 'lp:~/apt/test', factory)
224
378
 
225
379
 
226
380
class DirectoryOpenBranchTests(TestCaseWithMemoryTransport):
237
391
                return '!unexpected look_up value!'
238
392
 
239
393
        directories.remove('lp:')
 
394
        directories.remove('ubuntu:')
 
395
        directories.remove('debianlp:')
240
396
        directories.register('lp:', FooService, 'Map lp URLs to local urls')
241
397
        self.addCleanup(_register_directory)
242
398
        self.addCleanup(directories.remove, 'lp:')
259
415
    def handle_one_request(self):
260
416
        tcs = self.server.test_case_server
261
417
        requestline = self.rfile.readline()
262
 
        headers = self.MessageClass(self.rfile, 0)
 
418
        self.MessageClass(self.rfile, 0)
263
419
        if requestline.startswith('POST'):
264
420
            # The body should be a single line (or we don't know where it ends
265
421
            # and we don't want to issue a blocking read)
266
 
            body = self.rfile.readline()
 
422
            self.rfile.readline()
267
423
 
268
424
        self.wfile.write(tcs.canned_response)
269
425
 
283
439
    pass
284
440
 
285
441
 
286
 
if tests.HTTPSServerFeature.available():
 
442
if features.HTTPSServerFeature.available():
287
443
    from bzrlib.tests import https_server
288
444
    class PreCannedHTTPSServer(PreCannedServerMixin, https_server.HTTPSServer):
289
445
        pass
295
451
    server_class = None
296
452
 
297
453
    def setUp(self):
298
 
        tests.TestCase.setUp(self)
 
454
        super(TestXMLRPCTransport, self).setUp()
299
455
        self.server = self.server_class()
300
456
        self.server.start_server()
 
457
        self.addCleanup(self.server.stop_server)
301
458
        # Ensure we don't clobber env
302
 
        self._captureVar('BZR_LP_XMLRPC_URL', None)
303
 
 
304
 
    def tearDown(self):
305
 
        self.server.stop_server()
306
 
        tests.TestCase.tearDown(self)
 
459
        self.overrideEnv('BZR_LP_XMLRPC_URL', None)
 
460
        # Ensure we use the right certificates for https.
 
461
        # FIXME: There should be a better way but the only alternative I can
 
462
        # think of involves carrying the ca_certs through the lp_registration
 
463
        # infrastructure to _urllib2_wrappers... -- vila 2012-01-20
 
464
        bzrlib.global_state.cmdline_overrides._from_cmdline(
 
465
            ['ssl.ca_certs=%s' % ssl_certs.build_path('ca.crt')])
307
466
 
308
467
    def set_canned_response(self, server, path):
309
468
        response_format = '''HTTP/1.1 200 OK\r
349
508
        result = self.do_request(self.server.get_url())
350
509
        urls = result.get('urls', None)
351
510
        self.assertIsNot(None, urls)
352
 
        self.assertEquals(
 
511
        self.assertEqual(
353
512
            ['bzr+ssh://bazaar.launchpad.net/~bzr-pqm/bzr/bzr.dev',
354
513
             'http://bazaar.launchpad.net/~bzr-pqm/bzr/bzr.dev'],
355
514
            urls)
356
515
    # FIXME: we need to test with a real proxy, I can't find a way so simulate
357
516
    # CONNECT without leaving one server hanging the test :-/ Since that maybe
358
517
    # related to the leaking tests problems, I'll punt for now -- vila 20091030
 
518
 
 
519
 
 
520
class TestDebuntuExpansions(TestCaseInTempDir):
 
521
    """Test expansions for ubuntu: and debianlp: schemes."""
 
522
 
 
523
    def setUp(self):
 
524
        super(TestDebuntuExpansions, self).setUp()
 
525
        self.directory = LaunchpadDirectory()
 
526
 
 
527
    def _make_factory(self, package='foo', distro='ubuntu', series=None):
 
528
        if series is None:
 
529
            path = '%s/%s' % (distro, package)
 
530
            url_suffix = '~branch/%s/%s' % (distro, package)
 
531
        else:
 
532
            path = '%s/%s/%s' % (distro, series, package)
 
533
            url_suffix = '~branch/%s/%s/%s' % (distro, series, package)
 
534
        return FakeResolveFactory(
 
535
            self, path, dict(urls=[
 
536
                'http://bazaar.launchpad.net/' + url_suffix]))
 
537
 
 
538
    def assertURL(self, expected_url, shortcut, package='foo', distro='ubuntu',
 
539
                  series=None):
 
540
        factory = self._make_factory(package=package, distro=distro,
 
541
                                     series=series)
 
542
        self.assertEqual('http://bazaar.launchpad.net/~branch/' + expected_url,
 
543
                         self.directory._resolve(shortcut, factory))
 
544
 
 
545
    # Bogus distro.
 
546
 
 
547
    def test_bogus_distro(self):
 
548
        self.assertRaises(errors.InvalidURL,
 
549
                          self.directory._resolve, 'gentoo:foo')
 
550
 
 
551
    def test_trick_bogus_distro_u(self):
 
552
        self.assertRaises(errors.InvalidURL,
 
553
                          self.directory._resolve, 'utube:foo')
 
554
 
 
555
    def test_trick_bogus_distro_d(self):
 
556
        self.assertRaises(errors.InvalidURL,
 
557
                          self.directory._resolve, 'debuntu:foo')
 
558
 
 
559
    def test_missing_ubuntu_distroseries_without_project(self):
 
560
        # Launchpad does not hold source packages for Intrepid.  Missing or
 
561
        # bogus distroseries with no project name is treated like a project.
 
562
        self.assertURL('ubuntu/intrepid', 'ubuntu:intrepid', package='intrepid')
 
563
 
 
564
    def test_missing_ubuntu_distroseries_with_project(self):
 
565
        # Launchpad does not hold source packages for Intrepid.  Missing or
 
566
        # bogus distroseries with a project name is treated like an unknown
 
567
        # series (i.e. we keep it verbatim).
 
568
        self.assertURL('ubuntu/intrepid/foo',
 
569
                       'ubuntu:intrepid/foo', series='intrepid')
 
570
 
 
571
    def test_missing_debian_distroseries(self):
 
572
        # Launchpad does not hold source packages for unstable.  Missing or
 
573
        # bogus distroseries is treated like a project.
 
574
        self.assertURL('debian/sid',
 
575
                       'debianlp:sid', package='sid', distro='debian')
 
576
 
 
577
    # Ubuntu Default distro series.
 
578
 
 
579
    def test_ubuntu_default_distroseries_expansion(self):
 
580
        self.assertURL('ubuntu/foo', 'ubuntu:foo')
 
581
 
 
582
    def test_ubuntu_natty_distroseries_expansion(self):
 
583
        self.assertURL('ubuntu/natty/foo', 'ubuntu:natty/foo', series='natty')
 
584
 
 
585
    def test_ubuntu_n_distroseries_expansion(self):
 
586
        self.assertURL('ubuntu/natty/foo', 'ubuntu:n/foo', series='natty')
 
587
 
 
588
    def test_ubuntu_maverick_distroseries_expansion(self):
 
589
        self.assertURL('ubuntu/maverick/foo', 'ubuntu:maverick/foo',
 
590
                       series='maverick')
 
591
 
 
592
    def test_ubuntu_m_distroseries_expansion(self):
 
593
        self.assertURL('ubuntu/maverick/foo', 'ubuntu:m/foo', series='maverick')
 
594
 
 
595
    def test_ubuntu_lucid_distroseries_expansion(self):
 
596
        self.assertURL('ubuntu/lucid/foo', 'ubuntu:lucid/foo', series='lucid')
 
597
 
 
598
    def test_ubuntu_l_distroseries_expansion(self):
 
599
        self.assertURL('ubuntu/lucid/foo', 'ubuntu:l/foo', series='lucid')
 
600
 
 
601
    def test_ubuntu_karmic_distroseries_expansion(self):
 
602
        self.assertURL('ubuntu/karmic/foo', 'ubuntu:karmic/foo',
 
603
                       series='karmic')
 
604
 
 
605
    def test_ubuntu_k_distroseries_expansion(self):
 
606
        self.assertURL('ubuntu/karmic/foo', 'ubuntu:k/foo', series='karmic')
 
607
 
 
608
    def test_ubuntu_jaunty_distroseries_expansion(self):
 
609
        self.assertURL('ubuntu/jaunty/foo', 'ubuntu:jaunty/foo',
 
610
                       series='jaunty')
 
611
 
 
612
    def test_ubuntu_j_distroseries_expansion(self):
 
613
        self.assertURL('ubuntu/jaunty/foo', 'ubuntu:j/foo', series='jaunty')
 
614
 
 
615
    def test_ubuntu_hardy_distroseries_expansion(self):
 
616
        self.assertURL('ubuntu/hardy/foo', 'ubuntu:hardy/foo', series='hardy')
 
617
 
 
618
    def test_ubuntu_h_distroseries_expansion(self):
 
619
        self.assertURL('ubuntu/hardy/foo', 'ubuntu:h/foo', series='hardy')
 
620
 
 
621
    def test_ubuntu_dapper_distroseries_expansion(self):
 
622
        self.assertURL('ubuntu/dapper/foo', 'ubuntu:dapper/foo',
 
623
                       series='dapper')
 
624
 
 
625
    def test_ubuntu_d_distroseries_expansion(self):
 
626
        self.assertURL('ubuntu/dapper/foo', 'ubuntu:d/foo', series='dapper')
 
627
 
 
628
    # Debian default distro series.
 
629
 
 
630
    def test_debian_default_distroseries_expansion(self):
 
631
        self.assertURL('debian/foo', 'debianlp:foo', distro='debian')
 
632
 
 
633
    def test_debian_squeeze_distroseries_expansion(self):
 
634
        self.assertURL('debian/squeeze/foo', 'debianlp:squeeze/foo',
 
635
                       distro='debian', series='squeeze')
 
636
 
 
637
    def test_debian_lenny_distroseries_expansion(self):
 
638
        self.assertURL('debian/lenny/foo', 'debianlp:lenny/foo',
 
639
                       distro='debian', series='lenny')