Skip to content

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

Remove old app enums (#18618)

Lukasz Ostrowski0ad61b3f0096
diff --git a/saleor/app/tests/test_installation_utils.py b/saleor/app/tests/test_installation_utils.py
index 4951f9e15d..71db12ac54 100644
--- a/saleor/app/tests/test_installation_utils.py
+++ b/saleor/app/tests/test_installation_utils.py
@@ -26,7 +26,6 @@ from ..installation_utils import (
validate_app_install_response,
)
from ..models import App
-from ..types import DeprecatedAppExtensionMount, DeprecatedAppExtensionTarget
def test_validate_app_install_response():
@@ -304,8 +303,8 @@ def test_install_app_with_extension(
assert app_extension.label == label
assert app_extension.url == url
- assert app_extension.mount == DeprecatedAppExtensionMount.PRODUCT_OVERVIEW_CREATE
- assert app_extension.target == DeprecatedAppExtensionTarget.POPUP
+ assert app_extension.mount == "product_overview_create"
+ assert app_extension.target == "popup"
assert list(app_extension.permissions.all()) == [permission_manage_products]
assert app_extension.http_target_method is None
@@ -352,8 +351,8 @@ def test_install_app_with_extension_widget(
assert app_extension.label == label
assert app_extension.url == url
- assert app_extension.mount == DeprecatedAppExtensionMount.PRODUCT_DETAILS_WIDGETS
- assert app_extension.target == DeprecatedAppExtensionTarget.WIDGET
+ assert app_extension.mount == "product_details_widgets"
+ assert app_extension.target == "widget"
assert list(app_extension.permissions.all()) == [permission_manage_products]
assert app_extension.http_target_method == "POST"
@@ -433,7 +432,7 @@ def test_install_app_with_extension_new_tab_target(
app_extension = app.extensions.get()
assert app_extension.label == label
assert app_extension.url == url
- assert app_extension.mount == DeprecatedAppExtensionMount.PRODUCT_OVERVIEW_CREATE
+ assert app_extension.mount == "product_overview_create"
assert app_extension.target == "new_tab"
assert list(app_extension.permissions.all()) == [permission_manage_products]
assert app_extension.http_target_method == "GET"
@@ -585,8 +584,8 @@ def test_install_app_with_extension_post_method(
assert app_extension.label == label
assert app_extension.url == url
- assert app_extension.mount == DeprecatedAppExtensionMount.PRODUCT_OVERVIEW_CREATE
- assert app_extension.target == DeprecatedAppExtensionTarget.NEW_TAB
+ assert app_extension.mount == "product_overview_create"
+ assert app_extension.target == "new_tab"
assert list(app_extension.permissions.all()) == [permission_manage_products]
assert app_extension.http_target_method == "POST"
diff --git a/saleor/app/tests/test_validators.py b/saleor/app/tests/test_validators.py
index e85a3869ea..19300300dc 100644
--- a/saleor/app/tests/test_validators.py
+++ b/saleor/app/tests/test_validators.py
@@ -12,7 +12,6 @@ from ..manifest_validations import (
_clean_required_saleor_version,
_parse_version,
)
-from ..types import DeprecatedAppExtensionTarget
from ..validators import brand_validator
@@ -101,7 +100,7 @@ def test_new_tab_relative_url_without_app_url(app_manifest):
extension = {
"url": "/relative/path",
- "target": DeprecatedAppExtensionTarget.NEW_TAB,
+ "target": "new_tab",
}
app_manifest["extensions"] = [extension]
diff --git a/saleor/app/types.py b/saleor/app/types.py
index 4944549e19..13717ec681 100644
--- a/saleor/app/types.py
+++ b/saleor/app/types.py
@@ -5,149 +5,6 @@ class AppType:
CHOICES = [(LOCAL, "local"), (THIRDPARTY, "thirdparty")]
-# Deprecated. Remove this enum - Saleor will use plain strings in tests, and the exact values are managed by the Dashboard
-class DeprecatedAppExtensionMount:
- """All places where app extension can be mounted."""
-
- CATEGORY_OVERVIEW_CREATE = "category_overview_create"
- CATEGORY_OVERVIEW_MORE_ACTIONS = "category_overview_more_actions"
- CATEGORY_DETAILS_MORE_ACTIONS = "category_details_more_actions"
-
- COLLECTION_OVERVIEW_CREATE = "collection_overview_create"
- COLLECTION_OVERVIEW_MORE_ACTIONS = "collection_overview_more_actions"
- COLLECTION_DETAILS_MORE_ACTIONS = "collection_details_more_actions"
- COLLECTION_DETAILS_WIDGETS = "collection_details_widgets"
-
- GIFT_CARD_OVERVIEW_CREATE = "gift_card_overview_create"
- GIFT_CARD_OVERVIEW_MORE_ACTIONS = "gift_card_overview_more_actions"
- GIFT_CARD_DETAILS_MORE_ACTIONS = "gift_card_details_more_actions"
- GIFT_CARD_DETAILS_WIDGETS = "gift_card_details_widgets"
-
- CUSTOMER_OVERVIEW_CREATE = "customer_overview_create"
- CUSTOMER_OVERVIEW_MORE_ACTIONS = "customer_overview_more_actions"
- CUSTOMER_DETAILS_MORE_ACTIONS = "customer_details_more_actions"
- CUSTOMER_DETAILS_WIDGETS = "customer_details_widgets"
-
- PRODUCT_OVERVIEW_CREATE = "product_overview_create"
- PRODUCT_OVERVIEW_MORE_ACTIONS = "product_overview_more_actions"
- PRODUCT_DETAILS_MORE_ACTIONS = "product_details_more_actions"
- PRODUCT_DETAILS_WIDGETS = "product_details_widgets"
-
- NAVIGATION_CATALOG = "navigation_catalog"
- NAVIGATION_ORDERS = "navigation_orders"
- NAVIGATION_CUSTOMERS = "navigation_customers"
- NAVIGATION_DISCOUNTS = "navigation_discounts"
- NAVIGATION_TRANSLATIONS = "navigation_translations"
- NAVIGATION_PAGES = "navigation_pages"
-
- ORDER_DETAILS_MORE_ACTIONS = "order_details_more_actions"
- ORDER_OVERVIEW_CREATE = "order_overview_create"
- ORDER_OVERVIEW_MORE_ACTIONS = "order_overview_more_actions"
- ORDER_DETAILS_WIDGETS = "order_details_widgets"
-
- DRAFT_ORDER_DETAILS_MORE_ACTIONS = "draft_order_details_more_actions"
- DRAFT_ORDER_OVERVIEW_CREATE = "draft_order_overview_create"
- DRAFT_ORDER_OVERVIEW_MORE_ACTIONS = "draft_order_overview_more_actions"
- DRAFT_ORDER_DETAILS_WIDGETS = "draft_order_details_widgets"
-
- DISCOUNT_DETAILS_MORE_ACTIONS = "discount_details_more_actions"
- DISCOUNT_OVERVIEW_CREATE = "discount_overview_create"
- DISCOUNT_OVERVIEW_MORE_ACTIONS = "discount_overview_more_actions"
-
- VOUCHER_DETAILS_MORE_ACTIONS = "voucher_details_more_actions"
- VOUCHER_OVERVIEW_CREATE = "voucher_overview_create"
- VOUCHER_OVERVIEW_MORE_ACTIONS = "voucher_overview_more_actions"
- VOUCHER_DETAILS_WIDGETS = "voucher_details_widgets"
-
- PAGE_DETAILS_MORE_ACTIONS = "page_details_more_actions"
- PAGE_OVERVIEW_CREATE = "page_overview_create"
- PAGE_OVERVIEW_MORE_ACTIONS = "page_overview_more_actions"
-
- PAGE_TYPE_OVERVIEW_CREATE = "page_type_overview_create"
- PAGE_TYPE_OVERVIEW_MORE_ACTIONS = "page_type_overview_more_actions"
- PAGE_TYPE_DETAILS_MORE_ACTIONS = "page_type_details_more_actions"
-
- MENU_OVERVIEW_CREATE = "menu_overview_create"
- MENU_OVERVIEW_MORE_ACTIONS = "menu_overview_more_actions"
- MENU_DETAILS_MORE_ACTIONS = "menu_details_more_actions"
-
- TRANSLATIONS_MORE_ACTIONS = "translations_more_actions"
-
- CHOICES = [
- (CATEGORY_OVERVIEW_CREATE, "category_overview_create"),
- (CATEGORY_OVERVIEW_MORE_ACTIONS, "category_overview_more_actions"),
- (CATEGORY_DETAILS_MORE_ACTIONS, "category_details_more_actions"),
- (COLLECTION_OVERVIEW_CREATE, "collection_overview_create"),
- (COLLECTION_OVERVIEW_MORE_ACTIONS, "collection_overview_more_actions"),
- (COLLECTION_DETAILS_MORE_ACTIONS, "collection_details_more_actions"),
- (COLLECTION_DETAILS_WIDGETS, "collection_details_widgets"),
- (GIFT_CARD_OVERVIEW_CREATE, "gift_card_overview_create"),
- (GIFT_CARD_OVERVIEW_MORE_ACTIONS, "gift_card_overview_more_actions"),
- (GIFT_CARD_DETAILS_MORE_ACTIONS, "gift_card_details_more_actions"),
- (GIFT_CARD_DETAILS_WIDGETS, "gift_card_details_widgets"),
- (CUSTOMER_OVERVIEW_CREATE, "customer_overview_create"),
- (CUSTOMER_OVERVIEW_MORE_ACTIONS, "customer_overview_more_actions"),
- (CUSTOMER_DETAILS_MORE_ACTIONS, "customer_details_more_actions"),
- (CUSTOMER_DETAILS_WIDGETS, "customer_details_widgets"),
- (PRODUCT_OVERVIEW_CREATE, "product_overview_create"),
- (PRODUCT_OVERVIEW_MORE_ACTIONS, "product_overview_more_actions"),
- (PRODUCT_DETAILS_MORE_ACTIONS, "product_details_more_actions"),
- (PRODUCT_DETAILS_WIDGETS, "product_details_widgets"),
- (NAVIGATION_CATALOG, "navigation_catalog"),
- (NAVIGATION_ORDERS, "navigation_orders"),
- (NAVIGATION_CUSTOMERS, "navigation_customers"),
- (NAVIGATION_DISCOUNTS, "navigation_discounts"),
- (NAVIGATION_TRANSLATIONS, "navigation_translations"),
- (NAVIGATION_PAGES, "navigation_pages"),
- (ORDER_DETAILS_MORE_ACTIONS, "order_details_more_actions"),
- (ORDER_OVERVIEW_CREATE, "order_overview_create"),
- (ORDER_OVERVIEW_MORE_ACTIONS, "order_overview_more_actions"),
- (ORDER_DETAILS_WIDGETS, "order_details_widgets"),
- (DRAFT_ORDER_DETAILS_MORE_ACTIONS, "draft_order_details_more_actions"),
- (DRAFT_ORDER_OVERVIEW_CREATE, "draft_order_overview_create"),
- (DRAFT_ORDER_OVERVIEW_MORE_ACTIONS, "draft_order_overview_more_actions"),
- (DRAFT_ORDER_DETAILS_WIDGETS, "draft_order_details_widgets"),
- (DISCOUNT_DETAILS_MORE_ACTIONS, "discount_details_more_actions"),
- (DISCOUNT_OVERVIEW_CREATE, "discount_overview_create"),
- (DISCOUNT_OVERVIEW_MORE_ACTIONS, "discount_overview_more_actions"),
- (VOUCHER_DETAILS_MORE_ACTIONS, "voucher_details_more_actions"),
- (VOUCHER_OVERVIEW_CREATE, "voucher_overview_create"),
- (VOUCHER_OVERVIEW_MORE_ACTIONS, "voucher_overview_more_actions"),
- (VOUCHER_DETAILS_WIDGETS, "voucher_details_widgets"),
- (PAGE_DETAILS_MORE_ACTIONS, "page_details_more_actions"),
- (PAGE_OVERVIEW_CREATE, "page_overview_create"),
- (PAGE_OVERVIEW_MORE_ACTIONS, "page_overview_more_actions"),
- (PAGE_TYPE_OVERVIEW_CREATE, "page_type_overview_create"),
- (PAGE_TYPE_OVERVIEW_MORE_ACTIONS, "page_type_overview_more_actions"),
- (PAGE_TYPE_DETAILS_MORE_ACTIONS, "page_type_details_more_actions"),
- (MENU_OVERVIEW_CREATE, "menu_overview_create"),
- (MENU_OVERVIEW_MORE_ACTIONS, "menu_overview_more_actions"),
- (MENU_DETAILS_MORE_ACTIONS, "menu_details_more_actions"),
- (TRANSLATIONS_MORE_ACTIONS, "translations_more_actions"),
- ]
-
-
-# Deprecated. Remove this enum - Saleor will use plain strings in tests, and the exact values are managed by the Dashboard
-class DeprecatedAppExtensionTarget:
- """All available ways of opening an app extension.
-
- POPUP - app's extension will be mounted as a popup window
- APP_PAGE - redirect to app's page
- """
-
- POPUP = "popup"
- APP_PAGE = "app_page"
- NEW_TAB = "new_tab"
- WIDGET = "widget"
-
- CHOICES = [
- (POPUP, "popup"),
- (APP_PAGE, "app_page"),
- (NEW_TAB, "new_tab"),
- (WIDGET, "widget"),
- ]
-
-
# Deprecated. Remove this enum in 3.24, when this field is dropped from AppExtension model
class DeprecatedAppExtensionHttpMethod:
"""HTTP methods available for app extensions.
diff --git a/saleor/graphql/app/tests/benchmarks/test_app_extensions.py b/saleor/graphql/app/tests/benchmarks/test_app_extensions.py
index 6e1773d433..915b6baa6e 100644
--- a/saleor/graphql/app/tests/benchmarks/test_app_extensions.py
+++ b/saleor/graphql/app/tests/benchmarks/test_app_extensions.py
@@ -1,7 +1,6 @@
import pytest
from .....app.models import AppExtension
-from .....app.types import DeprecatedAppExtensionMount
from ....tests.utils import get_graphql_content
@@ -39,19 +38,19 @@ def test_app_extensions(
app=app,
label="Create product with App1",
url="https://www.example.com/app-product",
- mount=DeprecatedAppExtensionMount.PRODUCT_OVERVIEW_MORE_ACTIONS,
+ mount="product_overview_more_actions",
),
AppExtension(
app=app,
label="Create product with App2",
url="https://www.example.com/app-product",
- mount=DeprecatedAppExtensionMount.PRODUCT_DETAILS_MORE_ACTIONS,
+ mount="product_details_more_actions",
),
AppExtension(
app=app,
label="Create product with App3",
url="https://www.example.com/app-product",
- mount=DeprecatedAppExtensionMount.PRODUCT_OVERVIEW_CREATE,
+ mount="product_overview_create",
),
]
)
@@ -117,19 +116,19 @@ def test_app_extensions_with_filter(
app=app,
label="Create product with App1",
url="https://www.example.com/app-product",
- mount=DeprecatedAppExtensionMount.PRODUCT_OVERVIEW_MORE_ACTIONS,
+ mount="product_overview_more_actions",
),
AppExtension(
app=app,
label="Create product with App2",
url="https://www.example.com/app-product",
- mount=DeprecatedAppExtensionMount.PRODUCT_DETAILS_MORE_ACTIONS,
+ mount="product_details_more_actions",
),
AppExtension(
app=app,
label="Create product with App3",
url="https://www.example.com/app-product",
- mount=DeprecatedAppExtensionMount.PRODUCT_OVERVIEW_CREATE,
+ mount="product_overview_create",
),
]
)
diff --git a/saleor/graphql/app/tests/queries/test_app_extension.py b/saleor/graphql/app/tests/queries/test_app_extension.py
index b21c8eab4c..3a0e8e5707 100644
--- a/saleor/graphql/app/tests/queries/test_app_extension.py
+++ b/saleor/graphql/app/tests/queries/test_app_extension.py
@@ -2,11 +2,7 @@ import graphene
import pytest
from .....app.models import App, AppExtension
-from .....app.types import (
- AppType,
- DeprecatedAppExtensionMount,
- DeprecatedAppExtensionTarget,
-)
+from .....app.types import AppType
from .....core.jwt import jwt_decode
from ....tests.utils import assert_no_permission, get_graphql_content
@@ -34,9 +30,9 @@ def test_app_extension_staff_user(app, staff_api_client, permission_manage_produ
app=app,
label="Create product with App",
url="https://www.example.com/app-product",
- mount=DeprecatedAppExtensionMount.PRODUCT_OVERVIEW_MORE_ACTIONS,
+ mount="product_overview_more_actions",
http_target_method="POST",
- target=DeprecatedAppExtensionTarget.WIDGET,
+ target="widget",
)
app_extension.permissions.add(permission_manage_products)
id = graphene.Node.to_global_id("AppExtension", app_extension.id)
@@ -74,7 +70,7 @@ def test_app_extension_by_app(app, app_api_client, permission_manage_products):
app=app,
label="Create product with App",
url="https://www.example.com/app-product",
- mount=DeprecatedAppExtensionMount.PRODUCT_OVERVIEW_MORE_ACTIONS,
+ mount="product_overview_more_actions",
)
app_extension.permissions.add(permission_manage_products)
id = graphene.Node.to_global_id("AppExtension", app_extension.id)
@@ -113,7 +109,7 @@ def test_app_extensions_app_removed_app(
app=removed_app,
label="Create product with App",
url="https://www.example.com/app-product",
- mount=DeprecatedAppExtensionMount.PRODUCT_OVERVIEW_MORE_ACTIONS,
+ mount="product_overview_more_actions",
)
app_extension.permissions.add(permission_manage_products)
id = graphene.Node.to_global_id("AppExtension", app_extension.id)
@@ -137,7 +133,7 @@ def test_app_extension_normal_user(app, user_api_client, permission_manage_produ
app=app,
label="Create product with App",
url="https://www.example.com/app-product",
- mount=DeprecatedAppExtensionMount.PRODUCT_OVERVIEW_MORE_ACTIONS,
+ mount="product_overview_more_actions",
)
app_extension.permissions.add(permission_manage_products)
id = graphene.Node.to_global_id("AppExtension", app_extension.id)
@@ -161,7 +157,7 @@ def test_app_extension_staff_user_without_all_permissions(
app=app,
label="Create product with App",
url="https://www.example.com/app-product",
- mount=DeprecatedAppExtensionMount.PRODUCT_OVERVIEW_MORE_ACTIONS,
+ mount="product_overview_more_actions",
)
app_extension.permissions.add(permission_manage_products)
id = graphene.Node.to_global_id("AppExtension", app_extension.id)
@@ -193,7 +189,7 @@ def test_app_extension_staff_user_fetching_access_token(
app=app,
label="Create product with App",
url="https://www.example.com/app-product",
- mount=DeprecatedAppExtensionMount.PRODUCT_OVERVIEW_MORE_ACTIONS,
+ mount="product_overview_more_actions",
)
app_extension.permissions.add(permission_manage_products, permission_manage_orders)
id = graphene.Node.to_global_id("AppExtension", app_extension.id)
@@ -235,7 +231,7 @@ def test_app_extension_access_token_with_audience(
app=app,
label="Create product with App",
url="https://www.example.com/app-product",
- mount=DeprecatedAppExtensionMount.PRODUCT_OVERVIEW_MORE_ACTIONS,
+ mount="product_overview_more_actions",
)
app_extension.permissions.add(permission_manage_products, permission_manage_orders)
id = graphene.Node.to_global_id("AppExtension", app_extension.id)
@@ -274,7 +270,7 @@ def test_app_extension_staff_user_partial_permission(
app=app,
label="Create product with App",
url="https://www.example.com/app-product",
- mount=DeprecatedAppExtensionMount.PRODUCT_OVERVIEW_MORE_ACTIONS,
+ mount="product_overview_more_actions",
)
app_extension.permissions.add(permission_manage_products, permission_manage_orders)
id = graphene.Node.to_global_id("AppExtension", app_extension.id)
@@ -322,7 +318,7 @@ def test_app_extension_with_app_query_by_staff_without_permissions(
app=app,
label="Create product with App",
url="https://www.example.com/app-product",
- mount=DeprecatedAppExtensionMount.PRODUCT_OVERVIEW_MORE_ACTIONS,
+ mount="product_overview_more_actions",
)
app_extension.permissions.add(permission_manage_products)
id = graphene.Node.to_global_id("AppExtension", app_extension.id)
@@ -348,7 +344,7 @@ def test_app_extension_with_app_query_by_app_without_permissions(
app=app,
label="Create product with App",
url="https://www.example.com/app-product",
- mount=DeprecatedAppExtensionMount.PRODUCT_OVERVIEW_MORE_ACTIONS,
+ mount="product_overview_more_actions",
)
app_extension.permissions.add(permission_manage_products)
id = graphene.Node.to_global_id("AppExtension", app_extension.id)
@@ -390,7 +386,7 @@ def test_app_extension_with_app_query_by_app_without_permissions_other_app(
app=another_app,
label="Create product with App",
url="https://www.example.com/app-product",
- mount=DeprecatedAppExtensionMount.PRODUCT_OVERVIEW_MORE_ACTIONS,
+ mount="product_overview_more_actions",
)
app_extension.permissions.add(permission_manage_products)
id = graphene.Node.to_global_id("AppExtension", app_extension.id)
@@ -415,7 +411,7 @@ def test_app_extension_with_app_query_by_owner_app(
app=app,
label="Create product with App",
url="https://www.example.com/app-product",
- mount=DeprecatedAppExtensionMount.PRODUCT_OVERVIEW_MORE_ACTIONS,
+ mount="product_overview_more_actions",
)
app_extension.permissions.add(permission_manage_products)
id = graphene.Node.to_global_id("AppExtension", app_extension.id)
@@ -439,7 +435,7 @@ def test_app_extension_with_app_query_by_staff_with_permissions(
app=external_app,
label="Create product with App",
url="https://www.example.com/app-product",
- mount=DeprecatedAppExtensionMount.PRODUCT_OVERVIEW_MORE_ACTIONS,
+ mount="product_overview_more_actions",
)
id = graphene.Node.to_global_id("AppExtension", app_extension.id)
@@ -464,7 +460,7 @@ def test_app_extension_with_app_query_by_customer_without_permissions(
app=external_app,
label="Create product with App",
url="https://www.example.com/app-product",
- mount=DeprecatedAppExtensionMount.PRODUCT_OVERVIEW_MORE_ACTIONS,
+ mount="product_overview_more_actions",
)
id = graphene.Node.to_global_id("AppExtension", app_extension.id)
@@ -480,10 +476,10 @@ def test_app_extension_with_app_query_by_customer_without_permissions(
@pytest.mark.parametrize(
("target", "method"),
[
- (DeprecatedAppExtensionTarget.WIDGET, "POST"),
- (DeprecatedAppExtensionTarget.WIDGET, "GET"),
- (DeprecatedAppExtensionTarget.NEW_TAB, "POST"),
- (DeprecatedAppExtensionTarget.NEW_TAB, "GET"),
+ ("widget", "POST"),
+ ("widget", "GET"),
+ ("new_tab", "POST"),
+ ("new_tab", "GET"),
],
)
def test_app_extension_type_settings_from_http_target_method(
@@ -497,7 +493,7 @@ def test_app_extension_type_settings_from_http_target_method(
app=app,
label="Create product with App",
url="https://www.example.com/app-product",
- mount=DeprecatedAppExtensionMount.ORDER_DETAILS_WIDGETS,
+ mount="order_details_widgets",
http_target_method=method,
target=target,
)
@@ -517,10 +513,10 @@ def test_app_extension_type_settings_from_http_target_method(
assert extension_data["mountName"] == "ORDER_DETAILS_WIDGETS"
assert extension_data["targetName"] == app_extension.target.upper()
- if target == DeprecatedAppExtensionTarget.NEW_TAB:
+ if target == "new_tab":
assert extension_data["settings"]["newTabTarget"]["method"] == method
- if target == DeprecatedAppExtensionTarget.WIDGET:
+ if target == "widget":
assert extension_data["settings"]["widgetTarget"]["method"] == method
@@ -536,7 +532,7 @@ def test_app_extension_type_settings_from_native_settings(
app=app,
label="Create product with App",
url="https://www.example.com/app-product",
- mount=DeprecatedAppExtensionMount.ORDER_DETAILS_WIDGETS,
+ mount="order_details_widgets",
http_target_method=method,
settings={"newTabTarget": {"method": method}},
target=target,
@@ -557,8 +553,8 @@ def test_app_extension_type_settings_from_native_settings(
assert extension_data["mountName"] == "ORDER_DETAILS_WIDGETS"
assert extension_data["targetName"] == app_extension.target.upper()
- if target == DeprecatedAppExtensionTarget.NEW_TAB:
+ if target == "new_tab":
assert extension_data["settings"]["newTabTarget"]["method"] == method
- if target == DeprecatedAppExtensionTarget.WIDGET:
+ if target == "widget":
assert extension_data["settings"]["widgetTarget"]["method"] == method
diff --git a/saleor/graphql/app/tests/queries/test_app_extensions.py b/saleor/graphql/app/tests/queries/test_app_extensions.py
index 03eb0267e6..44883a74d7 100644
--- a/saleor/graphql/app/tests/queries/test_app_extensions.py
+++ b/saleor/graphql/app/tests/queries/test_app_extensions.py
@@ -1,7 +1,6 @@
import pytest
from .....app.models import AppExtension
-from .....app.types import DeprecatedAppExtensionMount, DeprecatedAppExtensionTarget
from .....core.jwt import jwt_decode
from ....tests.utils import assert_no_permission, get_graphql_content
@@ -33,9 +32,9 @@ def test_app_extensions(staff_api_client, app, permission_manage_products):
app=app,
label="Create product with App",
url="https://www.example.com/app-product",
- mount=DeprecatedAppExtensionMount.PRODUCT_OVERVIEW_MORE_ACTIONS,
+ mount="product_overview_more_actions",
http_target_method="POST",
- target=DeprecatedAppExtensionTarget.WIDGET,
+ target="widget",
)
app_extension.permissions.add(permission_manage_products)
variables = {}
@@ -82,7 +81,7 @@ def test_app_extensions_app_not_active(
app=app,
label="Create product with App",
url="https://www.example.com/app-product",
- mount=DeprecatedAppExtensionMount.PRODUCT_OVERVIEW_MORE_ACTIONS,
+ mount="product_overview_more_actions",
)
app_extension.permissions.add(permission_manage_products)
variables = {}
@@ -109,7 +108,7 @@ def test_app_extensions_app_removed_app(
app=removed_app,
label="Create product with App",
url="https://www.example.com/app-product",
- mount=DeprecatedAppExtensionMount.PRODUCT_OVERVIEW_MORE_ACTIONS,
+ mount="product_overview_more_actions",
)
app_extension.permissions.add(permission_manage_products)
variables = {}
@@ -136,7 +135,7 @@ def test_app_extensions_user_not_staff(
app=app,
label="Create product with App",
url="https://www.example.com/app-product",
- mount=DeprecatedAppExtensionMount.PRODUCT_OVERVIEW_MORE_ACTIONS,
+ mount="product_overview_more_actions",
)
app_extension.permissions.add(permission_manage_products)
variables = {}
@@ -190,27 +189,27 @@ def test_app_extensions_with_filter(
app=app,
label="Create product with App1",
url="https://www.example.com/app-product",
- mount=DeprecatedAppExtensionMount.PRODUCT_OVERVIEW_MORE_ACTIONS,
- target=DeprecatedAppExtensionTarget.APP_PAGE,
+ mount="product_overview_more_actions",
+ target="app_page",
),
AppExtension(
app=app,
label="Create product with App2",
url="https://www.example.com/app-product",
- mount=DeprecatedAppExtensionMount.PRODUCT_DETAILS_MORE_ACTIONS,
- target=DeprecatedAppExtensionTarget.POPUP,
+ mount="product_details_more_actions",
+ target="popup",
),
AppExtension(
app=app,
label="Create product with App3",
url="https://www.example.com/app-product",
- mount=DeprecatedAppExtensionMount.PRODUCT_OVERVIEW_CREATE,
+ mount="product_overview_create",
),
AppExtension(
app=app,
label="Create product with App4",
url="https://www.example.com/app-product",
- mount=DeprecatedAppExtensionMount.PRODUCT_OVERVIEW_CREATE,
+ mount="product_overview_create",
),
]
)
@@ -301,27 +300,27 @@ def test_app_extensions_with_name_filter(
app=app,
label="Create product with App1",
url="https://www.example.com/app-product",
- mount=DeprecatedAppExtensionMount.PRODUCT_OVERVIEW_MORE_ACTIONS,
- target=DeprecatedAppExtensionTarget.APP_PAGE,
+ mount="product_overview_more_actions",
+ target="app_page",
),
AppExtension(
app=app,
label="Create product with App2",
url="https://www.example.com/app-product",
- mount=DeprecatedAppExtensionMount.PRODUCT_DETAILS_MORE_ACTIONS,
- target=DeprecatedAppExtensionTarget.POPUP,
+ mount="product_details_more_actions",
+ target="popup",
),
AppExtension(
app=app,
label="Create product with App3",
url="https://www.example.com/app-product",
- mount=DeprecatedAppExtensionMount.PRODUCT_OVERVIEW_CREATE,
+ mount="product_overview_create",
),
AppExtension(
app=app,
label="Create product with App4",
url="https://www.example.com/app-product",
- mount=DeprecatedAppExtensionMount.PRODUCT_OVERVIEW_CREATE,
+ mount="product_overview_create",
),
]
)
diff --git a/saleor/graphql/app/types.py b/saleor/graphql/app/types.py
index 542bbee610..61bdde76e2 100644
--- a/saleor/graphql/app/types.py
+++ b/saleor/graphql/app/types.py
@@ -7,7 +7,6 @@ from ...app import models
from ...app.types import (
DEFAULT_APP_TARGET,
DeprecatedAppExtensionHttpMethod,
- DeprecatedAppExtensionTarget,
)
from ...core.exceptions import PermissionDenied
from ...core.jwt import JWT_THIRDPARTY_ACCESS_TYPE
@@ -239,7 +238,6 @@ class AppExtension(AppManifestExtension, ModelObjectType[models.AppExtension]):
return AppByIdLoader(info.context).load(root.app_id).then(_resolve_access_token)
- # TODO Return settings directly from the DB
@staticmethod
def resolve_settings(root: models.AppExtension, _info: ResolveInfo):
"""Return app extension settings as plain JSON with same structure as options."""
@@ -251,14 +249,15 @@ class AppExtension(AppManifestExtension, ModelObjectType[models.AppExtension]):
# Fallback if settings not propagated in DB yet
# Make it case-insensitive due to migration logic - enum will become uppercased in DB
- if root.target.upper() == DeprecatedAppExtensionTarget.WIDGET.upper():
+ # TODO Remove after 3.23 when migrations are complete
+ if root.target.upper() == "WIDGET":
return {
"widgetTarget": {
"method": http_method,
}
}
- if root.target.upper() == DeprecatedAppExtensionTarget.NEW_TAB.upper():
+ if root.target.upper() == "NEW_TAB":
return {
"newTabTarget": {
"method": http_method,