summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Stolarski <t.stolarski@stolarski-it.de>2021-04-28 13:29:38 +0200
committerTim Stolarski <t.stolarski@stolarski-it.de>2021-04-28 13:29:38 +0200
commit70696fe80e0f9131fbf5c1f529c60cbff9600151 (patch)
tree782dc6a16a0a80515b9fa9f27f939bc2585d5c63
parentd4f5d725f75683879aadd08b3cd335db629eea2b (diff)
downloadparamiko-70696fe80e0f9131fbf5c1f529c60cbff9600151.tar.gz
Add Test fpr get() without using prefetch
-rw-r--r--tests/test_sftp.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/tests/test_sftp.py b/tests/test_sftp.py
index e4e18e5a..31a0eb2d 100644
--- a/tests/test_sftp.py
+++ b/tests/test_sftp.py
@@ -554,6 +554,32 @@ class TestSFTP(object):
os.unlink(localname)
sftp.unlink(sftp.FOLDER + "/bunny.txt")
+ def test_get_without_prefetch(self, sftp):
+ """
+ Create a 4MB file. Verify that pull works without prefetching
+ using a lager file.
+ """
+
+ fd, localname = mkstemp()
+ os.close(fd)
+
+ with open(localname, 'wb') as f:
+ num_chars = 1024 * 1024 * 4
+ f.write(b'0' * num_chars)
+
+ sftp.put(localname, sftp.FOLDER + "/dummy_file")
+
+ os.unlink(localname)
+ fd, localname = mkstemp()
+ os.close(fd)
+
+ sftp.get(sftp.FOLDER + "/dummy_file", localname, prefetch=False)
+
+ assert os.stat(localname).st_size == 4194304
+
+ os.unlink(localname)
+ sftp.unlink(sftp.FOLDER + "/dummy_file")
+
def test_check(self, sftp):
"""
verify that file.check() works against our own server.