add tests for InvenTree.tasks

This commit is contained in:
Matthias Mair 2022-05-16 18:21:58 +02:00
parent cce3d3a35d
commit 30dbfa9a4f

View File

@ -41,3 +41,22 @@ class ScheduledTaskTests(TestCase):
# But the 'minutes' should have been updated
t = Schedule.objects.get(func=task)
self.assertEqual(t.minutes, 5)
class InvenTreeTaskTests(TestCase):
"""Unit tests for tasks"""
def test_task_hearbeat(self, name):
"""Test the task heartbeat"""
InvenTree.tasks.offload_task(InvenTree.tasks.heartbeat)
def test_task_delete_successful_tasks(self, name):
"""Test the task delete_successful_tasks"""
InvenTree.tasks.offload_task(InvenTree.tasks.delete_successful_tasks)
def test_task_delete_old_error_logs(self, name):
"""Test the task delete_old_error_logs"""
InvenTree.tasks.offload_task(InvenTree.tasks.delete_old_error_logs)
def test_task_check_for_updates(self, name):
"""Test the task check_for_updates"""
InvenTree.tasks.offload_task(InvenTree.tasks.check_for_updates)