/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar
6614.1.3 by Vincent Ladeuil
Fix assertEquals being deprecated by using assertEqual.
1
# Copyright (C) 2007-2012, 2016 Canonical Ltd
2245.8.1 by Martin Pool
Start adding tests for launchpad indirection
2
#
3
# This program is free software; you can redistribute it and/or modify
4
# it under the terms of the GNU General Public License as published by
5
# the Free Software Foundation; either version 2 of the License, or
6
# (at your option) any later version.
7
#
8
# This program is distributed in the hope that it will be useful,
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
# GNU General Public License for more details.
12
#
13
# You should have received a copy of the GNU General Public License
14
# along with this program; if not, write to the Free Software
4183.7.1 by Sabin Iacob
update FSF mailing address
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
2245.8.1 by Martin Pool
Start adding tests for launchpad indirection
16
3251.4.3 by Aaron Bentley
More renames and cleanups
17
"""Tests for directory lookup through Launchpad.net"""
2245.8.1 by Martin Pool
Start adding tests for launchpad indirection
18
4776.2.2 by Vincent Ladeuil
Start testing the XMLRPC transport re-implemented on top of _urllib2_wrappers.
19
import os
6973.12.9 by Jelmer Vernooij
More fixes.
20
21
try:
7045.5.6 by Jelmer Vernooij
Fix launchpad tests.
22
    from xmlrpc.client import Fault
7045.5.4 by Jelmer Vernooij
Fix a few more tests.
23
    from http.client import parse_headers
6973.12.9 by Jelmer Vernooij
More fixes.
24
except ImportError:  # python < 3
7045.5.6 by Jelmer Vernooij
Fix launchpad tests.
25
    from xmlrpclib import Fault
2898.4.4 by James Henstridge
Changes to account for modifications to the XMLRPC API.
26
6622.1.34 by Jelmer Vernooij
Rename brzlib => breezy.
27
import breezy
6624 by Jelmer Vernooij
Merge Python3 porting work ('py3 pokes')
28
from ... import (
5609.24.11 by John Arbash Meinel
If someone uses -Dlaunchpad, use the 'official' URL instead of the local one.
29
    debug,
2245.8.4 by Martin Pool
lp:/// indirection works
30
    errors,
4776.2.2 by Vincent Ladeuil
Start testing the XMLRPC transport re-implemented on top of _urllib2_wrappers.
31
    tests,
5273.1.7 by Vincent Ladeuil
No more use of the get_transport imported *symbol*, all uses are through
32
    transport,
2245.8.3 by Martin Pool
Start adding indirection transport
33
    )
6624 by Jelmer Vernooij
Merge Python3 porting work ('py3 pokes')
34
from ...branch import Branch
35
from ...directory_service import directories
7045.5.4 by Jelmer Vernooij
Fix a few more tests.
36
from ...sixish import PY3
6624 by Jelmer Vernooij
Merge Python3 porting work ('py3 pokes')
37
from ...tests import (
5967.12.5 by Martin Pool
Update launchpad plugin for features under tests.features
38
    features,
6238.2.24 by Vincent Ladeuil
Fix the last test failure by providing the test ca certs via the config option framework.
39
    ssl_certs,
3777.1.18 by Aaron Bentley
Fix None handling wrt auth upgrades
40
    TestCaseInTempDir,
41
    TestCaseWithMemoryTransport
42
)
6624 by Jelmer Vernooij
Merge Python3 porting work ('py3 pokes')
43
from . import (
4776.2.2 by Vincent Ladeuil
Start testing the XMLRPC transport re-implemented on top of _urllib2_wrappers.
44
    _register_directory,
45
    lp_registration,
46
    )
6624 by Jelmer Vernooij
Merge Python3 porting work ('py3 pokes')
47
from .lp_directory import (
3251.4.1 by Aaron Bentley
Convert LP transport into directory service
48
    LaunchpadDirectory)
6624 by Jelmer Vernooij
Merge Python3 porting work ('py3 pokes')
49
from .account import get_lp_login, set_lp_login
50
from ...tests import http_server
4776.2.2 by Vincent Ladeuil
Start testing the XMLRPC transport re-implemented on top of _urllib2_wrappers.
51
52
6625.1.5 by Martin
Drop custom load_tests implementation and use unittest signature
53
def load_tests(loader, standard_tests, pattern):
4776.2.2 by Vincent Ladeuil
Start testing the XMLRPC transport re-implemented on top of _urllib2_wrappers.
54
    result = loader.suiteClass()
55
    t_tests, remaining_tests = tests.split_suite_by_condition(
56
        standard_tests, tests.condition_isinstance((
4776.2.6 by Vincent Ladeuil
Fixed as per review comments.
57
                TestXMLRPCTransport,
4776.2.2 by Vincent Ladeuil
Start testing the XMLRPC transport re-implemented on top of _urllib2_wrappers.
58
                )))
59
    transport_scenarios = [
60
        ('http', dict(server_class=PreCannedHTTPServer,)),
61
        ]
5967.12.5 by Martin Pool
Update launchpad plugin for features under tests.features
62
    if features.HTTPSServerFeature.available():
4776.2.2 by Vincent Ladeuil
Start testing the XMLRPC transport re-implemented on top of _urllib2_wrappers.
63
        transport_scenarios.append(
64
            ('https', dict(server_class=PreCannedHTTPSServer,)),
65
            )
66
    tests.multiply_tests(t_tests, transport_scenarios, result)
67
68
    # No parametrization for the remaining tests
69
    result.addTests(remaining_tests)
70
71
    return result
2898.4.3 by James Henstridge
Make launchpad_transport_indirect() use XMLRPC to resolve the lp: URL.
72
73
74
class FakeResolveFactory(object):
5609.24.9 by John Arbash Meinel
A bunch more tests and bug fixes for the local resolution.
75
2898.4.3 by James Henstridge
Make launchpad_transport_indirect() use XMLRPC to resolve the lp: URL.
76
    def __init__(self, test, expected_path, result):
77
        self._test = test
78
        self._expected_path = expected_path
79
        self._result = result
5609.24.9 by John Arbash Meinel
A bunch more tests and bug fixes for the local resolution.
80
        self._submitted = False
2898.4.3 by James Henstridge
Make launchpad_transport_indirect() use XMLRPC to resolve the lp: URL.
81
82
    def __call__(self, path):
83
        self._test.assertEqual(self._expected_path, path)
84
        return self
85
86
    def submit(self, service):
3193.5.2 by Tim Penhey
Updated the tests to handle unknown launchpad instances.
87
        self._service_url = service.service_url
5609.24.9 by John Arbash Meinel
A bunch more tests and bug fixes for the local resolution.
88
        self._submitted = True
2898.4.3 by James Henstridge
Make launchpad_transport_indirect() use XMLRPC to resolve the lp: URL.
89
        return self._result
