Skip to content

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

fix(announcements): set default resolver in tests (#19365)

Mikailc662d3a7e759
diff --git a/saleor/graphql/schema.graphql b/saleor/graphql/schema.graphql
index 3993c17936..4d919b1016 100644
--- a/saleor/graphql/schema.graphql
+++ b/saleor/graphql/schema.graphql
@@ -15326,7 +15326,7 @@ type Announcement {
messageHtml: String!
"""
- Determine the how critical the announcement is. UNSET if no severity level was defined for this announcement. When value is `UNSET`, it should be considered as low importance or informational.
+ Determine the how critical the announcement is. UNSET if no severity level was defined for this announcement.
"""
importance: AnnouncementImportanceEnum!
diff --git a/saleor/graphql/shop/tests/queries/test_shop_announcements.py b/saleor/graphql/shop/tests/queries/test_shop_announcements.py
index 7c94729638..330e3c6f24 100644
--- a/saleor/graphql/shop/tests/queries/test_shop_announcements.py
+++ b/saleor/graphql/shop/tests/queries/test_shop_announcements.py
@@ -2,6 +2,8 @@ from collections.abc import Callable
from contextlib import contextmanager
from datetime import datetime
+import pytest
+
from .....site.apps import SiteAppConfig
from ....tests.utils import (
assert_no_permission,
@@ -112,6 +114,22 @@ def use_dummy_announcements(
SiteAppConfig.announcements_resolver = None
[email protected](autouse=True)
+def default_settings(settings):
+ """Set the resolver to None, then reverts the changes during tear-down."""
+ old_resolver = SiteAppConfig.announcements_resolver
+
+ # Overrides the default resolver as it may potentially
+ # be set by users thus causing our tests to fail because we
+ # expect the value to be `None`
+ settings.SHOP_ANNOUNCEMENT_RESOLVER_IMPORT = None
+ SiteAppConfig.announcements_resolver = None
+
+ yield
+
+ SiteAppConfig.announcements_resolver = old_resolver
+
+
def test_cannot_get_announcements_when_not_staff(user_api_client):
"""Authenticated user are not authorized to get announcements when not a staff."""
diff --git a/saleor/graphql/shop/types.py b/saleor/graphql/shop/types.py
index be3afee654..47f8b2c9cb 100644
--- a/saleor/graphql/shop/types.py
+++ b/saleor/graphql/shop/types.py
@@ -202,8 +202,7 @@ class Announcement(graphene.ObjectType):
required=True,
description=(
"Determine the how critical the announcement is. UNSET if no "
- "severity level was defined for this announcement. When value is `UNSET`, "
- "it should be considered as low importance or informational."
+ "severity level was defined for this announcement."
),
)