Commit c092bf82 authored by Yoshinori Okuji's avatar Yoshinori Okuji

Add tests for scheduling


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@4411 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 35e79588
...@@ -563,6 +563,34 @@ class TestCMFActivity(ERP5TypeTestCase): ...@@ -563,6 +563,34 @@ class TestCMFActivity(ERP5TypeTestCase):
self.tic() self.tic()
self.assertEquals(o.getCorporateName(), 'cd') self.assertEquals(o.getCorporateName(), 'cd')
def CheckScheduling(self, activity):
"""
Check if active objects with different after parameters are executed in a correct order
"""
portal = self.getPortal()
organisation_module = self.getOrganisationModule()
if not organisation_module.hasContent(self.company_id):
organisation_module.newContent(id=self.company_id)
o = portal.organisation._getOb(self.company_id)
o.setTitle('?')
self.assertEquals(o.getTitle(), '?')
get_transaction().commit()
self.tic()
def toto(self, s):
self.setTitle(self.getTitle() + s)
o.__class__.toto = toto
o.activate(tag = 'toto', activity = activity).toto('a')
get_transaction().commit()
o.activate(after_tag = 'titi', activity = activity).toto('b')
get_transaction().commit()
o.activate(tag = 'titi', after_tag = 'toto', activity = activity).setTitle('c')
get_transaction().commit()
self.tic()
self.assertEquals(o.getTitle(), 'cb')
def test_01_DeferedSetTitleSQLDict(self, quiet=0, run=run_all_test): def test_01_DeferedSetTitleSQLDict(self, quiet=0, run=run_all_test):
# Test if we can add a complete sales order # Test if we can add a complete sales order
if not run: return if not run: return
...@@ -1123,6 +1151,24 @@ class TestCMFActivity(ERP5TypeTestCase): ...@@ -1123,6 +1151,24 @@ class TestCMFActivity(ERP5TypeTestCase):
LOG('Testing... ',0,message) LOG('Testing... ',0,message)
self.TryAfterTag('SQLQueue') self.TryAfterTag('SQLQueue')
def test_61_CheckSchedulingWithSQLDict(self, quiet=0, run=run_all_test):
# Test if scheduling is correct with SQLDict
if not run: return
if not quiet:
message = '\nCheck Scheduling With SQL Dict'
ZopeTestCase._print(message)
LOG('Testing... ',0,message)
self.CheckScheduling('SQLDict')
def test_61_CheckSchedulingWithSQLQueue(self, quiet=0, run=run_all_test):
# Test if scheduling is correct with SQLQueue
if not run: return
if not quiet:
message = '\nCheck Scheduling With SQL Queue'
ZopeTestCase._print(message)
LOG('Testing... ',0,message)
self.CheckScheduling('SQLQueue')
if __name__ == '__main__': if __name__ == '__main__':
framework() framework()
......
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