diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_sftp.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/test_sftp.py b/tests/test_sftp.py index e4e18e5a..a98a46c6 100644 --- a/tests/test_sftp.py +++ b/tests/test_sftp.py @@ -554,6 +554,34 @@ 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. + """ + + sftp_filename = sftp.FOLDER + "/dummy_file" + num_chars = 1024 * 1024 * 4 + + fd, localname = mkstemp() + os.close(fd) + + with open(localname, "wb") as f: + f.write(b"0" * num_chars) + + sftp.put(localname, sftp_filename) + + os.unlink(localname) + fd, localname = mkstemp() + os.close(fd) + + sftp.get(sftp_filename, localname, prefetch=False) + + assert os.stat(localname).st_size == num_chars + + os.unlink(localname) + sftp.unlink(sftp_filename) + def test_check(self, sftp): """ verify that file.check() works against our own server. |