225
226
self.assertEqual(tests[1].branch_format, formats[1])
226
227
self.assertEqual(tests[1].transport_server, server1)
227
228
self.assertEqual(tests[1].transport_readonly_server, server2)
231
class TestTestCaseWithTransport(TestCaseWithTransport):
232
"""Tests for the convenience functions TestCaseWithTransport introduces."""
234
def test_get_readonly_url_none(self):
235
from bzrlib.transport import get_transport
236
from bzrlib.transport.memory import MemoryServer
237
from bzrlib.transport.readonly import ReadonlyTransportDecorator
238
self.transport_server = MemoryServer
239
self.transport_readonly_server = None
240
# calling get_readonly_transport() constructs a decorator on the url
242
url = self.get_readonly_url()
243
t = get_transport(url)
244
self.failUnless(isinstance(t, ReadonlyTransportDecorator))
246
def test_get_readonly_url_http(self):
247
from bzrlib.transport import get_transport
248
from bzrlib.transport.local import LocalRelpathServer
249
from bzrlib.transport.http import HttpServer, HttpTransport
250
self.transport_server = LocalRelpathServer
251
self.transport_readonly_server = HttpServer
252
# calling get_readonly_transport() gives us a HTTP server instance.
253
url = self.get_readonly_url()
254
t = get_transport(url)
255
self.failUnless(isinstance(t, HttpTransport))