def test_requeue_job(self): """ Ensure that a failed job gets requeued when rq_requeue_job is called """ def failing_job(): raise ValueError queue = get_queue('default') job = queue.enqueue(failing_job) worker = get_worker('default') worker.work(burst=True) job.refresh() self.assertTrue(job.is_failed) self.client.post(reverse('rq_requeue_job', args=[queue.connection_name, queue.name, job.id]), {'requeue': 'Requeue'}) self.assertIn(job, queue.jobs) job.delete()
def test_requeue_job(self): """ Ensure that a failed job gets requeued when rq_requeue_job is called """ def failing_job(): raise ValueError queue = get_queue('default') queue_index = get_failed_queue_index('default') job = queue.enqueue(failing_job) worker = get_worker('default') worker.work(burst=True) job.refresh() self.assertTrue(job.is_failed) self.client.post(reverse('rq_requeue_job', args=[queue_index, job.id]), {'requeue': 'Requeue'}) self.assertIn(job, queue.jobs) job.delete()
def test_requeue_job(self): """ Ensure that a failed job gets requeued when rq_requeue_job is called """ def failing_job(): raise ValueError queue = get_queue("default") queue_index = get_failed_queue_index("default") job = queue.enqueue(failing_job) worker = get_worker("default") worker.work(burst=True) job.refresh() self.assertTrue(job.is_failed) self.client.post(reverse("rq_requeue_job", args=[queue_index, job.id]), {"requeue": "Requeue"}) self.assertIn(job, queue.jobs) job.delete()