summaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorLarry Wright <larrywright@gmail.com>2009-12-18 17:02:55 -0600
committerLarry Wright <larrywright@gmail.com>2009-12-18 17:02:55 -0600
commitb4ee844a3cb06fb4fda889a5fb1eb702e4eaa31a (patch)
tree736c0562a4c82646ca4d0df5b48f275ce766c646 /tests
parentcb913d5d32b36f73a3ab202ea8a33f3e7e2d6a59 (diff)
added functionality to skip verifying the file, which works around sftp servers that remove the file immediately after it's been closed.
Diffstat (limited to 'tests')
-rwxr-xr-xtests/test_sftp.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/test_sftp.py b/tests/test_sftp.py
index f9d72709..f191314a 100755
--- a/tests/test_sftp.py
+++ b/tests/test_sftp.py
@@ -36,6 +36,7 @@ import unittest
import paramiko
from stub_sftp import StubServer, StubSFTPServer
from loop import LoopSocket
+from paramiko.sftp_attr import SFTPAttributes
ARTICLE = '''
Insulin sensitivity and liver insulin receptor structure in ducks from two
@@ -666,6 +667,33 @@ class SFTPTest (unittest.TestCase):
f.close()
finally:
sftp.unlink(FOLDER + '/zero')
+ def test_N_put_without_confirm(self):
+ """
+ verify that get/put work.
+ """
+ import os, warnings
+ warnings.filterwarnings('ignore', 'tempnam.*')
+
+ localname = os.tempnam()
+ text = 'All I wanted was a plastic bunny rabbit.\n'
+ f = open(localname, 'wb')
+ f.write(text)
+ f.close()
+ saved_progress = []
+ def progress_callback(x, y):
+ saved_progress.append((x, y))
+ res = sftp.put(localname, FOLDER + '/bunny.txt', progress_callback, false)
+
+ self.assertEquals(SFTPAttributes(), res)
+
+
+ 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)
+ sftp.unlink(FOLDER + '/bunny.txt')
def XXX_test_M_seek_append(self):
"""