2245.8.1 by Martin Pool
Start adding tests for launchpad indirection
90
2245.8.7 by Martin Pool
small review cleanups
91
5609.24.9 by John Arbash Meinel
A bunch more tests and bug fixes for the local resolution.
92
class LocalDirectoryURLTests(TestCaseInTempDir):
93
    """Tests for branch urls that we try to pass through local resolution."""
94
95
    def assertResolve(self, expected, url, submitted=False):
96
        path = url[url.index(':')+1:].lstrip('/')
97
        factory = FakeResolveFactory(self, path,
98
                    dict(urls=['bzr+ssh://fake-resolved']))
99
        directory = LaunchpadDirectory()
100
        self.assertEqual(expected,
101
            directory._resolve(url, factory, _lp_login='user'))
102
        # We are testing local resolution, and the fallback when necessary.
103
        self.assertEqual(submitted, factory._submitted)
104
105
    def test_short_form(self):
106
        self.assertResolve('bzr+ssh://bazaar.launchpad.net/+branch/apt',
107
                           'lp:apt')
108
109
    def test_two_part_form(self):
110
        self.assertResolve('bzr+ssh://bazaar.launchpad.net/+branch/apt/2.2',
111
                           'lp:apt/2.2')
112
113
    def test_two_part_plus_subdir(self):
114
        # We allow you to pass more than just what resolves. That way you can
6622.1.30 by Jelmer Vernooij
Some more test fixes.
115
        # do things like "brz log lp:apt/2.2/BUGS"
5609.24.9 by John Arbash Meinel
A bunch more tests and bug fixes for the local resolution.
116
        # Though the virtual FS implementation currently aborts when given a
117
        # URL like this, rather than letting you recurse upwards to find the
118
        # real branch at lp:apt/2.2
119
        self.assertResolve('bzr+ssh://bazaar.launchpad.net/+branch/apt/2.2/BUGS',
120
                           'lp:apt/2.2/BUGS')
121
122
    def test_user_expansion(self):
123
        self.assertResolve('bzr+ssh://bazaar.launchpad.net/~user/apt/foo',
124
                           'lp:~/apt/foo')
125
126
    def test_ubuntu(self):
127
        # Confirmed against xmlrpc. If you don't have a ~user, xmlrpc doesn't
128
        # care that you are asking for 'ubuntu'
129
        self.assertResolve('bzr+ssh://bazaar.launchpad.net/+branch/ubuntu',
130
                           'lp:ubuntu')
131
6191.2.1 by Martin Pool
Avoid NameError when given an invalid ubuntu: launchpad url
132
    def test_ubuntu_invalid(self):
133
        """Invalid ubuntu urls don't crash.
134
135
        :seealso: http://pad.lv/843900
136
        """
137
        # This ought to be natty-updates.
6729.6.1 by Jelmer Vernooij
Move urlutils errors.
138
        self.assertRaises(lp_registration.InvalidURL,
6191.2.1 by Martin Pool
Avoid NameError when given an invalid ubuntu: launchpad url
139
            self.assertResolve,
140
            '',
141
            'ubuntu:natty/updates/smartpm')
142
5609.24.9 by John Arbash Meinel
A bunch more tests and bug fixes for the local resolution.
143
    def test_ubuntu_apt(self):
144
        self.assertResolve('bzr+ssh://bazaar.launchpad.net/+branch/ubuntu/apt',
145
                           'lp:ubuntu/apt')
146
147
    def test_ubuntu_natty_apt(self):
148
        self.assertResolve(
149
            'bzr+ssh://bazaar.launchpad.net/+branch/ubuntu/natty/apt',
150
            'lp:ubuntu/natty/apt')
151
152
    def test_ubuntu_natty_apt_filename(self):
153
        self.assertResolve(
154
            'bzr+ssh://bazaar.launchpad.net/+branch/ubuntu/natty/apt/filename',
155
            'lp:ubuntu/natty/apt/filename')
156
157
    def test_user_two_part(self):
158
        # We fall back to the ResolveFactory. The real Launchpad one will raise
159
        # InvalidURL for this case.
160
        self.assertResolve('bzr+ssh://fake-resolved', 'lp:~jameinel/apt',
161
                           submitted=True)
162
163
    def test_user_three_part(self):
164
        self.assertResolve('bzr+ssh://bazaar.launchpad.net/~jameinel/apt/foo',
165
                           'lp:~jameinel/apt/foo')
166
167
    def test_user_three_part_plus_filename(self):
168
        self.assertResolve(
169
            'bzr+ssh://bazaar.launchpad.net/~jameinel/apt/foo/fname',
170
            'lp:~jameinel/apt/foo/fname')
171
172
    def test_user_ubuntu_two_part(self):
173
        self.assertResolve('bzr+ssh://fake-resolved', 'lp:~jameinel/ubuntu',
174
                           submitted=True)
175
        self.assertResolve('bzr+ssh://fake-resolved', 'lp:~jameinel/debian',
176
                           submitted=True)
177
178
    def test_user_ubuntu_three_part(self):
179
        self.assertResolve('bzr+ssh://fake-resolved',
180
                           'lp:~jameinel/ubuntu/natty', submitted=True)
181
        self.assertResolve('bzr+ssh://fake-resolved',
182
                           'lp:~jameinel/debian/sid', submitted=True)
183
184
    def test_user_ubuntu_four_part(self):
185
        self.assertResolve('bzr+ssh://fake-resolved',
186
                           'lp:~jameinel/ubuntu/natty/project', submitted=True)
187
        self.assertResolve('bzr+ssh://fake-resolved',
188
                           'lp:~jameinel/debian/sid/project', submitted=True)
189
190
    def test_user_ubuntu_five_part(self):
191
        self.assertResolve(
192
            'bzr+ssh://bazaar.launchpad.net/~jameinel/ubuntu/natty/apt/branch',
193
            'lp:~jameinel/ubuntu/natty/apt/branch')
194
        self.assertResolve(
195
            'bzr+ssh://bazaar.launchpad.net/~jameinel/debian/sid/apt/branch',
196
            'lp:~jameinel/debian/sid/apt/branch')
197
198
    def test_user_ubuntu_five_part_plus_subdir(self):
199
        self.assertResolve(
200
            'bzr+ssh://bazaar.launchpad.net/~jameinel/ubuntu/natty/apt/branch/f',
201
            'lp:~jameinel/ubuntu/natty/apt/branch/f')
202
        self.assertResolve(
203
            'bzr+ssh://bazaar.launchpad.net/~jameinel/debian/sid/apt/branch/f',
204
            'lp:~jameinel/debian/sid/apt/branch/f')
205
206
    def test_handles_special_lp(self):
207
        self.assertResolve('bzr+ssh://bazaar.launchpad.net/+branch/apt', 'lp:apt')
208
        self.assertResolve('bzr+ssh://bazaar.launchpad.net/+branch/apt',
209
                           'lp:///apt')
210
        self.assertResolve('bzr+ssh://bazaar.launchpad.net/+branch/apt',
211
                           'lp://production/apt')
212
        self.assertResolve('bzr+ssh://bazaar.launchpad.dev/+branch/apt',
213
                           'lp://dev/apt')
