Commit 3ec823f9 authored by Vincent Pelletier's avatar Vincent Pelletier

Check that deletion of messages in SQLDict does not happen too early (it can...

Check that deletion of messages in SQLDict does not happen too early (it can only happen after current message is executed).


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@19191 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent ddddbd89
...@@ -2598,6 +2598,33 @@ class TestCMFActivity(ERP5TypeTestCase): ...@@ -2598,6 +2598,33 @@ class TestCMFActivity(ERP5TypeTestCase):
LOG('Testing... ',0,message) LOG('Testing... ',0,message)
self.TryChangeSkinInActivity('SQLQueue') self.TryChangeSkinInActivity('SQLQueue')
def test_102_CheckSQLQueueDoesNotDeleteDuplicatesBeforeExecution(self, quiet=0, run=run_all_test):
if not run: return
if not quiet:
message = '\nCheck duplicates are not deleted before execution of original message (SQLQueue)'
ZopeTestCase._print(message)
LOG('Testing... ',0,message)
organisation = self.getPortal().organisation_module.newContent(portal_type='Organisation')
get_transaction().commit()
self.tic()
activity_tool = self.getActivityTool()
check_result_dict = {}
def checkActivityCount(self, other_tag):
if len(check_result_dict) == 0:
check_result_dict['done'] = activity_tool.countMessage(tag=other_tag)
try:
Organisation.checkActivityCount = checkActivityCount
organisation.activate(activity='SQLDict', tag='a').checkActivityCount(other_tag='b')
organisation.activate(activity='SQLDict', tag='b').checkActivityCount(other_tag='a')
get_transaction().commit()
self.assertEqual(len(activity_tool.getMessageList()), 2)
self.tic()
self.assertEqual(len(activity_tool.getMessageList()), 0)
self.assertEqual(len(check_result_dict), 1)
self.assertEqual(check_result_dict['done'], 1)
finally:
delattr(Organisation, 'checkActivityCount')
def test_suite(): def test_suite():
suite = unittest.TestSuite() suite = unittest.TestSuite()
suite.addTest(unittest.makeSuite(TestCMFActivity)) suite.addTest(unittest.makeSuite(TestCMFActivity))
......
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