[Erp5-report] r43304 nicolas.dumazet - /erp5/trunk/products/ERP5/tests/

nobody at svn.erp5.org nobody at svn.erp5.org
Mon Feb 14 09:57:30 CET 2011


Author: nicolas.dumazet
Date: Mon Feb 14 09:57:29 2011
New Revision: 43304

URL: http://svn.erp5.org?rev=43304&view=rev
Log:
fix wrong test that expected edit() to call the public setter.

It happened sometime, with aq_dynamic, when a setter was overriden on the class
itself, that setFoo was called on a edit(foo=bar), as class methods were taking
priority over aq_dynamic-generated-setters.  Now, the correct behavior is back:
edit(foo=bar) calls the private setter directly, and never the public setter.

See "Workflow triggers and edit/_edit calling (or not) private or public
setters" email for reference.

Modified:
    erp5/trunk/products/ERP5/tests/testInteractionWorkflow.py

Modified: erp5/trunk/products/ERP5/tests/testInteractionWorkflow.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/tests/testInteractionWorkflow.py?rev=43304&r1=43303&r2=43304&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/tests/testInteractionWorkflow.py [utf8] (original)
+++ erp5/trunk/products/ERP5/tests/testInteractionWorkflow.py [utf8] Mon Feb 14 09:57:29 2011
@@ -416,7 +416,7 @@ class TestInteractionWorkflow(ERP5TypeTe
     self.createInteractionWorkflow()
     self.interaction.setProperties(
             'afterEdit',
-            method_id='setTitle',
+            method_id='_setTitle',
             after_script_name=('afterEdit',))
     params = 'sci,**kw'
     body = "context = sci.object\n" +\
@@ -567,7 +567,7 @@ context.setTitle('Bar')
     self.createInteractionWorkflow()
     self.interaction.setProperties(
             'regexp',
-            method_id='set.*',
+            method_id='_set.* set.*',
             after_script_name=('afterEdit',))
 
     call_list = self.portal.REQUEST['call_list'] = []
@@ -577,13 +577,17 @@ context.setTitle('Bar')
     organisation = self.organisation
     # all methods matching set.* regular expression are matched
     organisation.setDescription('')
-    self.assertEquals(len(call_list), 1)
-    organisation.setTitle('')
+    # two calls: setDescription, _setDescription
     self.assertEquals(len(call_list), 2)
+    organisation.setTitle('')
+    # two calls: setTitle, _setTitle
+    self.assertEquals(len(call_list), 4)
     organisation.getDescription()
-    self.assertEquals(len(call_list), 2)
+    # no calls
+    self.assertEquals(len(call_list), 4)
     organisation.edit(description='desc')
-    self.assertEquals(len(call_list), 3)
+    # two calls: one to _setProperty, and one to _setDescription
+    self.assertEquals(len(call_list), 6)
 
 
   def test_security(self):



More information about the Erp5-report mailing list