from django.conf import settings from commerce.tasks import sync_connection_run from eusrr_backend.celery import app def test_due_personnel_actions_are_scheduled(): entry = settings.CELERY_BEAT_SCHEDULE["process-due-personnel-actions"] assert entry["task"] == "requests_app.tasks.process_due_personnel_actions" def test_scheduled_tasks_are_registered(): app.loader.import_default_modules() app.autodiscover_tasks(force=True) missing = [ entry["task"] for entry in settings.CELERY_BEAT_SCHEDULE.values() if entry["task"] not in app.tasks ] assert missing == [] def test_commerce_import_has_dedicated_queue_without_automatic_redelivery(): assert settings.CELERY_TASK_ROUTES["commerce.sync_connection_run"] == { "queue": "commerce" } assert settings.CELERY_TASK_ANNOTATIONS["commerce.sync_connection_run"] == { "reject_on_worker_lost": False } assert sync_connection_run.reject_on_worker_lost is False assert sync_connection_run.soft_time_limit == settings.COMMERCE_TASK_SOFT_TIME_LIMIT assert sync_connection_run.time_limit == settings.COMMERCE_TASK_TIME_LIMIT assert sync_connection_run.soft_time_limit < sync_connection_run.time_limit