Commit 7ffd8cc4 authored by Sebastien Robin's avatar Sebastien Robin

make sure we take care about different parameters while using group_method_id,...

make sure we take care about different parameters while using group_method_id, this is at least required for hot reindexing

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@13610 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 265fc629
......@@ -59,6 +59,7 @@ class TestCMFActivity(ERP5TypeTestCase):
title1 = 'title1'
title2 = 'title2'
company_id2 = 'Coramy'
company_id3 = 'toto'
def getTitle(self):
return "CMFActivity"
......@@ -1751,6 +1752,58 @@ class TestCMFActivity(ERP5TypeTestCase):
LOG('Testing... ',0,message)
self.checkIsMessageRegisteredMethod('SQLDict')
def TryGroupMethodId(self, activity):
"""
We will try to see if it is possible to give arguments
to methods wich use group_method_id
"""
portal = self.getPortal()
portal_catalog = self.getCatalogTool()
def setDescriptionObjectList(self,object_list,description=None,**kw):
failed_object_list = []
nb = len(object_list)
for o in object_list:
o.setDescription('%s_%s' % (nb,description))
object_list[:] = failed_object_list[:]
from Products.ERP5Catalog.CatalogTool import CatalogTool
CatalogTool.setDescriptionObjectList = setDescriptionObjectList
organisation_module = self.getOrganisationModule()
if not organisation_module.hasContent(self.company_id):
organisation_module.newContent(id=self.company_id)
if not organisation_module.hasContent(self.company_id2):
organisation_module.newContent(id=self.company_id2)
if not organisation_module.hasContent(self.company_id3):
organisation_module.newContent(id=self.company_id3)
org1 = organisation_module._getOb(self.company_id)
org2 = organisation_module._getOb(self.company_id2)
org3 = organisation_module._getOb(self.company_id3)
org1.setDescription('?')
org2.setDescription('?')
org3.setDescription('?')
org2 = organisation_module._getOb(self.company_id2)
org1.activate(activity=activity,
group_method_id='portal_catalog/setDescriptionObjectList',
).edit(description='a')
org2.activate(activity=activity,
group_method_id='portal_catalog/setDescriptionObjectList',
).edit(description='b')
org3.activate(activity=activity,
group_method_id='portal_catalog/setDescriptionObjectList',
).edit(description='b')
get_transaction().commit()
self.tic()
self.assertEquals(org1.getDescription(),'1_a')
self.assertEquals(org2.getDescription(),'2_b')
self.assertEquals(org3.getDescription(),'2_b')
def test_79_TryGroupMethodIdWithSQLDict(self, quiet=0, run=run_all_test):
# Test if after_tag can be used
if not run: return
if not quiet:
message = '\nTry Group Method Id With SQL Dict'
ZopeTestCase._print(message)
LOG('Testing... ',0,message)
self.TryGroupMethodId('SQLDict')
if __name__ == '__main__':
framework()
else:
......
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