From 30dbfa9a4fb5399d6915eafd8a5da1c710ffaa49 Mon Sep 17 00:00:00 2001 From: Matthias Mair Date: Mon, 16 May 2022 18:21:58 +0200 Subject: [PATCH] add tests for InvenTree.tasks --- InvenTree/InvenTree/test_tasks.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/InvenTree/InvenTree/test_tasks.py b/InvenTree/InvenTree/test_tasks.py index e9c9d9f01c..c00931b237 100644 --- a/InvenTree/InvenTree/test_tasks.py +++ b/InvenTree/InvenTree/test_tasks.py @@ -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)