214
        self.assertResolve('bzr+ssh://bazaar.staging.launchpad.net/+branch/apt',
215
                           'lp://staging/apt')
216
        self.assertResolve('bzr+ssh://bazaar.qastaging.launchpad.net/+branch/apt',
217
                           'lp://qastaging/apt')
218
        self.assertResolve('bzr+ssh://bazaar.demo.launchpad.net/+branch/apt',
219
                           'lp://demo/apt')
220
5609.24.11 by John Arbash Meinel
If someone uses -Dlaunchpad, use the 'official' URL instead of the local one.
221
    def test_debug_launchpad_uses_resolver(self):
222
        self.assertResolve('bzr+ssh://bazaar.launchpad.net/+branch/bzr',
223
                           'lp:bzr', submitted=False)
224
        debug.debug_flags.add('launchpad')
225
        self.addCleanup(debug.debug_flags.discard, 'launchpad')
226
        self.assertResolve('bzr+ssh://fake-resolved', 'lp:bzr', submitted=True)
5609.24.9 by John Arbash Meinel
A bunch more tests and bug fixes for the local resolution.
227
228
3777.1.18 by Aaron Bentley
Fix None handling wrt auth upgrades
229
class DirectoryUrlTests(TestCaseInTempDir):
3251.4.3 by Aaron Bentley
More renames and cleanups
230
    """Tests for branch urls through Launchpad.net directory"""
2245.8.1 by Martin Pool
Start adding tests for launchpad indirection
231
2245.8.5 by Martin Pool
Add short-form lp:PRODUCT url form
232
    def test_short_form(self):
233
        """A launchpad url should map to a http url"""
2898.4.3 by James Henstridge
Make launchpad_transport_indirect() use XMLRPC to resolve the lp: URL.
234
        factory = FakeResolveFactory(
2898.4.4 by James Henstridge
Changes to account for modifications to the XMLRPC API.
235
            self, 'apt', dict(urls=[
236
                    'http://bazaar.launchpad.net/~apt/apt/devel']))
3251.4.1 by Aaron Bentley
Convert LP transport into directory service
237
        directory = LaunchpadDirectory()
6614.1.3 by Vincent Ladeuil
Fix assertEquals being deprecated by using assertEqual.
238
        self.assertEqual('http://bazaar.launchpad.net/~apt/apt/devel',
3251.4.1 by Aaron Bentley
Convert LP transport into directory service
239
                          directory._resolve('lp:apt', factory))
3193.5.2 by Tim Penhey
Updated the tests to handle unknown launchpad instances.
240
        # Make sure that resolve went to the production server.
6614.1.3 by Vincent Ladeuil
Fix assertEquals being deprecated by using assertEqual.
241
        self.assertEqual('https://xmlrpc.launchpad.net/bazaar/',
3193.5.2 by Tim Penhey
Updated the tests to handle unknown launchpad instances.
242
                          factory._service_url)
243
5615.2.1 by Jelmer Vernooij
Support the 'qastaging' instance of Launchpad.
244
    def test_qastaging(self):
245
        """A launchpad url should map to a http url"""
246
        factory = FakeResolveFactory(
247
            self, 'apt', dict(urls=[
248
                    'http://bazaar.qastaging.launchpad.net/~apt/apt/devel']))
249
        url = 'lp://qastaging/apt'
250
        directory = LaunchpadDirectory()
6614.1.3 by Vincent Ladeuil
Fix assertEquals being deprecated by using assertEqual.
251
        self.assertEqual('http://bazaar.qastaging.launchpad.net/~apt/apt/devel',
5615.2.1 by Jelmer Vernooij
Support the 'qastaging' instance of Launchpad.
252
                          directory._resolve(url, factory))
253
        # Make sure that resolve went to the qastaging server.
6614.1.3 by Vincent Ladeuil
Fix assertEquals being deprecated by using assertEqual.
254
        self.assertEqual('https://xmlrpc.qastaging.launchpad.net/bazaar/',
5615.2.1 by Jelmer Vernooij
Support the 'qastaging' instance of Launchpad.
255
                          factory._service_url)
256
3193.5.2 by Tim Penhey
Updated the tests to handle unknown launchpad instances.
257
    def test_staging(self):
258
        """A launchpad url should map to a http url"""
259
        factory = FakeResolveFactory(
260
            self, 'apt', dict(urls=[
261
                    'http://bazaar.staging.launchpad.net/~apt/apt/devel']))
262
        url = 'lp://staging/apt'
3251.4.1 by Aaron Bentley
Convert LP transport into directory service
263
        directory = LaunchpadDirectory()
6614.1.3 by Vincent Ladeuil
Fix assertEquals being deprecated by using assertEqual.
264
        self.assertEqual('http://bazaar.staging.launchpad.net/~apt/apt/devel',
3251.4.1 by Aaron Bentley
Convert LP transport into directory service
265
                          directory._resolve(url, factory))
3193.5.2 by Tim Penhey
Updated the tests to handle unknown launchpad instances.
266
        # Make sure that resolve went to the staging server.
6614.1.3 by Vincent Ladeuil
Fix assertEquals being deprecated by using assertEqual.
267
        self.assertEqual('https://xmlrpc.staging.launchpad.net/bazaar/',
3193.5.2 by Tim Penhey
Updated the tests to handle unknown launchpad instances.
268
                          factory._service_url)
2245.8.5 by Martin Pool
Add short-form lp:PRODUCT url form
269
3251.4.3 by Aaron Bentley
More renames and cleanups
270
    def test_url_from_directory(self):
2245.8.3 by Martin Pool
Start adding indirection transport
271
        """A launchpad url should map to a http url"""
2898.4.3 by James Henstridge
Make launchpad_transport_indirect() use XMLRPC to resolve the lp: URL.
272
        factory = FakeResolveFactory(
2898.4.4 by James Henstridge
Changes to account for modifications to the XMLRPC API.
273
            self, 'apt', dict(urls=[
274
                    'http://bazaar.launchpad.net/~apt/apt/devel']))
3251.4.1 by Aaron Bentley
Convert LP transport into directory service
275
        directory = LaunchpadDirectory()
6614.1.3 by Vincent Ladeuil
Fix assertEquals being deprecated by using assertEqual.
276
        self.assertEqual('http://bazaar.launchpad.net/~apt/apt/devel',
3251.4.1 by Aaron Bentley
Convert LP transport into directory service
277
                          directory._resolve('lp:///apt', factory))
2898.4.3 by James Henstridge
Make launchpad_transport_indirect() use XMLRPC to resolve the lp: URL.
278
3251.4.3 by Aaron Bentley
More renames and cleanups
279
    def test_directory_skip_bad_schemes(self):
2898.4.9 by James Henstridge
Add some more tests for the bzr+ssh://bazaar.launchpad.net URL
280
        factory = FakeResolveFactory(
281
            self, 'apt', dict(urls=[
282
                    'bad-scheme://bazaar.launchpad.net/~apt/apt/devel',
283
                    'http://bazaar.launchpad.net/~apt/apt/devel',
284
                    'http://another/location']))
