summaryrefslogtreecommitdiffhomepage
path: root/tests/test_sftp.py
diff options
context:
space:
mode:
authorJeff Forcier <jeff@bitprophet.org>2017-06-06 15:15:40 -0700
committerJeff Forcier <jeff@bitprophet.org>2017-06-06 15:15:40 -0700
commit996fb6fd8ffb6df4f56c81e2ff199b9a600ecfc6 (patch)
tree4571659cb5f9320275cfedccc3ae897b0f425343 /tests/test_sftp.py
parent57394f5199ff75abc87b0373e18be2102540d50d (diff)
parentddb277d4e4989e914b67ff26c14c7c298e7fab9f (diff)
Merge branch 'master' into 471-int
Diffstat (limited to 'tests/test_sftp.py')
-rwxr-xr-xtests/test_sftp.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/tests/test_sftp.py b/tests/test_sftp.py
index b7ace8e2..8f1b7d2e 100755
--- a/tests/test_sftp.py
+++ b/tests/test_sftp.py
@@ -446,7 +446,7 @@ class SFTPTest (unittest.TestCase):
def test_A_readline_seek(self):
"""
create a text file and write a bunch of text into it. then count the lines
- in the file, and seek around to retreive particular lines. this should
+ in the file, and seek around to retrieve particular lines. this should
verify that read buffering and 'tell' work well together, and that read
buffering is reset on 'seek'.
"""
@@ -462,6 +462,7 @@ class SFTPTest (unittest.TestCase):
line_number += 1
pos_list.append(loc)
loc = f.tell()
+ self.assertTrue(f.seekable())
f.seek(pos_list[6], f.SEEK_SET)
self.assertEqual(f.readline(), 'Nouzilly, France.\n')
f.seek(pos_list[17], f.SEEK_SET)
@@ -643,7 +644,7 @@ class SFTPTest (unittest.TestCase):
with sftp.open(FOLDER + '/bunny.txt', 'rb') as f:
self.assertEqual(text, f.read(128))
- self.assertEqual((41, 41), saved_progress[-1])
+ self.assertEqual([(41, 41)], saved_progress)
os.unlink(localname)
fd, localname = mkstemp()
@@ -653,7 +654,7 @@ class SFTPTest (unittest.TestCase):
with open(localname, 'rb') as f:
self.assertEqual(text, f.read(128))
- self.assertEqual((41, 41), saved_progress[-1])
+ self.assertEqual([(41, 41)], saved_progress)
os.unlink(localname)
sftp.unlink(FOLDER + '/bunny.txt')
@@ -729,7 +730,8 @@ class SFTPTest (unittest.TestCase):
f.readv([(0, 12)])
with sftp.open(FOLDER + '/zero', 'r') as f:
- f.prefetch()
+ file_size = f.stat().st_size
+ f.prefetch(file_size)
f.read(100)
finally:
sftp.unlink(FOLDER + '/zero')
@@ -844,6 +846,11 @@ class SFTPTest (unittest.TestCase):
sftp.remove('%s/nonutf8data' % FOLDER)
+ def test_sftp_attributes_empty_str(self):
+ sftp_attributes = SFTPAttributes()
+ self.assertEqual(str(sftp_attributes), "?--------- 1 0 0 0 (unknown date) ?")
+
+
if __name__ == '__main__':
SFTPTest.init_loopback()
# logging is required by test_N_file_with_percent