mirror of
https://github.com/django-q2/django-q2.git
synced 2026-10-01 14:38:13 +08:00
Rerun successful tasks (#99)
* Move logic that resubmits a task and then deletes the original into an action function that can be used for both failure and success resubmission. * Use the resubmit_task action in the FailAdmin. * Add the resubmit_task action to the TaskAdmin class. * Update resubmit failure test to reflect using the new resubmit action. * Add a test for resubmitting successful tasks. --------- Co-authored-by: Scott Pashley
This commit is contained in:
co-authored by
Scott Pashley
parent
f8321e7f54
commit
23c06a38eb
@@ -64,7 +64,7 @@ def test_admin_views(admin_client, monkeypatch):
|
||||
|
||||
# resubmit the failure
|
||||
url = reverse("admin:django_q_failure_changelist")
|
||||
data = {"action": "retry_failed", "_selected_action": [f.pk]}
|
||||
data = {"action": "resubmit_task", "_selected_action": [f.pk]}
|
||||
response = admin_client.post(url, data)
|
||||
assert response.status_code == 302
|
||||
assert Failure.objects.filter(name=f.id).exists() is False
|
||||
@@ -84,3 +84,10 @@ def test_admin_views(admin_client, monkeypatch):
|
||||
data = {"post": "yes"}
|
||||
response = admin_client.post(url, data)
|
||||
assert response.status_code == 302
|
||||
# Resubmit a successful task.
|
||||
url = reverse("admin:django_q_success_changelist")
|
||||
data = {"action": "resubmit_task", "_selected_action": [t.pk]}
|
||||
initial_queue_count = OrmQ.objects.count()
|
||||
response = admin_client.post(url, data)
|
||||
assert response.status_code == 302
|
||||
assert OrmQ.objects.count() > initial_queue_count
|
||||
|
||||
Reference in New Issue
Block a user