38
38
if not paramiko_loaded:
39
39
raise TestSkipped('you must have paramiko to run this test')
40
40
super(TestCaseWithSFTPServer, self).setUp()
41
from bzrlib.transport.sftp import SFTPAbsoluteServer, SFTPHomeDirServer
42
if getattr(self, '_get_remote_is_absolute', None) is None:
43
self._get_remote_is_absolute = True
44
if self._get_remote_is_absolute:
45
self.server = SFTPAbsoluteServer()
41
from bzrlib.transport.sftp import SFTPAbsoluteServer, SFTPHomeDirServer, SFTPServer
42
if getattr(self, '_full_handshake', False):
43
self.server = SFTPServer()
47
self.server = SFTPHomeDirServer()
45
self._full_handshake = False
46
if getattr(self, '_get_remote_is_absolute', None) is None:
47
self._get_remote_is_absolute = True
48
if self._get_remote_is_absolute:
49
self.server = SFTPAbsoluteServer()
51
self.server = SFTPHomeDirServer()
48
52
self.server.setUp()
49
53
self.addCleanup(self.server.tearDown)
50
self._sftp_url = self.server.get_url()
54
if self._full_handshake:
55
self._sftp_url = self.server._get_sftp_url("")
57
self._sftp_url = self.server.get_url()
51
58
self._root = self.test_dir
52
59
# Set to a string in setUp to give sftp server a new homedir.
53
60
self._override_home = None
98
105
def test_multiple_connections(self):
99
106
t = self.get_transport()
100
self.assertEquals(self.server.logs,
101
['sftpserver - authorizing: foo'
102
, 'sftpserver - channel request: session, 1'])
107
self.assertTrue('sftpserver - new connection' in self.server.logs)
103
108
self.server.logs = []
104
109
# The second request should reuse the first connection
105
110
# SingleListener only allows for a single connection,
246
251
self.assertEquals(b2.revision_history(), ['a1', 'a2'])
254
class SFTPFullHandshakingTest(TestCaseWithSFTPServer):
255
"""Verify that a full-handshake (SSH over loopback TCP) sftp connection works."""
256
_full_handshake = True
258
def test_connection(self):