def taskRemove(request): try: tasks.remove('id', request['id'], request['time-destroy']) except Exception, e: LOG.error(e) return jsonrpc.result_error('ServerError', { 'status': 'error', 'message': 'Unable to remove task' })
def test_task_remove(self): """Check state changing""" o = tasks.Task({ "name": str(uuid.uuid4()), "customer": str(uuid.uuid4()), "rate_id": str(uuid.uuid4()), "queue_id": str(uuid.uuid4()), }) tasks.add(o) ts = int(time.time()+10) tasks.remove('id', o.base_id, ts) o.set({'state': tasks.constants.STATE_DELETED, 'time_destroy':ts}) with database.DBConnect(primarykey=o.base_id) as db: o1 = tasks.Task(db.find_one('tasks', {'base_id':o.base_id, 'record_id': '0' })) self.assertEquals(o1.values, o.values)