diff options
Diffstat (limited to 'tests/test_sftp.py')
-rwxr-xr-x | tests/test_sftp.py | 28 |
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. |