def test_task_set_to_error_when_exception_raised(self): queue = get_queue() task = Task(name='install_plugin', cache={'plugin_id': -1}) self.env.db.add(task) self.env.db.commit() queue.put(task.uuid) def check_task_status_is_error(): self.env.db.refresh(task) return task.status == 'error' self.env.wait_for_true(check_task_status_is_error, timeout=2) self.assertEquals(task.progress, 100)
def __init__(self): self.queue = get_queue()