3251.4.1 by Aaron Bentley
Convert LP transport into directory service
285
        directory = LaunchpadDirectory()
6614.1.3 by Vincent Ladeuil
Fix assertEquals being deprecated by using assertEqual.
286
        self.assertEqual('http://bazaar.launchpad.net/~apt/apt/devel',
3251.4.1 by Aaron Bentley
Convert LP transport into directory service
287
                          directory._resolve('lp:///apt', factory))
2898.4.9 by James Henstridge
Add some more tests for the bzr+ssh://bazaar.launchpad.net URL
288
3251.4.3 by Aaron Bentley
More renames and cleanups
289
    def test_directory_no_matching_schemes(self):
2898.4.3 by James Henstridge
Make launchpad_transport_indirect() use XMLRPC to resolve the lp: URL.
290
        # If the XMLRPC call does not return any protocols we support,
291
        # invalidURL is raised.
292
        factory = FakeResolveFactory(
2898.4.4 by James Henstridge
Changes to account for modifications to the XMLRPC API.
293
            self, 'apt', dict(urls=[
294
                    'bad-scheme://bazaar.launchpad.net/~apt/apt/devel']))
3251.4.1 by Aaron Bentley
Convert LP transport into directory service
295
        directory = LaunchpadDirectory()
6729.6.1 by Jelmer Vernooij
Move urlutils errors.
296
        self.assertRaises(lp_registration.InvalidURL,
3251.4.1 by Aaron Bentley
Convert LP transport into directory service
297
                          directory._resolve, 'lp:///apt', factory)
2898.4.4 by James Henstridge
Changes to account for modifications to the XMLRPC API.
298
3251.4.3 by Aaron Bentley
More renames and cleanups
299
    def test_directory_fault(self):
2898.4.4 by James Henstridge
Changes to account for modifications to the XMLRPC API.
300
        # Test that XMLRPC faults get converted to InvalidURL errors.
301
        factory = FakeResolveFactory(self, 'apt', None)
302
        def submit(service):
6973.12.9 by Jelmer Vernooij
More fixes.
303
            raise Fault(42, 'something went wrong')
2898.4.4 by James Henstridge
Changes to account for modifications to the XMLRPC API.
304
        factory.submit = submit
3251.4.1 by Aaron Bentley
Convert LP transport into directory service
305
        directory = LaunchpadDirectory()
6729.6.1 by Jelmer Vernooij
Move urlutils errors.
306
        self.assertRaises(lp_registration.InvalidURL,
3251.4.1 by Aaron Bentley
Convert LP transport into directory service
307
                          directory._resolve, 'lp:///apt', factory)
2245.8.4 by Martin Pool
lp:/// indirection works
308
2898.4.9 by James Henstridge
Add some more tests for the bzr+ssh://bazaar.launchpad.net URL
309
    def test_skip_bzr_ssh_launchpad_net_when_anonymous(self):
310
        # Test that bzr+ssh://bazaar.launchpad.net gets skipped if
311
        # Bazaar does not know the user's Launchpad ID:
312
        self.assertEqual(None, get_lp_login())
313
        factory = FakeResolveFactory(
314
            self, 'apt', dict(urls=[
315
                    'bzr+ssh://bazaar.launchpad.net/~apt/apt/devel',
316
                    'http://bazaar.launchpad.net/~apt/apt/devel']))
3251.4.1 by Aaron Bentley
Convert LP transport into directory service
317
        directory = LaunchpadDirectory()
6614.1.3 by Vincent Ladeuil
Fix assertEquals being deprecated by using assertEqual.
318
        self.assertEqual('http://bazaar.launchpad.net/~apt/apt/devel',
3251.4.1 by Aaron Bentley
Convert LP transport into directory service
319
                          directory._resolve('lp:///apt', factory))
2898.4.9 by James Henstridge
Add some more tests for the bzr+ssh://bazaar.launchpad.net URL
320
3031.2.2 by jml at canonical
Failing test for skipping SFTP.
321
    def test_skip_sftp_launchpad_net_when_anonymous(self):
322
        # Test that sftp://bazaar.launchpad.net gets skipped if
323
        # Bazaar does not know the user's Launchpad ID:
324
        self.assertEqual(None, get_lp_login())
325
        factory = FakeResolveFactory(
326
            self, 'apt', dict(urls=[
327
                    'sftp://bazaar.launchpad.net/~apt/apt/devel',
328
                    'http://bazaar.launchpad.net/~apt/apt/devel']))
3251.4.1 by Aaron Bentley
Convert LP transport into directory service
329
        directory = LaunchpadDirectory()
6614.1.3 by Vincent Ladeuil
Fix assertEquals being deprecated by using assertEqual.
330
        self.assertEqual('http://bazaar.launchpad.net/~apt/apt/devel',
3251.4.1 by Aaron Bentley
Convert LP transport into directory service
331
                          directory._resolve('lp:///apt', factory))
3031.2.2 by jml at canonical
Failing test for skipping SFTP.
332
5609.24.8 by John Arbash Meinel
Fix the launchpad-login tests. And fix a bad commit typo.
333
    def test_with_login_avoid_resolve_factory(self):
2898.4.9 by James Henstridge
Add some more tests for the bzr+ssh://bazaar.launchpad.net URL
334
        # Test that bzr+ssh URLs get rewritten to include the user's
335
        # Launchpad ID (assuming we know the Launchpad ID).
336
        factory = FakeResolveFactory(
337
            self, 'apt', dict(urls=[
5609.24.8 by John Arbash Meinel
Fix the launchpad-login tests. And fix a bad commit typo.
338
                    'bzr+ssh://my-super-custom/special/devel',
2898.4.9 by James Henstridge
Add some more tests for the bzr+ssh://bazaar.launchpad.net URL
339
                    'http://bazaar.launchpad.net/~apt/apt/devel']))
3251.4.1 by Aaron Bentley
Convert LP transport into directory service
340
        directory = LaunchpadDirectory()
6614.1.3 by Vincent Ladeuil
Fix assertEquals being deprecated by using assertEqual.
341
        self.assertEqual(
5609.24.8 by John Arbash Meinel
Fix the launchpad-login tests. And fix a bad commit typo.
342
            'bzr+ssh://bazaar.launchpad.net/+branch/apt',
3251.4.1 by Aaron Bentley
Convert LP transport into directory service
343
            directory._resolve('lp:///apt', factory, _lp_login='username'))
2898.4.9 by James Henstridge
Add some more tests for the bzr+ssh://bazaar.launchpad.net URL
344
345
    def test_no_rewrite_of_other_bzr_ssh(self):
3943.8.1 by Marius Kruger
remove all trailing whitespace from bzr source
346
        # Test that we don't rewrite bzr+ssh URLs for other
2898.4.9 by James Henstridge
Add some more tests for the bzr+ssh://bazaar.launchpad.net URL
347
        self.assertEqual(None, get_lp_login())
