diff options
author | Jeff Forcier <jeff@bitprophet.org> | 2017-10-23 14:11:10 -0700 |
---|---|---|
committer | Jeff Forcier <jeff@bitprophet.org> | 2018-09-17 14:37:50 -0700 |
commit | 467fecb9d4e564a3888285388d4c7482adeb851d (patch) | |
tree | 6416b4a5c6858c908a1cf9a3e18ab2233b3be243 /tests/test_sftp.py | |
parent | 0552bc3756f919a4644e790b2c401b688e5c6216 (diff) |
Get big sftp tests passing w/ the sftp client + folder crap being a fixture
Diffstat (limited to 'tests/test_sftp.py')
-rwxr-xr-x | tests/test_sftp.py | 35 |
1 files changed, 3 insertions, 32 deletions
diff --git a/tests/test_sftp.py b/tests/test_sftp.py index 432d3e40..a38c2e7d 100755 --- a/tests/test_sftp.py +++ b/tests/test_sftp.py @@ -32,6 +32,8 @@ import warnings from binascii import hexlify from tempfile import mkstemp +import pytest + import paramiko import paramiko.util from paramiko.py3compat import PY2, b, u, StringIO @@ -40,7 +42,6 @@ from paramiko.sftp_attr import SFTPAttributes from .util import needs_builtin from .stub_sftp import StubServer, StubSFTPServer -from .loop import LoopSocket from .util import _support @@ -94,37 +95,7 @@ unicode_folder = eval(compile(r"u'\u00fcnic\u00f8de'" if PY2 else r"'\u00fcnic\u utf8_folder = b'/\xc3\xbcnic\xc3\xb8\x64\x65' -# TODO: turn into a pytest fixture; consider making it module or session-global -# to mimic old behavior (though that still feels unclean to me...) -def make_loopback_sftp(): - """ - Set up an in-memory SFTP server. - - :returns: - A 2-tuple of the resulting SFTPClient (for tests that just care about a - 'default' client) and Transport (for testing instantiation _of_ - SFTPClient itself, which can take an existing transport object.) - """ - socks = LoopSocket() - sockc = LoopSocket() - sockc.link(socks) - tc = paramiko.Transport(sockc) - ts = paramiko.Transport(socks) - - host_key = paramiko.RSAKey.from_private_key_file(_support('test_rsa.key')) - ts.add_server_key(host_key) - event = threading.Event() - server = StubServer() - ts.set_subsystem_handler('sftp', paramiko.SFTPServer, StubSFTPServer) - ts.start_server(event, server) - tc.connect(username='slowdive', password='pygmalion') - event.wait(1.0) - - return paramiko.SFTP.from_transport(tc), tc - - -class SFTPTest (unittest.TestCase): - +class SFTPTest(unittest.TestCase): @staticmethod def set_big_file_test(onoff): global g_big_file_test |