Commit ec81da68 authored by Sebastien Robin's avatar Sebastien Robin

add a test to make sure that we will not have regression

fixed by revision 35192 (wrong sql connector used by Id tool)

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@35197 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 50e5299a
......@@ -3757,6 +3757,39 @@ class TestCMFActivity(ERP5TypeTestCase, LogInterceptor):
ZopeTestCase._print(message)
LOG('Testing... ',0,message)
self.TryNotificationSavedOnEventLogWhenSiteErrorLoggerRaises('SQLQueue')
def test_124_checkConflictErrorAndNoRemainingActivities(self):
"""
When an activity creates several activities, make sure that all newly
created activities are not commited if there is ZODB Conflict error
"""
from Products.CMFActivity.Activity import SQLQueue
old_MAX_MESSAGE_LIST_SIZE = SQLQueue.MAX_MESSAGE_LIST_SIZE
SQLQueue.MAX_MESSAGE_LIST_SIZE = 1
try:
activity_tool = self.getPortal().portal_activities
def doSomething(self):
self.serialize()
self.activate(activity='SQLQueue').getId()
self.activate(activity='SQLQueue').getTitle()
conn = self._p_jar
tid = self._p_serial
oid = self._p_oid
try:
conn.db().invalidate({oid: tid})
except TypeError:
conn.db().invalidate(tid, {oid: tid})
activity_tool.__class__.doSomething = doSomething
activity_tool.activate(activity='SQLQueue').doSomething()
get_transaction().commit()
activity_tool.distribute()
activity_tool.tic()
message_list = activity_tool.getMessageList()
self.assertEquals(['doSomething'],[x.method_id for x in message_list])
activity_tool.manageClearActivities(keep=0)
finally:
SQLQueue.MAX_MESSAGE_LIST_SIZE = old_MAX_MESSAGE_LIST_SIZE
def test_suite():
suite = unittest.TestSuite()
......
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