Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Fix failing import-path for promotion schedule (#16915)

Maciej Korycinskife6e46266e81
diff --git a/saleor/core/schedules.py b/saleor/core/schedules.py
index 674b943afc..2b1072bbe8 100644
--- a/saleor/core/schedules.py
+++ b/saleor/core/schedules.py
@@ -37,7 +37,7 @@ class promotion_webhook_schedule(CustomSchedule):
schedule=self,
nowfun=nowfun,
app=app,
- import_path="saleor.core.schedules.promotion_webhook_schedule",
+ import_path="saleor.core.schedules.initiated_promotion_webhook_schedule",
)
# Seconds left to next batch processing
self.NEXT_BATCH_RUN_TIME = 5
diff --git a/saleor/core/tests/test_schedules.py b/saleor/core/tests/test_schedules.py
index 9b24a313d8..2babca0db7 100644
--- a/saleor/core/tests/test_schedules.py
+++ b/saleor/core/tests/test_schedules.py
@@ -1,6 +1,8 @@
import datetime
+from celery.schedules import BaseSchedule
from django.utils import timezone
+from django.utils.module_loading import import_string
from freezegun import freeze_time
from ...discount.models import Promotion
@@ -213,3 +215,14 @@ def test_is_due_no_promo_to_notify_about_upcoming_promo_exists_initial_time_retu
# then
assert is_due is False
assert next_run == schedule.initial_timedelta.total_seconds()
+
+
+def test_promotion_webhook_schedule_import_path():
+ # given
+ schedule = promotion_webhook_schedule()
+
+ # when
+ scheduler_instance = import_string(schedule.import_path)
+
+ # then
+ assert isinstance(scheduler_instance, BaseSchedule)