summaryrefslogtreecommitdiff
path: root/tests/test_sftp.py
diff options
context:
space:
mode:
authorJeremy T. Bouse <jbouse@debian.org>2011-05-29 08:16:54 -0400
committerJeremy T. Bouse <jbouse@debian.org>2011-05-29 08:16:54 -0400
commita88b8c8c0f591a3bfa8d7984343a27815184f495 (patch)
tree85986bed44cc7148c461d6aa7736b627b83c24fb /tests/test_sftp.py
parente299181a5dda25aed4879ebcbe1359604448b3ae (diff)
downloadpython-paramiko-a88b8c8c0f591a3bfa8d7984343a27815184f495.tar
python-paramiko-a88b8c8c0f591a3bfa8d7984343a27815184f495.tar.gz
Imported Upstream version 1.7.7.1upstream/1.7.7.1
Diffstat (limited to 'tests/test_sftp.py')
-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 f9d7270..2eadabc 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
@@ -667,6 +668,33 @@ class SFTPTest (unittest.TestCase):
finally:
sftp.unlink(FOLDER + '/zero')
+ def test_N_put_without_confirm(self):
+ """
+ verify that get/put work without confirmation.
+ """
+ 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().attr, res.attr)
+
+ 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):
"""
verify that seek does't affect writes during append.