348
        factory = FakeResolveFactory(
349
            self, 'apt', dict(urls=[
350
                    'bzr+ssh://example.com/~apt/apt/devel',
351
                    'http://bazaar.launchpad.net/~apt/apt/devel']))
3251.4.1 by Aaron Bentley
Convert LP transport into directory service
352
        directory = LaunchpadDirectory()
6614.1.3 by Vincent Ladeuil
Fix assertEquals being deprecated by using assertEqual.
353
        self.assertEqual('bzr+ssh://example.com/~apt/apt/devel',
3251.4.1 by Aaron Bentley
Convert LP transport into directory service
354
                          directory._resolve('lp:///apt', factory))
2898.4.9 by James Henstridge
Add some more tests for the bzr+ssh://bazaar.launchpad.net URL
355
2245.8.4 by Martin Pool
lp:/// indirection works
356
    # TODO: check we get an error if the url is unreasonable
3251.4.3 by Aaron Bentley
More renames and cleanups
357
    def test_error_for_bad_url(self):
3251.4.1 by Aaron Bentley
Convert LP transport into directory service
358
        directory = LaunchpadDirectory()
6729.6.1 by Jelmer Vernooij
Move urlutils errors.
359
        self.assertRaises(lp_registration.InvalidURL,
3251.4.1 by Aaron Bentley
Convert LP transport into directory service
360
            directory._resolve, 'lp://ratotehunoahu')
2898.4.12 by James Henstridge
Add tests that redirects get issued by appropriate transport methods.
361
5361.1.1 by John Arbash Meinel
Handle a simple ~ in lp: urls.
362
    def test_resolve_tilde_to_user(self):
363
        factory = FakeResolveFactory(
364
            self, '~username/apt/test', dict(urls=[
5609.24.9 by John Arbash Meinel
A bunch more tests and bug fixes for the local resolution.
365
                'bzr+ssh://bazaar.launchpad.net/~username/apt/test']))
5361.1.1 by John Arbash Meinel
Handle a simple ~ in lp: urls.
366
        directory = LaunchpadDirectory()
6614.1.3 by Vincent Ladeuil
Fix assertEquals being deprecated by using assertEqual.
367
        self.assertEqual(
5609.24.9 by John Arbash Meinel
A bunch more tests and bug fixes for the local resolution.
368
            'bzr+ssh://bazaar.launchpad.net/~username/apt/test',
5361.1.1 by John Arbash Meinel
Handle a simple ~ in lp: urls.
369
            directory._resolve('lp:~/apt/test', factory, _lp_login='username'))
370
        # Should also happen when the login is just set by config
371
        set_lp_login('username')
6614.1.3 by Vincent Ladeuil
Fix assertEquals being deprecated by using assertEqual.
372
        self.assertEqual(
5609.24.9 by John Arbash Meinel
A bunch more tests and bug fixes for the local resolution.
373
            'bzr+ssh://bazaar.launchpad.net/~username/apt/test',
5361.1.1 by John Arbash Meinel
Handle a simple ~ in lp: urls.
374
            directory._resolve('lp:~/apt/test', factory))
375
376
    def test_tilde_fails_no_login(self):
377
        factory = FakeResolveFactory(
378
            self, '~username/apt/test', dict(urls=[
379
                    'bzr+ssh://bazaar.launchpad.net/~username/apt/test']))
380
        self.assertIs(None, get_lp_login())
381
        directory = LaunchpadDirectory()
6729.6.1 by Jelmer Vernooij
Move urlutils errors.
382
        self.assertRaises(lp_registration.InvalidURL,
5462.4.3 by Barry Warsaw
* Add back Ubuntu distroseries shortcuts.
383
                          directory._resolve, 'lp:~/apt/test', factory)
5361.1.1 by John Arbash Meinel
Handle a simple ~ in lp: urls.
384
2898.4.17 by James Henstridge
Add a test that the redirect actually occurs when opening an lp: URL.
385
3251.4.3 by Aaron Bentley
More renames and cleanups
386
class DirectoryOpenBranchTests(TestCaseWithMemoryTransport):
2898.4.17 by James Henstridge
Add a test that the redirect actually occurs when opening an lp: URL.
387
3251.4.3 by Aaron Bentley
More renames and cleanups
388
    def test_directory_open_branch(self):
2898.4.17 by James Henstridge
Add a test that the redirect actually occurs when opening an lp: URL.
389
        # Test that opening an lp: branch redirects to the real location.
390
        target_branch = self.make_branch('target')
3251.4.1 by Aaron Bentley
Convert LP transport into directory service
391
        class FooService(object):
392
            """A directory service that maps the name to a FILE url"""
393
394
            def look_up(self, name, url):
395
                if 'lp:///apt' == url:
396
                    return target_branch.base.rstrip('/')
3251.4.2 by Aaron Bentley
Clean up Launchpad directory service code
397
                return '!unexpected look_up value!'
3251.4.1 by Aaron Bentley
Convert LP transport into directory service
398
399
        directories.remove('lp:')
5462.4.1 by Barry Warsaw
Added support for ubuntu: and debianlp: schemes, accessing the relevant
400
        directories.remove('ubuntu:')
401
        directories.remove('debianlp:')
3251.4.1 by Aaron Bentley
Convert LP transport into directory service
402
        directories.register('lp:', FooService, 'Map lp URLs to local urls')
3251.4.2 by Aaron Bentley
Clean up Launchpad directory service code
403
        self.addCleanup(_register_directory)
4985.2.1 by Vincent Ladeuil
Deploy addAttrCleanup on the whole test suite.
404
        self.addCleanup(directories.remove, 'lp:')
5273.1.7 by Vincent Ladeuil
No more use of the get_transport imported *symbol*, all uses are through
405
        t = transport.get_transport('lp:///apt')
406
        branch = Branch.open_from_transport(t)
2898.4.17 by James Henstridge
Add a test that the redirect actually occurs when opening an lp: URL.
407
        self.assertEqual(target_branch.base, branch.base)
4776.2.2 by Vincent Ladeuil
Start testing the XMLRPC transport re-implemented on top of _urllib2_wrappers.
408
409
410
class PredefinedRequestHandler(http_server.TestingHTTPRequestHandler):
411
    """Request handler for a unique and pre-defined request.
412
413
    The only thing we care about here is that we receive a connection. But
414
    since we want to dialog with a real http client, we have to send it correct
415
    responses.
416
417
    We expect to receive a *single* request nothing more (and we won't even
418
    check what request it is), the tests will recognize us from our response.
419
    """
420
421
    def handle_one_request(self):
422
        tcs = self.server.test_case_server
423
        requestline = self.rfile.readline()
7045.5.4 by Jelmer Vernooij
Fix a few more tests.
424
        if PY3:
425
            parse_headers(self.rfile)
426
        else:
427
            self.MessageClass(self.rfile, 0)
428
        if requestline.startswith(b'POST'):
4776.2.2 by Vincent Ladeuil
Start testing the XMLRPC transport re-implemented on top of _urllib2_wrappers.
429
            # The body should be a single line (or we don't know where it ends
