~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_transport.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2006-06-08 06:38:32 UTC
  • mfrom: (1685.1.81 encoding)
  • Revision ID: pqm@pqm.ubuntu.com-20060608063832-74b46cf8fdd4567a
(jam,mbp,wvh) Lots of updates to unicode,url,and encoding support

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
                           TransportNotPossible,
26
26
                           ConnectionError,
27
27
                           DependencyNotPresent,
 
28
                           InvalidURL,
28
29
                           )
29
30
from bzrlib.tests import TestCase, TestCaseInTempDir
30
31
from bzrlib.transport import (_get_protocol_handlers,
32
33
                              get_transport,
33
34
                              register_lazy_transport,
34
35
                              _set_protocol_handlers,
35
 
                              urlescape,
36
36
                              Transport,
37
37
                              )
38
38
from bzrlib.transport.memory import MemoryTransport
42
42
class TestTransport(TestCase):
43
43
    """Test the non transport-concrete class functionality."""
44
44
 
45
 
    def test_urlescape(self):
46
 
        self.assertEqual('%25', urlescape('%'))
47
 
 
48
45
    def test__get_set_protocol_handlers(self):
49
46
        handlers = _get_protocol_handlers()
50
47
        self.assertNotEqual({}, handlers)
74
71
        try:
75
72
            register_lazy_transport('foo', 'bzrlib.tests.test_transport',
76
73
                    'BadTransportHandler')
77
 
            t = get_transport('foo://fooserver/foo')
78
 
            # because we failed to load the transport
79
 
            self.assertTrue(isinstance(t, LocalTransport))
 
74
            # TODO: jam 20060427 Now we get InvalidURL because it looks like 
 
75
            #       a URL but we have no support for it.
 
76
            #       Is it better to always fall back to LocalTransport?
 
77
            #       I think this is a better error than a future NoSuchFile
 
78
            self.assertRaises(InvalidURL, get_transport, 'foo://fooserver/foo')
80
79
        finally:
81
80
            # restore original values
82
81
            _set_protocol_handlers(saved_handlers)
107
106
 
108
107
    def test_abspath(self):
109
108
        transport = MemoryTransport()
110
 
        self.assertEqual("memory:/relpath", transport.abspath('relpath'))
 
109
        self.assertEqual("memory:///relpath", transport.abspath('relpath'))
111
110
 
112
111
    def test_relpath(self):
113
112
        transport = MemoryTransport()