~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Jonathan Lange
  • Date: 2009-01-25 17:07:34 UTC
  • mto: (3991.1.1 ianc-integration)
  • mto: This revision was merged to the branch mainline in revision 3992.
  • Revision ID: jml@canonical.com-20090125170734-0mpnb6ovwsd2wv00
Support lp URL shortcuts.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 
19
19
import os
20
20
 
21
 
from bzrlib import errors
22
 
from bzrlib.tests import TestCase
23
21
from bzrlib.plugins.launchpad.lp_registration import (
24
22
    InvalidLaunchpadInstance, LaunchpadService, NotLaunchpadBranch)
 
23
from bzrlib.plugins.launchpad.test_lp_directory import FakeResolveFactory
 
24
from bzrlib.tests import TestCase
25
25
 
26
26
 
27
27
class LaunchpadServiceTests(TestCase):
135
135
 
136
136
    def test_lp_branch_url(self):
137
137
        service = LaunchpadService(lp_instance='production')
138
 
        web_url = service.get_web_url_from_branch_url('lp:~foo/bar/baz')
 
138
        factory = FakeResolveFactory(
 
139
            self, '~foo/bar/baz',
 
140
            dict(urls=['http://bazaar.launchpad.net/~foo/bar/baz']))
 
141
        web_url = service.get_web_url_from_branch_url(
 
142
            'lp:~foo/bar/baz', factory)
139
143
        self.assertEqual(
140
144
            'https://code.launchpad.net/~foo/bar/baz', web_url)
141
145
 
 
146
    def test_lp_branch_shortcut(self):
 
147
        service = LaunchpadService()
 
148
        factory = FakeResolveFactory(
 
149
            self, 'foo',
 
150
            dict(urls=['http://bazaar.launchpad.net/~foo/bar/baz']))
 
151
        web_url = service.get_web_url_from_branch_url('lp:foo', factory)
 
152
        self.assertEqual(
 
153
            'https://code.edge.launchpad.net/~foo/bar/baz', web_url)
 
154
 
142
155
    def test_staging_url(self):
143
156
        service = LaunchpadService(lp_instance='staging')
144
157
        web_url = service.get_web_url_from_branch_url(