diff --git a/product/ERP5Type/tests/testERP5Type.py b/product/ERP5Type/tests/testERP5Type.py index 85cb3503e199f3fc1ecf7ea316c947d57d0a2f8f..9d74e8806d840dc712a24baf8f0de867f27d2b11 100644 --- a/product/ERP5Type/tests/testERP5Type.py +++ b/product/ERP5Type/tests/testERP5Type.py @@ -131,6 +131,9 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): self.getTypesTool().getTypeInfo('Person').filter_content_types = 0 transaction.commit() + # save workflow chain for Person type + self.person_chain = self.getWorkflowTool().getChainFor('Person') + def beforeTearDown(self): transaction.abort() for module in [ self.getPersonModule(), @@ -143,6 +146,10 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): self.getTypesTool().getTypeInfo('Person').acquire_local_roles = self.person_acquire_local_roles self.portal.portal_caches.clearAllCache() + # restore workflows for other tests + self.getWorkflowTool().setChainForPortalTypes( + ['Person'], self.person_chain) + super(TestERP5Type, self).beforeTearDown() def loginWithNoRole(self): @@ -2436,25 +2443,21 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): def test_aq_reset_on_workflow_chain_change(self): doc = self.portal.person_module.newContent(portal_type='Person') - ti = self.getTypesTool()['Person'] self.assertFalse(hasattr(doc, 'getCausalityState')) # chain the portal type with a workflow that has 'causality_state' as # state variable name, this should regenerate the getCausalityState # accessor. This test might have to be updated whenever # delivery_causality_workflow changes. - self.portal.portal_workflow.manage_changeWorkflows( - default_chain='', - props=dict(chain_Person='delivery_causality_workflow')) + self.getWorkflowTool().setChainForPortalTypes( + ['Person'], ('delivery_causality_workflow')) transaction.commit() self.assertTrue(hasattr(doc, 'getCausalityState')) def test_aq_reset_on_workflow_method_change(self): doc = self.portal.person_module.newContent(portal_type='Person') - ti = self.getTypesTool()['Person'] - self.portal.portal_workflow.manage_changeWorkflows( - default_chain='', - props=dict(chain_Person='delivery_causality_workflow')) + self.getWorkflowTool().setChainForPortalTypes( + ['Person'], ('delivery_causality_workflow')) transaction.commit() self.assertTrue(hasattr(doc, 'diverge')) @@ -2475,10 +2478,8 @@ class TestERP5Type(PropertySheetTestCase, LogInterceptor): def test_aq_reset_on_workflow_state_variable_change(self): doc = self.portal.person_module.newContent(portal_type='Person') - ti = self.getTypesTool()['Person'] - self.portal.portal_workflow.manage_changeWorkflows( - default_chain='', - props=dict(chain_Person='delivery_causality_workflow')) + self.getWorkflowTool().setChainForPortalTypes( + ['Person'], ('delivery_causality_workflow')) transaction.commit() self.assertTrue(hasattr(doc, 'getCausalityState'))