summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRobey Pointer <robey@twitter.com>2010-04-13 18:52:29 -0700
committerRobey Pointer <robey@twitter.com>2010-04-13 18:52:29 -0700
commitf67cea44d07414806b37905bd58c589d6a48a0df (patch)
treee59c6d01df36fbfdc5c337befcee1ea70d1aff48
parentd268594ab1522e9b553ba0be9f2617c612c08d75 (diff)
code style and fix test.
-rw-r--r--paramiko/sftp_client.py6
-rwxr-xr-xtests/test_sftp.py8
2 files changed, 9 insertions, 5 deletions
diff --git a/paramiko/sftp_client.py b/paramiko/sftp_client.py
index a7e90588..79a77614 100644
--- a/paramiko/sftp_client.py
+++ b/paramiko/sftp_client.py
@@ -533,7 +533,7 @@ class SFTPClient (BaseSFTP):
"""
return self._cwd
- def put(self, localpath, remotepath, callback=None, confirm = True):
+ def put(self, localpath, remotepath, callback=None, confirm=True):
"""
Copy a local file (C{localpath}) to the SFTP server as C{remotepath}.
Any exception raised by operations will be passed through. This
@@ -549,6 +549,10 @@ class SFTPClient (BaseSFTP):
transferred so far and the total bytes to be transferred
(since 1.7.4)
@type callback: function(int, int)
+ @param confirm: whether to do a stat() on the file afterwards to
+ confirm the file size (since 1.7.7)
+ @type confirm: bool
+
@return: an object containing attributes about the given file
(since 1.7.4)
@rtype: SFTPAttributes
diff --git a/tests/test_sftp.py b/tests/test_sftp.py
index f191314a..2eadabcd 100755
--- a/tests/test_sftp.py
+++ b/tests/test_sftp.py
@@ -667,9 +667,10 @@ class SFTPTest (unittest.TestCase):
f.close()
finally:
sftp.unlink(FOLDER + '/zero')
+
def test_N_put_without_confirm(self):
"""
- verify that get/put work.
+ verify that get/put work without confirmation.
"""
import os, warnings
warnings.filterwarnings('ignore', 'tempnam.*')
@@ -682,10 +683,9 @@ class SFTPTest (unittest.TestCase):
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)
+ 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))