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
|
||||||
|
@ -591,7 +591,7 @@ class SFTPTest (unittest.TestCase):
|
||||||
self.assertEqual('93DE4788FCA28D471516963A1FE3856A', u(hexlify(sum)).upper())
|
self.assertEqual('93DE4788FCA28D471516963A1FE3856A', u(hexlify(sum)).upper())
|
||||||
sum = f.check('md5', 0, 0, 510)
|
sum = f.check('md5', 0, 0, 510)
|
||||||
self.assertEqual('EB3B45B8CD55A0707D99B177544A319F373183D241432BB2157AB9E46358C4AC90370B5CADE5D90336FC1716F90B36D6',
|
self.assertEqual('EB3B45B8CD55A0707D99B177544A319F373183D241432BB2157AB9E46358C4AC90370B5CADE5D90336FC1716F90B36D6',
|
||||||
u(hexlify(sum)).upper())
|
u(hexlify(sum)).upper())
|
||||||
finally:
|
finally:
|
||||||
sftp.unlink(FOLDER + '/kitty.txt')
|
sftp.unlink(FOLDER + '/kitty.txt')
|
||||||
|
|
||||||
|
@ -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