430
            # and we don't want to issue a blocking read)
5462.4.3 by Barry Warsaw
* Add back Ubuntu distroseries shortcuts.
431
            self.rfile.readline()
4776.2.2 by Vincent Ladeuil
Start testing the XMLRPC transport re-implemented on top of _urllib2_wrappers.
432
433
        self.wfile.write(tcs.canned_response)
434
4776.2.6 by Vincent Ladeuil
Fixed as per review comments.
435
4776.2.2 by Vincent Ladeuil
Start testing the XMLRPC transport re-implemented on top of _urllib2_wrappers.
436
class PreCannedServerMixin(object):
437
438
    def __init__(self):
439
        super(PreCannedServerMixin, self).__init__(
440
            request_handler=PredefinedRequestHandler)
441
        # Bytes read and written by the server
442
        self.bytes_read = 0
443
        self.bytes_written = 0
444
        self.canned_response = None
445
446
447
class PreCannedHTTPServer(PreCannedServerMixin, http_server.HttpServer):
448
    pass
449
450
5967.12.5 by Martin Pool
Update launchpad plugin for features under tests.features
451
if features.HTTPSServerFeature.available():
6624 by Jelmer Vernooij
Merge Python3 porting work ('py3 pokes')
452
    from ...tests import https_server
4776.2.2 by Vincent Ladeuil
Start testing the XMLRPC transport re-implemented on top of _urllib2_wrappers.
453
    class PreCannedHTTPSServer(PreCannedServerMixin, https_server.HTTPSServer):
454
        pass
455
456
4776.2.6 by Vincent Ladeuil
Fixed as per review comments.
457
class TestXMLRPCTransport(tests.TestCase):
4776.2.2 by Vincent Ladeuil
Start testing the XMLRPC transport re-implemented on top of _urllib2_wrappers.
458
459
    # set by load_tests
460
    server_class = None
461
462
    def setUp(self):
6552.1.3 by Vincent Ladeuil
Use super() instead of calling <base>.setup(self), as the original fix illustrated a too-easy-to-fall-into trap.
463
        super(TestXMLRPCTransport, self).setUp()
4776.2.2 by Vincent Ladeuil
Start testing the XMLRPC transport re-implemented on top of _urllib2_wrappers.
464
        self.server = self.server_class()
4934.3.3 by Martin Pool
Rename Server.setUp to Server.start_server
465
        self.server.start_server()
6238.2.24 by Vincent Ladeuil
Fix the last test failure by providing the test ca certs via the config option framework.
466
        self.addCleanup(self.server.stop_server)
4776.2.2 by Vincent Ladeuil
Start testing the XMLRPC transport re-implemented on top of _urllib2_wrappers.
467
        # Ensure we don't clobber env
6622.1.28 by Jelmer Vernooij
More renames; commands in output, environment variables.
468
        self.overrideEnv('BRZ_LP_XMLRPC_URL', None)
6238.2.24 by Vincent Ladeuil
Fix the last test failure by providing the test ca certs via the config option framework.
469
        # Ensure we use the right certificates for https.
470
        # FIXME: There should be a better way but the only alternative I can
471
        # think of involves carrying the ca_certs through the lp_registration
472
        # infrastructure to _urllib2_wrappers... -- vila 2012-01-20
6759.4.2 by Jelmer Vernooij
Use get_global_state>
473
        breezy.get_global_state().cmdline_overrides._from_cmdline(
6238.2.24 by Vincent Ladeuil
Fix the last test failure by providing the test ca certs via the config option framework.
474
            ['ssl.ca_certs=%s' % ssl_certs.build_path('ca.crt')])
4776.2.2 by Vincent Ladeuil
Start testing the XMLRPC transport re-implemented on top of _urllib2_wrappers.
475
476
    def set_canned_response(self, server, path):
7045.5.6 by Jelmer Vernooij
Fix launchpad tests.
477
        response_format = b'''HTTP/1.1 200 OK\r
4776.2.2 by Vincent Ladeuil
Start testing the XMLRPC transport re-implemented on top of _urllib2_wrappers.
478
Date: Tue, 11 Jul 2006 04:32:56 GMT\r
479
Server: Apache/2.0.54 (Fedora)\r
480
Last-Modified: Sun, 23 Apr 2006 19:35:20 GMT\r
481
ETag: "56691-23-38e9ae00"\r
482
Accept-Ranges: bytes\r
483
Content-Length: %(length)d\r
484
Connection: close\r
485
Content-Type: text/plain; charset=UTF-8\r
486
\r
487
<?xml version='1.0'?>
488
<methodResponse>
489
<params>
490
<param>
491
<value><struct>
492
<member>
493
<name>urls</name>
494
<value><array><data>
495
<value><string>bzr+ssh://bazaar.launchpad.net/%(path)s</string></value>
496
<value><string>http://bazaar.launchpad.net/%(path)s</string></value>
497
</data></array></value>
498
</member>
499
</struct></value>
500
</param>
501
</params>
502
</methodResponse>
503
'''
504
        length = 334 + 2 * len(path)
7045.5.6 by Jelmer Vernooij
Fix launchpad tests.
505
        server.canned_response = response_format % {
506
                b'length': length, b'path': path}
4776.2.2 by Vincent Ladeuil
Start testing the XMLRPC transport re-implemented on top of _urllib2_wrappers.
507
4776.2.3 by Vincent Ladeuil
Add NEWS entry.
508
    def do_request(self, server_url):
6622.1.28 by Jelmer Vernooij
More renames; commands in output, environment variables.
509
        os.environ['BRZ_LP_XMLRPC_URL'] = self.server.get_url()
4776.2.2 by Vincent Ladeuil
Start testing the XMLRPC transport re-implemented on top of _urllib2_wrappers.
510
        service = lp_registration.LaunchpadService()
511
        resolve = lp_registration.ResolveLaunchpadPathRequest('bzr')
512
        result = resolve.submit(service)
4776.2.3 by Vincent Ladeuil
Add NEWS entry.
513
        return result
514
515
    def test_direct_request(self):
7045.5.6 by Jelmer Vernooij
Fix launchpad tests.
516
        self.set_canned_response(self.server, b'~bzr-pqm/bzr/bzr.dev')
4776.2.3 by Vincent Ladeuil
Add NEWS entry.
517
        result = self.do_request(self.server.get_url())
4776.2.2 by Vincent Ladeuil
Start testing the XMLRPC transport re-implemented on top of _urllib2_wrappers.
518
        urls = result.get('urls', None)
519
        self.assertIsNot(None, urls)
6614.1.3 by Vincent Ladeuil
Fix assertEquals being deprecated by using assertEqual.
520
        self.assertEqual(
4776.2.2 by Vincent Ladeuil
Start testing the XMLRPC transport re-implemented on top of _urllib2_wrappers.
521
            ['bzr+ssh://bazaar.launchpad.net/~bzr-pqm/bzr/bzr.dev',
522
             'http://bazaar.launchpad.net/~bzr-pqm/bzr/bzr.dev'],
523
            urls)
