diff options
author | Robey Pointer <robey@lag.net> | 2005-02-28 07:49:56 +0000 |
---|---|---|
committer | Robey Pointer <robey@lag.net> | 2005-02-28 07:49:56 +0000 |
commit | 7490172401a48f8134e860120ef54a08303f63eb (patch) | |
tree | 6cfb5963d9e28832b47e5991e1c8f3d7f374aae1 /tests | |
parent | 2746d449067e3e25afe8d2afaf1e5bf740d9c20c (diff) |
[project @ Arch-1:robey@lag.net--2003-public%secsh--dev--1.0--patch-153]
tweak sftp_file write behavior on large blocks of data
BufferedFile.write() wasn't correctly dealing with the possibility that the
underlying write might not write the entire data block at once (even though
the docs said it would). now that it's working, make sftp_file take
advantage of it in order to chop up blocks larger than 32kB (the max allowed
on sftp) and add a unit test for it.
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/test_sftp.py | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/tests/test_sftp.py b/tests/test_sftp.py index 72ca1959..ba00a184 100755 --- a/tests/test_sftp.py +++ b/tests/test_sftp.py @@ -438,7 +438,24 @@ class SFTPTest (unittest.TestCase): finally: sftp.remove('%s/hongry.txt' % FOLDER) - def test_E_realpath(self): + def test_E_big_file_no_buffer(self): + """ + write a 1MB file, with no linefeeds, and no buffering. + """ + global g_big_file_test + if not g_big_file_test: + return + kblob = (1024 * 1024 * 'x') + try: + f = sftp.open('%s/hongry.txt' % FOLDER, 'w') + f.write(kblob) + f.close() + + self.assertEqual(sftp.stat('%s/hongry.txt' % FOLDER).st_size, 1024 * 1024) + finally: + sftp.remove('%s/hongry.txt' % FOLDER) + + def test_F_realpath(self): """ test that realpath is returning something non-empty and not an error. @@ -449,7 +466,7 @@ class SFTPTest (unittest.TestCase): self.assert_(len(f) > 0) self.assertEquals(os.path.join(pwd, FOLDER), f) - def test_F_mkdir(self): + def test_G_mkdir(self): """ verify that mkdir/rmdir work. """ |