def test_eq3(self):
     deferred1 = def_srv.DeferredServiceHandle(
         '123-abc',
         constants.UPLOAD_FILE_TASK,
         status='HAPPY-NONEXISTING_STATUS')
     deferred2 = def_srv.DeferredServiceHandle('123-abc',
                                               constants.UPDATE_MDATA_TASK)
     self.assertEqual(deferred1, deferred2)
 def test_update_status(self):
     old_status = constants.PENDING_ON_WORKER_STATUS
     new_status = constants.SUCCESS_STATUS
     deferred = def_srv.DeferredServiceHandle('123-abc',
                                              constants.UPLOAD_FILE_TASK)
     self.assertEqual(deferred.status, old_status)
     deferred.update_status(new_status)
     self.assertEqual(deferred.status, new_status)
     self.assertNotEqual(None, deferred.last_updated)
Exemple #3
0
 def call_service(cls, args):
     task_id = task_launcher.TaskLauncher.launch_task(args)
     deferred_task = deferred.DeferredServiceHandle(task_id, cls.task_type)
     return deferred_task
 def test_add1(self):
     deferred2 = def_srv.DeferredServiceHandle('345-ab12a',
                                               constants.UPLOAD_FILE_TASK)
     self.deferred_coll.add(deferred2)
     self.assertTrue(2, len(self.deferred_coll.tasks))
 def test_eq1(self):
     deferred1 = def_srv.DeferredServiceHandle('123-abc',
                                               constants.UPLOAD_FILE_TASK)
     deferred2 = def_srv.DeferredServiceHandle('345-aaa',
                                               constants.UPLOAD_FILE_TASK)
     self.assertNotEqual(deferred1, deferred2)
 def setUp(self):
     self.deferred = def_srv.DeferredServiceHandle(
         '111', constants.UPLOAD_FILE_TASK)
     self.deferred_coll = def_srv.DeferredServiceHandleCollection()
     self.deferred_coll.tasks = {self.deferred.task_id: self.deferred}
 def test_eq4(self):
     deferred = def_srv.DeferredServiceHandle('abc-123-abc',
                                              constants.UPLOAD_FILE_TASK)
     other = {'task_id': 'abc-123-abc'}
     self.assertRaises(TypeError, deferred.__eq__, other)