4776.2.3 by Vincent Ladeuil
Add NEWS entry.
524
    # FIXME: we need to test with a real proxy, I can't find a way so simulate
525
    # CONNECT without leaving one server hanging the test :-/ Since that maybe
526
    # related to the leaking tests problems, I'll punt for now -- vila 20091030
5462.4.1 by Barry Warsaw
Added support for ubuntu: and debianlp: schemes, accessing the relevant
527
528
529
class TestDebuntuExpansions(TestCaseInTempDir):
530
    """Test expansions for ubuntu: and debianlp: schemes."""
531
532
    def setUp(self):
5558.1.1 by Vincent Ladeuil
Catch the fugitive TestDebuntuExpansions tests and bring them back in the isolation jail
533
        super(TestDebuntuExpansions, self).setUp()
5462.4.1 by Barry Warsaw
Added support for ubuntu: and debianlp: schemes, accessing the relevant
534
        self.directory = LaunchpadDirectory()
535
536
    def _make_factory(self, package='foo', distro='ubuntu', series=None):
537
        if series is None:
538
            path = '%s/%s' % (distro, package)
539
            url_suffix = '~branch/%s/%s' % (distro, package)
540
        else:
541
            path = '%s/%s/%s' % (distro, series, package)
542
            url_suffix = '~branch/%s/%s/%s' % (distro, series, package)
543
        return FakeResolveFactory(
544
            self, path, dict(urls=[
545
                'http://bazaar.launchpad.net/' + url_suffix]))
546
5462.4.6 by Vincent Ladeuil
Add helper to simplify tests
547
    def assertURL(self, expected_url, shortcut, package='foo', distro='ubuntu',
548
                  series=None):
549
        factory = self._make_factory(package=package, distro=distro,
550
                                     series=series)
551
        self.assertEqual('http://bazaar.launchpad.net/~branch/' + expected_url,
552
                         self.directory._resolve(shortcut, factory))
553
5462.4.1 by Barry Warsaw
Added support for ubuntu: and debianlp: schemes, accessing the relevant
554
    # Bogus distro.
555
556
    def test_bogus_distro(self):
6772.1.1 by Jelmer Vernooij
Stub out requests for three more Launchpad tests.
557
        factory = FakeResolveFactory(self, 'foo', dict(urls=[]))
6729.6.1 by Jelmer Vernooij
Move urlutils errors.
558
        self.assertRaises(lp_registration.InvalidURL,
6772.1.1 by Jelmer Vernooij
Stub out requests for three more Launchpad tests.
559
                          self.directory._resolve, 'gentoo:foo', factory)
5462.4.1 by Barry Warsaw
Added support for ubuntu: and debianlp: schemes, accessing the relevant
560
561
    def test_trick_bogus_distro_u(self):
6772.1.1 by Jelmer Vernooij
Stub out requests for three more Launchpad tests.
562
        factory = FakeResolveFactory(self, 'foo', dict(urls=[]))
6729.6.1 by Jelmer Vernooij
Move urlutils errors.
563
        self.assertRaises(lp_registration.InvalidURL,
6772.1.1 by Jelmer Vernooij
Stub out requests for three more Launchpad tests.
564
                          self.directory._resolve, 'utube:foo', factory)
5462.4.1 by Barry Warsaw
Added support for ubuntu: and debianlp: schemes, accessing the relevant
565
566
    def test_trick_bogus_distro_d(self):
6772.1.1 by Jelmer Vernooij
Stub out requests for three more Launchpad tests.
567
        factory = FakeResolveFactory(self, 'foo', dict(urls=[]))
6729.6.1 by Jelmer Vernooij
Move urlutils errors.
568
        self.assertRaises(lp_registration.InvalidURL,
6772.1.1 by Jelmer Vernooij
Stub out requests for three more Launchpad tests.
569
                          self.directory._resolve, 'debuntu:foo', factory)
5462.4.1 by Barry Warsaw
Added support for ubuntu: and debianlp: schemes, accessing the relevant
570
5462.4.3 by Barry Warsaw
* Add back Ubuntu distroseries shortcuts.
571
    def test_missing_ubuntu_distroseries_without_project(self):
5462.4.1 by Barry Warsaw
Added support for ubuntu: and debianlp: schemes, accessing the relevant
572
        # Launchpad does not hold source packages for Intrepid.  Missing or
5462.4.3 by Barry Warsaw
* Add back Ubuntu distroseries shortcuts.
573
        # bogus distroseries with no project name is treated like a project.
5462.4.6 by Vincent Ladeuil
Add helper to simplify tests
574
        self.assertURL('ubuntu/intrepid', 'ubuntu:intrepid', package='intrepid')
5462.4.1 by Barry Warsaw
Added support for ubuntu: and debianlp: schemes, accessing the relevant
575
5462.4.3 by Barry Warsaw
* Add back Ubuntu distroseries shortcuts.
576
    def test_missing_ubuntu_distroseries_with_project(self):
577
        # Launchpad does not hold source packages for Intrepid.  Missing or
578
        # bogus distroseries with a project name is treated like an unknown
579
        # series (i.e. we keep it verbatim).
5462.4.6 by Vincent Ladeuil
Add helper to simplify tests
580
        self.assertURL('ubuntu/intrepid/foo',
581
                       'ubuntu:intrepid/foo', series='intrepid')
5462.4.3 by Barry Warsaw
* Add back Ubuntu distroseries shortcuts.
582
5462.4.1 by Barry Warsaw
Added support for ubuntu: and debianlp: schemes, accessing the relevant
583
    def test_missing_debian_distroseries(self):
584
        # Launchpad does not hold source packages for unstable.  Missing or
585
        # bogus distroseries is treated like a project.
5462.4.6 by Vincent Ladeuil
Add helper to simplify tests
586
        self.assertURL('debian/sid',
587
                       'debianlp:sid', package='sid', distro='debian')
5462.4.1 by Barry Warsaw
Added support for ubuntu: and debianlp: schemes, accessing the relevant
588
589
    # Ubuntu Default distro series.
590
591
    def test_ubuntu_default_distroseries_expansion(self):
5462.4.6 by Vincent Ladeuil
Add helper to simplify tests
592
        self.assertURL('ubuntu/foo', 'ubuntu:foo')
5462.4.1 by Barry Warsaw
Added support for ubuntu: and debianlp: schemes, accessing the relevant
593
5462.4.2 by Barry Warsaw
Might as well support natty.
594
    def test_ubuntu_natty_distroseries_expansion(self):
5462.4.6 by Vincent Ladeuil
Add helper to simplify tests
595
        self.assertURL('ubuntu/natty/foo', 'ubuntu:natty/foo', series='natty')
5462.4.2 by Barry Warsaw
Might as well support natty.
596
5462.4.3 by Barry Warsaw
* Add back Ubuntu distroseries shortcuts.
597
    def test_ubuntu_n_distroseries_expansion(self):
