code style and fix test.
This commit is contained in:
parent
d268594ab1
commit
f67cea44d0
|
@ -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
|
||||
|
|
|
@ -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))
|
||||
|
|
Loading…
Reference in New Issue