[Zope-CVS] CVS: Products/Scheduler/tests - testScheduler.py:1.2

Chris McDonough chrism@zope.com
Mon, 2 Jun 2003 16:39:10 -0400


Update of /cvs-repository/Products/Scheduler/tests
In directory cvs.zope.org:/tmp/cvs-serv4446/tests

Modified Files:
	testScheduler.py 
Log Message:
Change getPendingTasks API to return taskid.

Add consistency checks.


=== Products/Scheduler/tests/testScheduler.py 1.1 => 1.2 ===
--- Products/Scheduler/tests/testScheduler.py:1.1	Sat May 17 14:46:08 2003
+++ Products/Scheduler/tests/testScheduler.py	Mon Jun  2 16:38:40 2003
@@ -79,12 +79,23 @@
         now = time.time()
         task = Task('test', now, '/put_stuff')
         app.portal_scheduler.schedule(now, task)
-        t, scheduled_task = app.portal_scheduler.getPendingTasks()[0]
+        t, scheduled_task, taskid = app.portal_scheduler.getPendingTasks()[0]
         self.assertEqual(t, int(now))
         self.assertEqual(aq_base(scheduled_task), task)
-        app.portal_scheduler.deschedule(task.taskid)
+        app.portal_scheduler.deschedule(taskid)
         self.assert_(not app.portal_scheduler.getPendingTasks())
-        
+
+    def testConsistency(self):
+        app = self.app
+        now = time.time()
+        tids = []
+        for x in range(100):
+            task = Task('test', now, '/put_stuff')
+            tids.append(app.portal_scheduler.schedule(now, task))
+        assert app.portal_scheduler.checkConsistency() == 'OK'
+        for tid in tids:
+            app.portal_scheduler.deschedule(tid)
+            assert app.portal_scheduler.checkConsistency() == 'OK'
 
 from AccessControl import ModuleSecurityInfo
 ModuleSecurityInfo('Products').declarePublic('Scheduler')