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