From f44e6da5cbf7c8bafad71c91518b6ab082ee23fa Mon Sep 17 00:00:00 2001 From: Nicolas Delaby <nicolas@nexedi.com> Date: Tue, 21 Dec 2010 16:30:06 +0000 Subject: [PATCH] Check that given portal_type is always honoured git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@41622 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5OOo/tests/testIngestion.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/product/ERP5OOo/tests/testIngestion.py b/product/ERP5OOo/tests/testIngestion.py index fc77069de4..de8f22df59 100644 --- a/product/ERP5OOo/tests/testIngestion.py +++ b/product/ERP5OOo/tests/testIngestion.py @@ -1945,6 +1945,25 @@ return result self.assertEquals(new_doc.getData(), 'Hello World!') self.assertEquals(new_doc.getValidationState(), 'submitted') + def test_User_Portal_Type_parameter_is_honoured(self): + """Check that given portal_type is always honoured + """ + path = makeFilePath('import_region_category.xls') + data = open(path, 'r').read() + + document = self.portal.portal_contributions.newContent( + filename='import_region_category.xls', + data=data, + content_type='application/vnd.ms-excel', + reference='I.want.a.pdf', + portal_type='PDF') + transaction.commit() + self.tic()# Discover metadata will try change the portal_type + # but user decision take precedence: PDF must be created + result_list = self.portal.portal_catalog(reference='I.want.a.pdf') + self.assertEquals(len(result_list), 1) + self.assertEquals(result_list[0].getPortalType(), 'PDF') + def test_suite(): suite = unittest.TestSuite() suite.addTest(unittest.makeSuite(TestIngestion)) -- 2.30.9