本文整理匯總了Python中globaleaks.security.GLSecureTemporaryFile.close方法的典型用法代碼示例。如果您正苦於以下問題:Python GLSecureTemporaryFile.close方法的具體用法?Python GLSecureTemporaryFile.close怎麽用?Python GLSecureTemporaryFile.close使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類globaleaks.security.GLSecureTemporaryFile
的用法示例。
在下文中一共展示了GLSecureTemporaryFile.close方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_temporary_file_write_after_read
# 需要導入模塊: from globaleaks.security import GLSecureTemporaryFile [as 別名]
# 或者: from globaleaks.security.GLSecureTemporaryFile import close [as 別名]
def test_temporary_file_write_after_read(self):
a = GLSecureTemporaryFile(GLSettings.tmp_upload_path)
antani = "0123456789" * 10000
a.write(antani)
self.assertTrue(antani == a.read())
self.assertRaises(AssertionError, a.write, antani)
a.close()
示例2: test_temporary_file
# 需要導入模塊: from globaleaks.security import GLSecureTemporaryFile [as 別名]
# 或者: from globaleaks.security.GLSecureTemporaryFile import close [as 別名]
def test_temporary_file(self):
a = GLSecureTemporaryFile(GLSettings.tmp_upload_path)
antani = "0123456789" * 10000
a.write(antani)
self.assertTrue(antani == a.read())
a.close()
self.assertFalse(os.path.exists(a.filepath))
示例3: test_004_temporary_file_lost_key_due_to_eventual_bug_or_reboot
# 需要導入模塊: from globaleaks.security import GLSecureTemporaryFile [as 別名]
# 或者: from globaleaks.security.GLSecureTemporaryFile import close [as 別名]
def test_004_temporary_file_lost_key_due_to_eventual_bug_or_reboot(self):
a = GLSecureTemporaryFile(GLSetting.tmp_upload_path)
a.avoid_delete()
antani = "0123456789" * 10000
a.write(antani)
a.close()
self.assertTrue(os.path.exists(a.filepath))
os.remove(a.keypath)
self.assertRaises(IOError, GLSecureFile, a.filepath)
示例4: test_003_temporary_file_avoid_delete
# 需要導入模塊: from globaleaks.security import GLSecureTemporaryFile [as 別名]
# 或者: from globaleaks.security.GLSecureTemporaryFile import close [as 別名]
def test_003_temporary_file_avoid_delete(self):
a = GLSecureTemporaryFile(GLSetting.tmp_upload_path)
a.avoid_delete()
antani = "0123456789" * 10000
a.write(antani)
a.close()
self.assertTrue(os.path.exists(a.filepath))
b = GLSecureFile(a.filepath)
self.assertTrue(antani == b.read())