~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-02-11 04:02:41 UTC
  • mfrom: (5017.2.2 tariff)
  • Revision ID: pqm@pqm.ubuntu.com-20100211040241-w6n021dz0uus341n
(mbp) add import-tariff tests

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2007-2010 Canonical Ltd
 
1
# Copyright (C) 2007, 2008 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
22
22
from bzrlib import (
23
23
    errors,
24
24
    tests,
25
 
    transport,
26
25
    )
27
26
from bzrlib.branch import Branch
28
27
from bzrlib.directory_service import directories
30
29
    TestCaseInTempDir,
31
30
    TestCaseWithMemoryTransport
32
31
)
 
32
from bzrlib.transport import get_transport
33
33
from bzrlib.plugins.launchpad import (
34
34
    _register_directory,
35
35
    lp_registration,
36
36
    )
37
37
from bzrlib.plugins.launchpad.lp_directory import (
38
38
    LaunchpadDirectory)
39
 
from bzrlib.plugins.launchpad.account import get_lp_login, set_lp_login
 
39
from bzrlib.plugins.launchpad.account import get_lp_login
40
40
from bzrlib.tests import (
41
41
    http_server,
42
42
    http_utils,
91
91
        self.assertEquals('http://bazaar.launchpad.net/~apt/apt/devel',
92
92
                          directory._resolve('lp:apt', factory))
93
93
        # Make sure that resolve went to the production server.
94
 
        self.assertEquals('https://xmlrpc.launchpad.net/bazaar/',
 
94
        self.assertEquals('https://xmlrpc.edge.launchpad.net/bazaar/',
95
95
                          factory._service_url)
96
96
 
97
97
    def test_staging(self):
199
199
        self.assertRaises(errors.InvalidURL,
200
200
            directory._resolve, 'lp://ratotehunoahu')
201
201
 
202
 
    def test_resolve_tilde_to_user(self):
203
 
        factory = FakeResolveFactory(
204
 
            self, '~username/apt/test', dict(urls=[
205
 
                    'bzr+ssh://bazaar.launchpad.net/~username/apt/test']))
206
 
        directory = LaunchpadDirectory()
207
 
        self.assertEquals(
208
 
            'bzr+ssh://bazaar.launchpad.net/~username/apt/test',
209
 
            directory._resolve('lp:~/apt/test', factory, _lp_login='username'))
210
 
        # Should also happen when the login is just set by config
211
 
        set_lp_login('username')
212
 
        self.assertEquals(
213
 
            'bzr+ssh://bazaar.launchpad.net/~username/apt/test',
214
 
            directory._resolve('lp:~/apt/test', factory))
215
 
 
216
 
    def test_tilde_fails_no_login(self):
217
 
        factory = FakeResolveFactory(
218
 
            self, '~username/apt/test', dict(urls=[
219
 
                    'bzr+ssh://bazaar.launchpad.net/~username/apt/test']))
220
 
        self.assertIs(None, get_lp_login())
221
 
        directory = LaunchpadDirectory()
222
 
        e = self.assertRaises(errors.InvalidURL,
223
 
            directory._resolve, 'lp:~/apt/test', factory)
224
 
 
225
202
 
226
203
class DirectoryOpenBranchTests(TestCaseWithMemoryTransport):
227
204
 
240
217
        directories.register('lp:', FooService, 'Map lp URLs to local urls')
241
218
        self.addCleanup(_register_directory)
242
219
        self.addCleanup(directories.remove, 'lp:')
243
 
        t = transport.get_transport('lp:///apt')
244
 
        branch = Branch.open_from_transport(t)
 
220
        transport = get_transport('lp:///apt')
 
221
        branch = Branch.open_from_transport(transport)
245
222
        self.assertEqual(target_branch.base, branch.base)
246
223
 
247
224