311
311
class BackupTransportHandler(Transport):
312
312
"""Test transport that works as a backup for the BadTransportHandler"""
316
class TestTransportImplementation(TestCaseInTempDir):
317
"""Implementation verification for transports.
319
To verify a transport we need a server factory, which is a callable
320
that accepts no parameters and returns an implementation of
321
bzrlib.transport.Server.
323
That Server is then used to construct transport instances and test
324
the transport via loopback activity.
326
Currently this assumes that the Transport object is connected to the
327
current working directory. So that whatever is done
328
through the transport, should show up in the working
329
directory, and vice-versa. This is a bug, because its possible to have
330
URL schemes which provide access to something that may not be
331
result in storage on the local disk, i.e. due to file system limits, or
332
due to it being a database or some other non-filesystem tool.
334
This also tests to make sure that the functions work with both
335
generators and lists (assuming iter(list) is effectively a generator)
339
super(TestTransportImplementation, self).setUp()
340
self._server = self.transport_server()
344
super(TestTransportImplementation, self).tearDown()
345
self._server.tearDown()
347
def get_transport(self):
348
"""Return a connected transport to the local directory."""
349
base_url = self._server.get_url()
350
# try getting the transport via the regular interface:
351
t = get_transport(base_url)
352
if not isinstance(t, self.transport_class):
353
# we did not get the correct transport class type. Override the
354
# regular connection behaviour by direct construction.
355
t = self.transport_class(base_url)