summaryrefslogtreecommitdiffhomepage
path: root/tests/test_sftp.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_sftp.py')
-rwxr-xr-xtests/test_sftp.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/test_sftp.py b/tests/test_sftp.py
index 1e2785d1..db210131 100755
--- a/tests/test_sftp.py
+++ b/tests/test_sftp.py
@@ -648,3 +648,24 @@ class SFTPTest (unittest.TestCase):
f.close()
finally:
sftp.unlink(FOLDER + '/zero')
+
+ def test_M_seek_append(self):
+ """
+ verify that seek does't affect writes during append.
+ """
+ f = sftp.open(FOLDER + '/append.txt', 'a')
+ try:
+ f.write('first line\nsecond line\n')
+ f.seek(11, f.SEEK_SET)
+ f.write('third line\n')
+ f.close()
+
+ f = sftp.open(FOLDER + '/append.txt', 'r')
+ self.assertEqual(f.stat().st_size, 34)
+ self.assertEqual(f.readline(), 'first line\n')
+ self.assertEqual(f.readline(), 'second line\n')
+ self.assertEqual(f.readline(), 'third line\n')
+ f.close()
+ finally:
+ sftp.remove(FOLDER + '/append.txt')
+