summaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorRobey Pointer <robey@lag.net>2008-07-06 16:08:15 -0700
committerRobey Pointer <robey@lag.net>2008-07-06 16:08:15 -0700
commitfbfd8126c86af8d10e96dda7a345a33afd41f091 (patch)
tree313356db421e541e196c96328543d0d682536a76 /tests
parente8748645a374d14f066cab3aefb82bf85c3b73bc (diff)
[project @ robey@lag.net-20080706230815-v2ybqxm237zw0wa0]
add a callback method that can be used to track get/put progress in SFTPClient. suggested by Phil Schwartz.
Diffstat (limited to 'tests')
-rwxr-xr-xtests/test_sftp.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/tests/test_sftp.py b/tests/test_sftp.py
index ab5b8180..edc05990 100755
--- a/tests/test_sftp.py
+++ b/tests/test_sftp.py
@@ -560,19 +560,25 @@ class SFTPTest (unittest.TestCase):
f = open(localname, 'wb')
f.write(text)
f.close()
- sftp.put(localname, FOLDER + '/bunny.txt')
+ saved_progress = []
+ def progress_callback(x, y):
+ saved_progress.append((x, y))
+ sftp.put(localname, FOLDER + '/bunny.txt', progress_callback)
f = sftp.open(FOLDER + '/bunny.txt', 'r')
self.assertEquals(text, f.read(128))
f.close()
+ self.assertEquals((41, 41), saved_progress[-1])
os.unlink(localname)
localname = os.tempnam()
- sftp.get(FOLDER + '/bunny.txt', localname)
+ saved_progress = []
+ sftp.get(FOLDER + '/bunny.txt', localname, progress_callback)
f = open(localname, 'rb')
self.assertEquals(text, f.read(128))
f.close()
+ self.assertEquals((41, 41), saved_progress[-1])
os.unlink(localname)
sftp.unlink(FOLDER + '/bunny.txt')