108
108
# restore original values
109
109
_set_protocol_handlers(saved_handlers)
111
111
def test_transport_fallback(self):
112
112
"""Transport with missing dependency causes no error"""
113
113
saved_handlers = _get_protocol_handlers()
124
124
_set_protocol_handlers(saved_handlers)
126
def test_ssh_hints(self):
127
"""Transport ssh:// should raise an error pointing out bzr+ssh://"""
129
get_transport('ssh://fooserver/foo')
130
except UnsupportedProtocol, e:
132
self.assertEquals('Unsupported protocol'
133
' for url "ssh://fooserver/foo":'
134
' bzr supports bzr+ssh to operate over ssh, use "bzr+ssh://fooserver/foo".',
137
self.fail('Did not raise UnsupportedProtocol')
126
139
def test_LateReadError(self):
127
140
"""The LateReadError helper should raise on read()."""
128
141
a_file = LateReadError('a path')
368
381
self.assertEqual(server, relpath_cloned.server)
369
382
self.assertEqual(server, abspath_cloned.server)
370
383
server.tearDown()
372
385
def test_chroot_url_preserves_chroot(self):
373
386
"""Calling get_transport on a chroot transport's base should produce a
374
387
transport with exactly the same behaviour as the original chroot
386
399
self.assertEqual(transport.server, new_transport.server)
387
400
self.assertEqual(transport.base, new_transport.base)
388
401
server.tearDown()
390
403
def test_urljoin_preserves_chroot(self):
391
404
"""Using urlutils.join(url, '..') on a chroot URL should not produce a
392
405
URL that escapes the intended chroot.
552
565
class TestTransportImplementation(TestCaseInTempDir):
553
566
"""Implementation verification for transports.
555
568
To verify a transport we need a server factory, which is a callable
556
569
that accepts no parameters and returns an implementation of
557
570
bzrlib.transport.Server.
559
572
That Server is then used to construct transport instances and test
560
573
the transport via loopback activity.
562
Currently this assumes that the Transport object is connected to the
563
current working directory. So that whatever is done
564
through the transport, should show up in the working
575
Currently this assumes that the Transport object is connected to the
576
current working directory. So that whatever is done
577
through the transport, should show up in the working
565
578
directory, and vice-versa. This is a bug, because its possible to have
566
URL schemes which provide access to something that may not be
567
result in storage on the local disk, i.e. due to file system limits, or
579
URL schemes which provide access to something that may not be
580
result in storage on the local disk, i.e. due to file system limits, or
568
581
due to it being a database or some other non-filesystem tool.
570
583
This also tests to make sure that the functions work with both
571
584
generators and lists (assuming iter(list) is effectively a generator)
575
588
super(TestTransportImplementation, self).setUp()
576
589
self._server = self.transport_server()