Commit 98bfee4f authored by Nicolas Dumazet's avatar Nicolas Dumazet

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.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@43304 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 7b5c4abd
...@@ -416,7 +416,7 @@ class TestInteractionWorkflow(ERP5TypeTestCase): ...@@ -416,7 +416,7 @@ class TestInteractionWorkflow(ERP5TypeTestCase):
self.createInteractionWorkflow() self.createInteractionWorkflow()
self.interaction.setProperties( self.interaction.setProperties(
'afterEdit', 'afterEdit',
method_id='setTitle', method_id='_setTitle',
after_script_name=('afterEdit',)) after_script_name=('afterEdit',))
params = 'sci,**kw' params = 'sci,**kw'
body = "context = sci.object\n" +\ body = "context = sci.object\n" +\
...@@ -567,7 +567,7 @@ context.setTitle('Bar') ...@@ -567,7 +567,7 @@ context.setTitle('Bar')
self.createInteractionWorkflow() self.createInteractionWorkflow()
self.interaction.setProperties( self.interaction.setProperties(
'regexp', 'regexp',
method_id='set.*', method_id='_set.* set.*',
after_script_name=('afterEdit',)) after_script_name=('afterEdit',))
call_list = self.portal.REQUEST['call_list'] = [] call_list = self.portal.REQUEST['call_list'] = []
...@@ -577,13 +577,17 @@ context.setTitle('Bar') ...@@ -577,13 +577,17 @@ context.setTitle('Bar')
organisation = self.organisation organisation = self.organisation
# all methods matching set.* regular expression are matched # all methods matching set.* regular expression are matched
organisation.setDescription('') organisation.setDescription('')
self.assertEquals(len(call_list), 1) # two calls: setDescription, _setDescription
organisation.setTitle('')
self.assertEquals(len(call_list), 2) self.assertEquals(len(call_list), 2)
organisation.setTitle('')
# two calls: setTitle, _setTitle
self.assertEquals(len(call_list), 4)
organisation.getDescription() organisation.getDescription()
self.assertEquals(len(call_list), 2) # no calls
self.assertEquals(len(call_list), 4)
organisation.edit(description='desc') 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): def test_security(self):
......
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