Commit a2d033d7 authored by Nicolas Dumazet's avatar Nicolas Dumazet

rewrite testContributionRegistryTool

create explicitely the predicates we want instead of relying on installation
of BTs (that could include unwanted predicates). This test hence tests
only the Tool, and not the BTs.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@41488 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 0c7eb82c
......@@ -39,7 +39,7 @@ class TestContributionRegistryTool(ERP5TypeTestCase):
return "Contribution Registry Tool"
def getBusinessTemplateList(self):
return ('erp5_base', 'erp5_ingestion', 'erp5_web', 'erp5_dms',)
return ('erp5_base',)
def afterSetUp(self):
self.setUpTestScript()
......@@ -94,28 +94,59 @@ return predicate.getDestinationPortalType()
def setUpPredicate(self):
portal_contribution_registry = self.portal.portal_contribution_registry
if getattr(portal_contribution_registry, 'webpage_mimetype', None) is None:
predicate_id = 'webpage_by_content_type'
if getattr(portal_contribution_registry, predicate_id, None) is None:
predicate = portal_contribution_registry.newContent(
portal_type='Contribution Predicate',
id='webpage_mimetype')
predicate._setMembershipCriterionCategoryList(['mime_type/text/html'])
predicate._setMembershipCriterionBaseCategoryList(['mime_type'])
id=predicate_id)
predicate.setCriterion('content_type', identity=['text/html'])
predicate.setDestinationPortalType('Web Page')
transaction.commit()
self.tic()
if getattr(portal_contribution_registry, 'my_predicate', None) is None:
predicate_id = 'webpage_by_extension'
if getattr(portal_contribution_registry, predicate_id, None) is None:
predicate = portal_contribution_registry.newContent(
portal_type='Contribution Predicate',
id='my_predicate')
predicate._setMembershipCriterionCategoryList(['mime_type/message/rfc822'])
predicate._setMembershipCriterionBaseCategoryList(['mime_type'])
predicate.setCriterion('file_extension', identity=['eml'])
id=predicate_id)
predicate.setCriterion('extension_from_filename', identity=['html'])
predicate.setDestinationPortalType('Web Page')
transaction.commit()
self.tic()
predicate_id = 'email_by_extension_and_content_type'
if getattr(portal_contribution_registry, predicate_id, None) is None:
predicate = portal_contribution_registry.newContent(
portal_type='Contribution Predicate',
id=predicate_id)
predicate.setCriterion('extension_from_filename', identity=['eml'])
predicate.setCriterion('content_type', identity=['message/rfc822'])
predicate.setDestinationPortalType('Mail Message')
predicate.setTestMethodId('IngestionFile_testEvent')
transaction.commit()
self.tic()
predicate_id = 'text_by_extension'
if getattr(portal_contribution_registry, predicate_id, None) is None:
predicate = portal_contribution_registry.newContent(
portal_type='Contribution Predicate',
id=predicate_id)
predicate.setCriterion('extension_from_filename', identity=['odt', 'txt'])
predicate.setDestinationPortalType('Text')
transaction.commit()
self.tic()
predicate_id = 'image_by_extension'
if getattr(portal_contribution_registry, predicate_id, None) is None:
predicate = portal_contribution_registry.newContent(
portal_type='Contribution Predicate',
id=predicate_id)
predicate.setCriterion('extension_from_filename', identity=['jpg', 'png'])
predicate.setDestinationPortalType('Image')
transaction.commit()
self.tic()
def testFindPortalTypeName(self, quiet=0, run=run_all_test):
tool = self.portal.portal_contribution_registry
......
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