371
371
class BackupTransportHandler(Transport):
372
372
"""Test transport that works as a backup for the BadTransportHandler"""
376
class TestTransportImplementation(TestCaseInTempDir):
377
"""Implementation verification for transports.
379
To verify a transport we need a server factory, which is a callable
380
that accepts no parameters and returns an implementation of
381
bzrlib.transport.Server.
383
That Server is then used to construct transport instances and test
384
the transport via loopback activity.
386
Currently this assumes that the Transport object is connected to the
387
current working directory. So that whatever is done
388
through the transport, should show up in the working
389
directory, and vice-versa. This is a bug, because its possible to have
390
URL schemes which provide access to something that may not be
391
result in storage on the local disk, i.e. due to file system limits, or
392
due to it being a database or some other non-filesystem tool.
394
This also tests to make sure that the functions work with both
395
generators and lists (assuming iter(list) is effectively a generator)
399
super(TestTransportImplementation, self).setUp()
400
self._server = self.transport_server()
404
super(TestTransportImplementation, self).tearDown()
405
self._server.tearDown()
407
def get_transport(self):
408
"""Return a connected transport to the local directory."""
409
base_url = self._server.get_url()
410
# try getting the transport via the regular interface:
411
t = get_transport(base_url)
412
if not isinstance(t, self.transport_class):
413
# we did not get the correct transport class type. Override the
414
# regular connection behaviour by direct construction.
415
t = self.transport_class(base_url)