From d158c5308697787ff921dc450bd83301bdec13d8 Mon Sep 17 00:00:00 2001 From: Nicolas Delaby <nicolas@nexedi.com> Date: Fri, 11 Sep 2009 17:23:39 +0000 Subject: [PATCH] test that all Portal Document Types implement Conversion cache git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@28983 20353a03-c40f-0410-a6d1-a30d3c3de9de --- .../ERP5OOo/tests/testOOoConversionCache.py | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/product/ERP5OOo/tests/testOOoConversionCache.py b/product/ERP5OOo/tests/testOOoConversionCache.py index 77044d91ff..40a1a10383 100644 --- a/product/ERP5OOo/tests/testOOoConversionCache.py +++ b/product/ERP5OOo/tests/testOOoConversionCache.py @@ -355,6 +355,37 @@ class TestDocumentConversionCache(ERP5TypeTestCase, ZopeTestCase.Functional): document.convert(format='txt') self.assertTrue(document.getConversion(format='txt')) + def test_08_check_conversion_cache_with_portal_document_type_list(self): + """Check cache conversion for all Portal Document Types + """ + print '\nCheck cache conversion for all Portal Document Types' + portal_type_list = list(self.portal.getPortalDocumentTypeList()) + + if 'File' in portal_type_list: + #File conversion is not implemented + portal_type_list.remove('File') + data_mapping = {'Drawing': 'TEST-en-002.sxd', + 'Text': 'TEST-en-002.doc', + 'Spreadsheet': 'TEST-en-002.sxc', + 'Presentation': 'TEST-en-002.sxi', + 'Web Page': 'TEST-en-002.html', + 'Image': 'TEST-en-002.gif', + #'File': 'TEST-en-002.rtf', + 'PDF': 'TEST-en-002.pdf'} + #Check that all portal_types are handled by test + self.assertEqual(len(portal_type_list), len([pt for pt in portal_type_list if pt in data_mapping])) + for portal_type in portal_type_list: + module = self.portal.getDefaultModule(portal_type=portal_type) + upload_file = makeFileUpload(data_mapping[portal_type]) + document = module.newContent(portal_type=portal_type) + document.edit(file=upload_file) + transaction.commit() + self.tic() + document.convert(format='txt') + document.convert(format='html') + self.assertTrue(document.getConversion(format='txt')) + self.assertTrue(document.getConversion(format='html')) + def test_suite(): suite = unittest.TestSuite() suite.addTest(unittest.makeSuite(TestDocumentConversionCache)) -- 2.30.9