24
24
TransportNotPossible, ConnectionError)
25
25
from bzrlib.tests import TestCase, TestCaseInTempDir
26
26
from bzrlib.tests.HTTPTestUtil import TestCaseWithWebserver
27
from bzrlib.transport import memory, urlescape
27
from bzrlib.transport import (_get_protocol_handlers,
28
_get_transport_modules,
29
register_lazy_transport,
30
_set_protocol_handlers,
28
33
from bzrlib.osutils import pathjoin
57
62
def test_urlescape(self):
58
63
self.assertEqual('%25', urlescape('%'))
65
def test__get_set_protocol_handlers(self):
66
handlers = _get_protocol_handlers()
67
self.assertNotEqual({}, handlers)
69
_set_protocol_handlers({})
70
self.assertEqual({}, _get_protocol_handlers())
72
_set_protocol_handlers(handlers)
74
def test_get_transport_modules(self):
75
handlers = _get_protocol_handlers()
76
class SampleHandler(object):
77
"""I exist, isnt that enough?"""
80
_set_protocol_handlers(my_handlers)
81
register_lazy_transport('foo', 'bzrlib.tests.test_transport', 'TestTransport.SampleHandler')
82
register_lazy_transport('bar', 'bzrlib.tests.test_transport', 'TestTransport.SampleHandler')
83
self.assertEqual([SampleHandler.__module__],
84
_get_transport_modules())
86
_set_protocol_handlers(handlers)
61
89
class TestTransportMixIn(object):
62
90
"""Subclass this, and it will provide a series of tests for a Transport.