[Erp5-report] r28082 - /erp5/trunk/products/ERP5OOo/tests/testOOoConversionCache.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Wed Jul 15 18:02:36 CEST 2009
Author: nicolas
Date: Wed Jul 15 18:02:36 2009
New Revision: 28082
URL: http://svn.erp5.org?rev=28082&view=rev
Log:
Test conversion of TempObjects
Modified:
erp5/trunk/products/ERP5OOo/tests/testOOoConversionCache.py
Modified: erp5/trunk/products/ERP5OOo/tests/testOOoConversionCache.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5OOo/tests/testOOoConversionCache.py?rev=28082&r1=28081&r2=28082&view=diff
==============================================================================
--- erp5/trunk/products/ERP5OOo/tests/testOOoConversionCache.py [utf8] (original)
+++ erp5/trunk/products/ERP5OOo/tests/testOOoConversionCache.py [utf8] Wed Jul 15 18:02:36 2009
@@ -171,6 +171,41 @@
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))
More information about the Erp5-report
mailing list