Commit a5e5754c authored by Nicolas Delaby's avatar Nicolas Delaby

Test conversion of TempObjects

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@28082 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 855b324a
......@@ -171,6 +171,41 @@ class TestDocumentConversionCache(ERP5TypeTestCase, ZopeTestCase.Functional):
self.assertTrue(document.hasConversion(format=format), 'Cache Storage failed for %s' % (format))
self.assertTrue(document.getConversionSize(format=format))
def test_02_PersistentCacheConversionOfTempObject(self):
"""
Test Conversion Cache mechanism
"""
print '\nPersistent Cache Conversion Of Temp Objects'
filename = 'TEST-en-002.doc'
file = makeFileUpload(filename)
document = self.portal.portal_contributions.newContent(file=file, temp_object=1)
document.convertToBaseFormat()
format_list = document.getTargetFormatList()
if not format_list:
self.fail('Target format list is empty')
#Test Conversion Cache
for format in format_list:
document.convert(format=format)
transaction.commit()
self.assertTrue(document.hasConversion(format=format), 'Cache Storage failed for %s' % (format))
self.assertTrue(document.getConversionSize(format=format))
document.clearConversionCache()
transaction.commit()
#Test Cache is cleared
for format in format_list:
self.assertFalse(document.hasConversion(format=format), 'Cache Storage failed for %s' % (format))
self.assertEqual(document.getConversionSize(format=format), 0)
document.clearConversionCache()
transaction.commit()
#Test Conversion Cache after clearConversionCache
for format in format_list:
document.convert(format=format)
transaction.commit()
self.assertTrue(document.hasConversion(format=format), 'Cache Storage failed for %s' % (format))
self.assertTrue(document.getConversionSize(format=format))
def test_suite():
suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestDocumentConversionCache))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment