admin: ensure clean_expired_models is called during tests

This commit is contained in:
Jens Langhammer 2020-12-17 00:17:20 +01:00
parent 64d2a216f0
commit 0b36aad5c8
1 changed files with 3 additions and 0 deletions

View File

@ -6,6 +6,7 @@ from django.test import TestCase
from authentik import __version__ from authentik import __version__
from authentik.core.models import Group, User from authentik.core.models import Group, User
from authentik.core.tasks import clean_expired_models
class TestAdminAPI(TestCase): class TestAdminAPI(TestCase):
@ -21,6 +22,7 @@ class TestAdminAPI(TestCase):
def test_tasks(self): def test_tasks(self):
"""Test Task API""" """Test Task API"""
clean_expired_models.delay()
response = self.client.get(reverse("authentik_api:admin_system_tasks-list")) response = self.client.get(reverse("authentik_api:admin_system_tasks-list"))
self.assertEqual(response.status_code, 200) self.assertEqual(response.status_code, 200)
body = loads(response.content) body = loads(response.content)
@ -30,6 +32,7 @@ class TestAdminAPI(TestCase):
def test_tasks_retry(self): def test_tasks_retry(self):
"""Test Task API (retry)""" """Test Task API (retry)"""
clean_expired_models.delay()
response = self.client.post( response = self.client.post(
reverse( reverse(
"authentik_api:admin_system_tasks-retry", "authentik_api:admin_system_tasks-retry",