예제 #1
0
파일: tests.py 프로젝트: rick446/MonQ
 def test_clear_complete_keep(self):
     # Create complete, 'keep' task
     doc = TaskDoc.make(dict(
             task=dict(name='foo', args=[], kwargs={}),
             result_type='keep',
             state='complete'))
     doc.m.save()
     # timeout tasks
     TaskObject.clear_complete()
     # Make sure the doc is gone
     self.assertEqual(TaskDoc.m.find().count(), 1)
예제 #2
0
파일: tests.py 프로젝트: rick446/MonQ
 def test_timeout_tasks(self):
     # Create busy task
     doc = TaskDoc.make(dict(
             task=dict(name='foo',args=[],kwargs={}),
             time=dict(start=datetime.utcnow()),
             state='busy'))
     doc.m.save()
     # timeout tasks
     TaskObject.timeout_tasks(
         datetime.utcnow() + timedelta(seconds=10))
     doc = TaskDoc.m.get()
     # Make sure the doc is ready and unlocked
     self.assertEqual(doc.state, 'ready')
     self.assertEqual(doc.process, None)