[Erp5-report] r12009 - /erp5/trunk/products/ERP5/tests/testBase.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Thu Jan 11 12:19:24 CET 2007
Author: yo
Date: Thu Jan 11 12:19:22 2007
New Revision: 12009
URL: http://svn.erp5.org?rev=12009&view=rev
Log:
Here is a test for a bug about infinite recursions of _aq_dynamic when an associated workflow is not present.
Modified:
erp5/trunk/products/ERP5/tests/testBase.py
Modified: erp5/trunk/products/ERP5/tests/testBase.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/tests/testBase.py?rev=12009&r1=12008&r2=12009&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/tests/testBase.py (original)
+++ erp5/trunk/products/ERP5/tests/testBase.py Thu Jan 11 12:19:22 2007
@@ -933,6 +933,48 @@
tmp_object.edit(title='new title')
self.assertEquals('new title', tmp_object.getTitle())
+ def test_13_aqDynamicWithNonExistentWorkflow(self, quiet=quiet, run=run_all_test):
+ """Test if _aq_dynamic still works even if an associated workflow
+ is not present in the portal. This may cause an infinite recursion."""
+ if not run: return
+
+ portal = self.getPortal()
+ portal_type = "Organisation"
+ module = portal.getDefaultModule(portal_type = portal_type)
+ obj = module.newContent(portal_type = portal_type)
+
+ # Add a non-existent workflow.
+ pw = self.getWorkflowTool()
+ dummy_worlflow_id = 'never_existent_workflow'
+ pw.manage_addWorkflow('dc_workflow (Web-configurable workflow)',
+ dummy_worlflow_id)
+ cbt = pw._chains_by_type
+ props = {}
+ for id, wf_ids in cbt.iteritems():
+ if id == portal_type:
+ wf_ids = list(wf_ids) + [dummy_worlflow_id]
+ props['chain_%s' % id] = ','.join(wf_ids)
+ pw.manage_changeWorkflows('', props = props)
+ pw.manage_delObjects([dummy_worlflow_id])
+
+ # Make sure that _aq_dynamic will be called again.
+ _aq_reset()
+
+ try:
+ self.assertRaises(AttributeError, obj.thisMethodShouldNotBePresent)
+ finally:
+ # Make sure that the artificial workflow is not referred to any longer.
+ cbt = pw._chains_by_type
+ props = {}
+ for id, wf_ids in cbt.iteritems():
+ if id == portal_type:
+ # Remove the non-existent workflow.
+ wf_ids = [wf_id for wf_id in wf_ids \
+ if wf_id != dummy_worlflow_id]
+ props['chain_%s' % id] = ','.join(wf_ids)
+ pw.manage_changeWorkflows('', props = props)
+
+
class TestERP5PropertyManager(unittest.TestCase):
"""Tests for ERP5PropertyManager.
"""
More information about the Erp5-report
mailing list