Example #1
0
 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))
Example #2
0
 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()
Example #3
0
 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()
Example #4
0
 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))
Example #5
0
 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)
Example #6
0
 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())