mirror of
https://github.com/django-q2/django-q2.git
synced 2026-10-09 18:00:55 +08:00
Added admin test for failure resubmission
This commit is contained in:
@@ -1,13 +1,15 @@
|
|||||||
from django.core.urlresolvers import reverse
|
from django.core.urlresolvers import reverse
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
|
from future.types.newstr import unicode
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from django_q import Task, schedule
|
from django_q import Task, schedule
|
||||||
|
from django_q.models import Failure
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.django_db
|
@pytest.mark.django_db
|
||||||
def test_admin_view(admin_client):
|
def test_admin_views(admin_client):
|
||||||
s = schedule('sched.test')
|
s = schedule('sched.test')
|
||||||
f = Task.objects.create(name='alfa-pappa-bravo-fail',
|
f = Task.objects.create(name='alfa-pappa-bravo-fail',
|
||||||
func='test.fail',
|
func='test.fail',
|
||||||
@@ -42,4 +44,10 @@ def test_admin_view(admin_client):
|
|||||||
response = admin_client.get(url)
|
response = admin_client.get(url)
|
||||||
assert response.status_code == 200
|
assert response.status_code == 200
|
||||||
|
|
||||||
# TODO resubmit the failure
|
# resubmit the failure
|
||||||
|
url = reverse('admin:django_q_failure_changelist')
|
||||||
|
data = {'action': 'retry_failed',
|
||||||
|
'_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
|
||||||
|
|||||||
Reference in New Issue
Block a user