summaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorScott Maxwell <scott@codecobblers.com>2014-01-16 19:36:04 -0800
committerScott Maxwell <scott@codecobblers.com>2014-01-16 19:36:04 -0800
commitaa8ea3c4d42d508a722fdf4ea635ff5e609cca1b (patch)
treee856ac8581958111f4fe751777898a97c3e859bd /tests
parentab8d874064d0d9ad298b0630d2ed281fde7e9b94 (diff)
Add getcwd test
Diffstat (limited to 'tests')
-rwxr-xr-xtests/test_sftp.py23
1 files changed, 21 insertions, 2 deletions
diff --git a/tests/test_sftp.py b/tests/test_sftp.py
index 271c08b5..f8fab1ce 100755
--- a/tests/test_sftp.py
+++ b/tests/test_sftp.py
@@ -26,7 +26,6 @@ do test file operations in (so no existing files will be harmed).
from binascii import hexlify
import os
import warnings
-import sys
import threading
import unittest
from tempfile import mkstemp
@@ -75,6 +74,7 @@ g_big_file_test = True
unicode_folder = eval(compile(r"u'\u00fcnic\u00f8de'" if PY2 else r"'\u00fcnic\u00f8de'", 'test_sftp.py', 'eval'))
utf8_folder = b'/\xc3\xbcnic\xc3\xb8\x64\x65'
+
def get_sftp():
global sftp
return sftp
@@ -591,7 +591,7 @@ class SFTPTest (unittest.TestCase):
self.assertEqual('93DE4788FCA28D471516963A1FE3856A', u(hexlify(sum)).upper())
sum = f.check('md5', 0, 0, 510)
self.assertEqual('EB3B45B8CD55A0707D99B177544A319F373183D241432BB2157AB9E46358C4AC90370B5CADE5D90336FC1716F90B36D6',
- u(hexlify(sum)).upper())
+ u(hexlify(sum)).upper())
finally:
sftp.unlink(FOLDER + '/kitty.txt')
@@ -675,6 +675,25 @@ class SFTPTest (unittest.TestCase):
os.unlink(localname)
sftp.unlink(FOLDER + '/bunny.txt')
+ def test_O_getcwd(self):
+ """
+ verify that chdir/getcwd work.
+ """
+ self.assertEqual(None, sftp.getcwd())
+ root = sftp.normalize('.')
+ if root[-1] != '/':
+ root += '/'
+ try:
+ sftp.mkdir(FOLDER + '/alpha')
+ sftp.chdir(FOLDER + '/alpha')
+ self.assertEqual('/' + FOLDER + '/alpha', sftp.getcwd())
+ finally:
+ sftp.chdir(root)
+ try:
+ sftp.rmdir(FOLDER + '/alpha')
+ except:
+ pass
+
def XXX_test_M_seek_append(self):
"""
verify that seek does't affect writes during append.