summaryrefslogtreecommitdiffhomepage
path: root/tests/test_sftp.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_sftp.py')
-rw-r--r--tests/test_sftp.py21
1 files changed, 11 insertions, 10 deletions
diff --git a/tests/test_sftp.py b/tests/test_sftp.py
index 288541b9..a86fca5d 100644
--- a/tests/test_sftp.py
+++ b/tests/test_sftp.py
@@ -185,34 +185,35 @@ class TestSFTP(object):
except:
pass
- def test_5a_posix_rename(self):
+ def test_5a_posix_rename(self, sftp):
"""Test posix-rename@openssh.com protocol extension."""
try:
# first check that the normal rename works as specified
- with sftp.open(FOLDER + '/a', 'w') as f:
+ with sftp.open(sftp.FOLDER + '/a', 'w') as f:
f.write('one')
- sftp.rename(FOLDER + '/a', FOLDER + '/b')
- with sftp.open(FOLDER + '/a', 'w') as f:
+ sftp.rename(sftp.FOLDER + '/a', sftp.FOLDER + '/b')
+ with sftp.open(sftp.FOLDER + '/a', 'w') as f:
f.write('two')
try:
- sftp.rename(FOLDER + '/a', FOLDER + '/b')
+ sftp.rename(sftp.FOLDER + '/a', sftp.FOLDER + '/b')
self.assertTrue(False, 'no exception when rename-ing onto existing file')
except (OSError, IOError):
pass
# now check with the posix_rename
- sftp.posix_rename(FOLDER + '/a', FOLDER + '/b')
- with sftp.open(FOLDER + '/b', 'r') as f:
+ sftp.posix_rename(sftp.FOLDER + '/a', sftp.FOLDER + '/b')
+ with sftp.open(sftp.FOLDER + '/b', 'r') as f:
data = u(f.read())
- self.assertEqual('two', data, "Contents of renamed file not the same as original file")
+ err = "Contents of renamed file not the same as original file"
+ assert data == "two", err
finally:
try:
- sftp.remove(FOLDER + '/a')
+ sftp.remove(sftp.FOLDER + '/a')
except:
pass
try:
- sftp.remove(FOLDER + '/b')
+ sftp.remove(sftp.FOLDER + '/b')
except:
pass