~bzr-pqm/bzr/bzr.dev

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