Add getcwd test
This commit is contained in:
parent
ab8d874064
commit
aa8ea3c4d4
|
@ -26,7 +26,6 @@ do test file operations in (so no existing files will be harmed).
|
||||||
from binascii import hexlify
|
from binascii import hexlify
|
||||||
import os
|
import os
|
||||||
import warnings
|
import warnings
|
||||||
import sys
|
|
||||||
import threading
|
import threading
|
||||||
import unittest
|
import unittest
|
||||||
from tempfile import mkstemp
|
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'))
|
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'
|
utf8_folder = b'/\xc3\xbcnic\xc3\xb8\x64\x65'
|
||||||
|
|
||||||
|
|
||||||
def get_sftp():
|
def get_sftp():
|
||||||
global sftp
|
global sftp
|
||||||
return sftp
|
return sftp
|
||||||
|
@ -675,6 +675,25 @@ class SFTPTest (unittest.TestCase):
|
||||||
os.unlink(localname)
|
os.unlink(localname)
|
||||||
sftp.unlink(FOLDER + '/bunny.txt')
|
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):
|
def XXX_test_M_seek_append(self):
|
||||||
"""
|
"""
|
||||||
verify that seek does't affect writes during append.
|
verify that seek does't affect writes during append.
|
||||||
|
|
Loading…
Reference in New Issue