[pywin32-checkins] pywin32/win32/test test_win32file.py,1.3,1.4
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: Mark H. <mha...@us...> - 2004-10-08 23:16:39
|
Update of /cvsroot/pywin32/pywin32/win32/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5564 Modified Files: test_win32file.py Log Message: Add EncryptFile/DecryptFile tests Index: test_win32file.py =================================================================== RCS file: /cvsroot/pywin32/pywin32/win32/test/test_win32file.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** test_win32file.py 12 Jun 2004 13:26:02 -0000 1.3 --- test_win32file.py 8 Oct 2004 23:16:27 -0000 1.4 *************** *** 1,4 **** import unittest ! import win32api, win32file, win32con, pywintypes import sys import os --- 1,4 ---- import unittest ! import win32api, win32file, win32con, pywintypes, winerror import sys import os *************** *** 151,154 **** --- 151,174 ---- shutil.rmtree(test_path) + class TestEncrypt(unittest.TestCase): + def testEncrypt(self): + fname = tempfile.mktemp("win32file_test") + f = open(fname, "wb") + f.write("hello") + f.close() + f = None + try: + try: + win32file.EncryptFile(fname) + except win32file.error, details: + if details[0] != winerror.ERROR_ACCESS_DENIED: + raise + print "It appears this is not NTFS - cant encrypt/decrypt" + win32file.DecryptFile(fname) + finally: + if f is not None: + f.close() + os.unlink(fname) + if __name__ == '__main__': unittest.main() |