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 (
199
199
self.assertRaises(errors.InvalidURL,
200
200
directory._resolve, 'lp://ratotehunoahu')
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()
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')
213
'bzr+ssh://bazaar.launchpad.net/~username/apt/test',
214
directory._resolve('lp:~/apt/test', factory))
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)
203
226
class DirectoryOpenBranchTests(TestCaseWithMemoryTransport):