Exemple #1
0
 def test_no_task(self):
     # set up
     self.patches.patch('mqueue.worker.DELAY', 0)
     
     # test
     with self.mysql.dao.SessionContext():
         task = worker._peek()
         self.assertIsNone(task)
Exemple #2
0
 def test_eta(self):
     # set up
     with self.mysql.dao.create_session() as session:
         session.add(TaskModel(args='{}', eta=datetime(2000, 1, 2), name='a.b.foo', queue='queue1', retries=0))
         session.add(TaskModel(args='{}', eta=datetime(2000, 1, 1), name='a.b.bar', queue='queue1', retries=0))
         
     # test
     with self.mysql.dao.SessionContext():
         task = worker._peek()
         self.assertEqual('a.b.bar', task.name)