本文整理汇总了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())