~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Aaron Bentley
  • Date: 2008-03-06 21:16:38 UTC
  • mto: This revision was merged to the branch mainline in revision 3266.
  • Revision ID: aaron@aaronbentley.com-20080306211638-e7vl1tvjkw1w961l
More renames and cleanups

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
17
 
"""Tests for indirect branch urls through Launchpad.net"""
 
17
"""Tests for directory lookup through Launchpad.net"""
18
18
 
19
19
import xmlrpclib
20
20
 
26
26
from bzrlib.tests import TestCase, TestCaseWithMemoryTransport
27
27
from bzrlib.transport import get_transport
28
28
from bzrlib.plugins.launchpad import _register_directory
29
 
from bzrlib.plugins.launchpad.lp_indirect import (
 
29
from bzrlib.plugins.launchpad.lp_directory import (
30
30
    LaunchpadDirectory)
31
31
from bzrlib.plugins.launchpad.account import get_lp_login
32
32
 
46
46
        return self._result
47
47
 
48
48
 
49
 
class IndirectUrlTests(TestCase):
50
 
    """Tests for indirect branch urls through Launchpad.net"""
 
49
class DirectoryUrlTests(TestCase):
 
50
    """Tests for branch urls through Launchpad.net directory"""
51
51
 
52
52
    def test_short_form(self):
53
53
        """A launchpad url should map to a http url"""
74
74
        self.assertEquals('https://xmlrpc.staging.launchpad.net/bazaar/',
75
75
                          factory._service_url)
76
76
 
77
 
    def test_indirect_through_url(self):
 
77
    def test_url_from_directory(self):
78
78
        """A launchpad url should map to a http url"""
79
79
        factory = FakeResolveFactory(
80
80
            self, 'apt', dict(urls=[
83
83
        self.assertEquals('http://bazaar.launchpad.net/~apt/apt/devel',
84
84
                          directory._resolve('lp:///apt', factory))
85
85
 
86
 
    def test_indirect_skip_bad_schemes(self):
 
86
    def test_directory_skip_bad_schemes(self):
87
87
        factory = FakeResolveFactory(
88
88
            self, 'apt', dict(urls=[
89
89
                    'bad-scheme://bazaar.launchpad.net/~apt/apt/devel',
93
93
        self.assertEquals('http://bazaar.launchpad.net/~apt/apt/devel',
94
94
                          directory._resolve('lp:///apt', factory))
95
95
 
96
 
    def test_indirect_no_matching_schemes(self):
 
96
    def test_directory_no_matching_schemes(self):
97
97
        # If the XMLRPC call does not return any protocols we support,
98
98
        # invalidURL is raised.
99
99
        factory = FakeResolveFactory(
103
103
        self.assertRaises(errors.InvalidURL,
104
104
                          directory._resolve, 'lp:///apt', factory)
105
105
 
106
 
    def test_indirect_fault(self):
 
106
    def test_directory_fault(self):
107
107
        # Test that XMLRPC faults get converted to InvalidURL errors.
108
108
        factory = FakeResolveFactory(self, 'apt', None)
109
109
        def submit(service):
161
161
                          directory._resolve('lp:///apt', factory))
162
162
 
163
163
    # TODO: check we get an error if the url is unreasonable
164
 
    def test_error_for_bad_indirection(self):
 
164
    def test_error_for_bad_url(self):
165
165
        directory = LaunchpadDirectory()
166
166
        self.assertRaises(errors.InvalidURL,
167
167
            directory._resolve, 'lp://ratotehunoahu')
168
168
 
169
169
 
170
 
class IndirectOpenBranchTests(TestCaseWithMemoryTransport):
 
170
class DirectoryOpenBranchTests(TestCaseWithMemoryTransport):
171
171
 
172
 
    def test_indirect_open_branch(self):
 
172
    def test_directory_open_branch(self):
173
173
        # Test that opening an lp: branch redirects to the real location.
174
174
        target_branch = self.make_branch('target')
175
175
        class FooService(object):