diff --git a/backend/tests/tasks/test_cleanup_orphaned_resources.py b/backend/tests/tasks/test_cleanup_orphaned_resources.py index 9f630e796..c07c3faf4 100644 --- a/backend/tests/tasks/test_cleanup_orphaned_resources.py +++ b/backend/tests/tasks/test_cleanup_orphaned_resources.py @@ -25,17 +25,18 @@ class TestCleanupOrphanedResourcesTask: assert task.enabled is True assert task.manual_run is True - def test_no_cron_string_by_default(self, task): - assert task.cron_string is None + def test_cron_string_uses_configured_schedule(self, task): + assert task.cron_string == mod.SCHEDULED_CLEANUP_ORPHANED_RESOURCES_CRON - def test_cron_string_set_when_schedule_enabled(self): - with patch.object(mod, "ENABLE_SCHEDULED_CLEANUP_ORPHANED_RESOURCES", True): - with patch.object( - mod, "SCHEDULED_CLEANUP_ORPHANED_RESOURCES_CRON", "0 5 * * *" - ): - assert CleanupOrphanedResourcesTask().cron_string == "0 5 * * *" + def test_cron_string_follows_config_override(self): + with patch.object( + mod, "SCHEDULED_CLEANUP_ORPHANED_RESOURCES_CRON", "30 2 * * *" + ): + assert CleanupOrphanedResourcesTask().cron_string == "30 2 * * *" def test_init_unschedules_when_no_cron(self, task): + task.cron_string = None + with patch.object(task, "unschedule") as mock_unschedule: assert task.init() is None mock_unschedule.assert_called_once()