Commit 825e34e1 authored by Arnaud Fontaine's avatar Arnaud Fontaine

Ensure that accessors are re-generated by performing a commit after

each change on workflows rather than calling _aq_reset.



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@42998 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 68f61fbc
...@@ -41,7 +41,6 @@ from Products.ERP5Type.tests.Sequence import SequenceList ...@@ -41,7 +41,6 @@ from Products.ERP5Type.tests.Sequence import SequenceList
from Products.ERP5Type.Base import Base from Products.ERP5Type.Base import Base
from zExceptions import BadRequest from zExceptions import BadRequest
from Products.ERP5Type.tests.backportUnittest import skip from Products.ERP5Type.tests.backportUnittest import skip
from Products.ERP5Type.Tool.ClassTool import _aq_reset
from Products.ERP5Type.Workflow import addWorkflowByType from Products.ERP5Type.Workflow import addWorkflowByType
from Products.CMFCore.WorkflowCore import WorkflowException from Products.CMFCore.WorkflowCore import WorkflowException
...@@ -136,7 +135,8 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional): ...@@ -136,7 +135,8 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional):
""" """
self.getWorkflowTool().setChainForPortalTypes( self.getWorkflowTool().setChainForPortalTypes(
['Organisation'], ()) ['Organisation'], ())
_aq_reset()
transaction.commit()
def stepAssociateWorkflows(self, sequence=None, sequence_list=None, **kw): def stepAssociateWorkflows(self, sequence=None, sequence_list=None, **kw):
""" """
...@@ -144,7 +144,8 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional): ...@@ -144,7 +144,8 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional):
""" """
self.getWorkflowTool().setChainForPortalTypes( self.getWorkflowTool().setChainForPortalTypes(
['Organisation'], ('validation_workflow', 'edit_workflow')) ['Organisation'], ('validation_workflow', 'edit_workflow'))
_aq_reset()
transaction.commit()
def stepAssociateWorkflowsExcludingEdit(self, sequence=None, def stepAssociateWorkflowsExcludingEdit(self, sequence=None,
sequence_list=None, **kw): sequence_list=None, **kw):
...@@ -153,7 +154,8 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional): ...@@ -153,7 +154,8 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional):
""" """
self.getWorkflowTool().setChainForPortalTypes( self.getWorkflowTool().setChainForPortalTypes(
['Organisation'], ('validation_workflow',)) ['Organisation'], ('validation_workflow',))
_aq_reset()
transaction.commit()
def stepCreateObject(self, sequence=None, sequence_list=None, **kw): def stepCreateObject(self, sequence=None, sequence_list=None, **kw):
""" """
...@@ -950,6 +952,9 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional): ...@@ -950,6 +952,9 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional):
pw = self.getWorkflowTool() pw = self.getWorkflowTool()
dummy_worlflow_id = 'never_existent_workflow' dummy_worlflow_id = 'never_existent_workflow'
addWorkflowByType(pw, 'erp5_workflow', dummy_worlflow_id) addWorkflowByType(pw, 'erp5_workflow', dummy_worlflow_id)
transaction.commit()
cbt = pw._chains_by_type cbt = pw._chains_by_type
props = {} props = {}
for id, wf_ids in cbt.iteritems(): for id, wf_ids in cbt.iteritems():
...@@ -959,8 +964,7 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional): ...@@ -959,8 +964,7 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional):
pw.manage_changeWorkflows('', props = props) pw.manage_changeWorkflows('', props = props)
pw.manage_delObjects([dummy_worlflow_id]) pw.manage_delObjects([dummy_worlflow_id])
# Make sure that _aq_dynamic will be called again. transaction.commit()
_aq_reset()
try: try:
self.assertRaises(AttributeError, getattr, obj, self.assertRaises(AttributeError, getattr, obj,
...@@ -977,6 +981,8 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional): ...@@ -977,6 +981,8 @@ class TestBase(ERP5TypeTestCase, ZopeTestCase.Functional):
props['chain_%s' % id] = ','.join(wf_ids) props['chain_%s' % id] = ','.join(wf_ids)
pw.manage_changeWorkflows('', props = props) pw.manage_changeWorkflows('', props = props)
transaction.commit()
def test_14_UpdateRoleMappingwithNoDefinedRoleAndAcquisitionActivatedOnWorkflow(self, quiet=quiet, run=run_all_test): def test_14_UpdateRoleMappingwithNoDefinedRoleAndAcquisitionActivatedOnWorkflow(self, quiet=quiet, run=run_all_test):
"""updateRoleMappingsFor does a logical AND between all workflow defining security, """updateRoleMappingsFor does a logical AND between all workflow defining security,
if a workflow defines no permission and is set to acquire permissions, if a workflow defines no permission and is set to acquire permissions,
......
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