5462.4.6 by Vincent Ladeuil
Add helper to simplify tests
598
        self.assertURL('ubuntu/natty/foo', 'ubuntu:n/foo', series='natty')
5462.4.3 by Barry Warsaw
* Add back Ubuntu distroseries shortcuts.
599
5462.4.1 by Barry Warsaw
Added support for ubuntu: and debianlp: schemes, accessing the relevant
600
    def test_ubuntu_maverick_distroseries_expansion(self):
5462.4.6 by Vincent Ladeuil
Add helper to simplify tests
601
        self.assertURL('ubuntu/maverick/foo', 'ubuntu:maverick/foo',
602
                       series='maverick')
5462.4.1 by Barry Warsaw
Added support for ubuntu: and debianlp: schemes, accessing the relevant
603
5462.4.3 by Barry Warsaw
* Add back Ubuntu distroseries shortcuts.
604
    def test_ubuntu_m_distroseries_expansion(self):
5462.4.6 by Vincent Ladeuil
Add helper to simplify tests
605
        self.assertURL('ubuntu/maverick/foo', 'ubuntu:m/foo', series='maverick')
5462.4.3 by Barry Warsaw
* Add back Ubuntu distroseries shortcuts.
606
5462.4.1 by Barry Warsaw
Added support for ubuntu: and debianlp: schemes, accessing the relevant
607
    def test_ubuntu_lucid_distroseries_expansion(self):
5462.4.6 by Vincent Ladeuil
Add helper to simplify tests
608
        self.assertURL('ubuntu/lucid/foo', 'ubuntu:lucid/foo', series='lucid')
5462.4.1 by Barry Warsaw
Added support for ubuntu: and debianlp: schemes, accessing the relevant
609
5462.4.3 by Barry Warsaw
* Add back Ubuntu distroseries shortcuts.
610
    def test_ubuntu_l_distroseries_expansion(self):
5462.4.6 by Vincent Ladeuil
Add helper to simplify tests
611
        self.assertURL('ubuntu/lucid/foo', 'ubuntu:l/foo', series='lucid')
5462.4.3 by Barry Warsaw
* Add back Ubuntu distroseries shortcuts.
612
5462.4.1 by Barry Warsaw
Added support for ubuntu: and debianlp: schemes, accessing the relevant
613
    def test_ubuntu_karmic_distroseries_expansion(self):
5462.4.6 by Vincent Ladeuil
Add helper to simplify tests
614
        self.assertURL('ubuntu/karmic/foo', 'ubuntu:karmic/foo',
615
                       series='karmic')
5462.4.1 by Barry Warsaw
Added support for ubuntu: and debianlp: schemes, accessing the relevant
616
5462.4.3 by Barry Warsaw
* Add back Ubuntu distroseries shortcuts.
617
    def test_ubuntu_k_distroseries_expansion(self):
5462.4.6 by Vincent Ladeuil
Add helper to simplify tests
618
        self.assertURL('ubuntu/karmic/foo', 'ubuntu:k/foo', series='karmic')
5462.4.3 by Barry Warsaw
* Add back Ubuntu distroseries shortcuts.
619
5462.4.1 by Barry Warsaw
Added support for ubuntu: and debianlp: schemes, accessing the relevant
620
    def test_ubuntu_jaunty_distroseries_expansion(self):
5462.4.6 by Vincent Ladeuil
Add helper to simplify tests
621
        self.assertURL('ubuntu/jaunty/foo', 'ubuntu:jaunty/foo',
622
                       series='jaunty')
5462.4.1 by Barry Warsaw
Added support for ubuntu: and debianlp: schemes, accessing the relevant
623
5462.4.3 by Barry Warsaw
* Add back Ubuntu distroseries shortcuts.
624
    def test_ubuntu_j_distroseries_expansion(self):
5462.4.6 by Vincent Ladeuil
Add helper to simplify tests
625
        self.assertURL('ubuntu/jaunty/foo', 'ubuntu:j/foo', series='jaunty')
5462.4.3 by Barry Warsaw
* Add back Ubuntu distroseries shortcuts.
626
5462.4.1 by Barry Warsaw
Added support for ubuntu: and debianlp: schemes, accessing the relevant
627
    def test_ubuntu_hardy_distroseries_expansion(self):
5462.4.6 by Vincent Ladeuil
Add helper to simplify tests
628
        self.assertURL('ubuntu/hardy/foo', 'ubuntu:hardy/foo', series='hardy')
5462.4.1 by Barry Warsaw
Added support for ubuntu: and debianlp: schemes, accessing the relevant
629
5462.4.3 by Barry Warsaw
* Add back Ubuntu distroseries shortcuts.
630
    def test_ubuntu_h_distroseries_expansion(self):
5462.4.6 by Vincent Ladeuil
Add helper to simplify tests
631
        self.assertURL('ubuntu/hardy/foo', 'ubuntu:h/foo', series='hardy')
5462.4.3 by Barry Warsaw
* Add back Ubuntu distroseries shortcuts.
632
5462.4.1 by Barry Warsaw
Added support for ubuntu: and debianlp: schemes, accessing the relevant
633
    def test_ubuntu_dapper_distroseries_expansion(self):
5462.4.6 by Vincent Ladeuil
Add helper to simplify tests
634
        self.assertURL('ubuntu/dapper/foo', 'ubuntu:dapper/foo',
635
                       series='dapper')
5462.4.1 by Barry Warsaw
Added support for ubuntu: and debianlp: schemes, accessing the relevant
636
5462.4.3 by Barry Warsaw
* Add back Ubuntu distroseries shortcuts.
637
    def test_ubuntu_d_distroseries_expansion(self):
5462.4.6 by Vincent Ladeuil
Add helper to simplify tests
638
        self.assertURL('ubuntu/dapper/foo', 'ubuntu:d/foo', series='dapper')
5462.4.3 by Barry Warsaw
* Add back Ubuntu distroseries shortcuts.
639
5462.4.1 by Barry Warsaw
Added support for ubuntu: and debianlp: schemes, accessing the relevant
640
    # Debian default distro series.
641
642
    def test_debian_default_distroseries_expansion(self):
5462.4.6 by Vincent Ladeuil
Add helper to simplify tests
643
        self.assertURL('debian/foo', 'debianlp:foo', distro='debian')
5462.4.1 by Barry Warsaw
Added support for ubuntu: and debianlp: schemes, accessing the relevant
644
645
    def test_debian_squeeze_distroseries_expansion(self):
5462.4.6 by Vincent Ladeuil
Add helper to simplify tests
646
        self.assertURL('debian/squeeze/foo', 'debianlp:squeeze/foo',
647
                       distro='debian', series='squeeze')
5462.4.1 by Barry Warsaw
Added support for ubuntu: and debianlp: schemes, accessing the relevant
648
649
    def test_debian_lenny_distroseries_expansion(self):
5462.4.6 by Vincent Ladeuil
Add helper to simplify tests
650
        self.assertURL('debian/lenny/foo', 'debianlp:lenny/foo',
651
                       distro='debian', series='lenny')