~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

Merge cleanup into first-try resolving conflicts

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
    )
37
37
from bzrlib.plugins.launchpad.lp_directory import (
38
38
    LaunchpadDirectory)
39
 
from bzrlib.plugins.launchpad.account import get_lp_login
 
39
from bzrlib.plugins.launchpad.account import get_lp_login, set_lp_login
40
40
from bzrlib.tests import (
41
41
    http_server,
42
42
    http_utils,
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
 
202
225
 
203
226
class DirectoryOpenBranchTests(TestCaseWithMemoryTransport):
204
227