Skip to content

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

Remove channel param on checkout query (#6501)

Filip Owczarek99d963aed3e5
diff --git a/saleor/graphql/checkout/resolvers.py b/saleor/graphql/checkout/resolvers.py
index e02920461d..a86f99a580 100644
--- a/saleor/graphql/checkout/resolvers.py
+++ b/saleor/graphql/checkout/resolvers.py
@@ -15,10 +15,8 @@ def resolve_checkouts(channel_slug):
return queryset
-def resolve_checkout(info, token, channel_slug):
- checkout = models.Checkout.objects.filter(
- token=token, channel__slug=channel_slug
- ).first()
+def resolve_checkout(info, token):
+ checkout = models.Checkout.objects.filter(token=token).first()
if checkout is None:
return None
diff --git a/saleor/graphql/checkout/schema.py b/saleor/graphql/checkout/schema.py
index d15bab3451..3122f22fdb 100644
--- a/saleor/graphql/checkout/schema.py
+++ b/saleor/graphql/checkout/schema.py
@@ -1,11 +1,7 @@
import graphene
from ...core.permissions import CheckoutPermissions
-from ..core.fields import (
- BaseDjangoConnectionField,
- FieldWithChannel,
- PrefetchingConnectionField,
-)
+from ..core.fields import BaseDjangoConnectionField, PrefetchingConnectionField
from ..core.scalars import UUID
from ..decorators import permission_required
from ..payment.mutations import CheckoutPaymentCreate
@@ -29,7 +25,7 @@ from .types import Checkout, CheckoutLine
class CheckoutQueries(graphene.ObjectType):
- checkout = FieldWithChannel(
+ checkout = graphene.Field(
Checkout,
description="Look up a checkout by token and slug of channel.",
token=graphene.Argument(UUID, description="The checkout's token."),
@@ -51,8 +47,8 @@ class CheckoutQueries(graphene.ObjectType):
CheckoutLine, description="List of checkout lines."
)
- def resolve_checkout(self, info, token, channel):
- return resolve_checkout(info, token, channel)
+ def resolve_checkout(self, info, token):
+ return resolve_checkout(info, token)
@permission_required(CheckoutPermissions.MANAGE_CHECKOUTS)
def resolve_checkouts(self, *_args, channel=None, **_kwargs):
diff --git a/saleor/graphql/checkout/tests/test_checkout.py b/saleor/graphql/checkout/tests/test_checkout.py
index d72ecad89b..abe76a2978 100644
--- a/saleor/graphql/checkout/tests/test_checkout.py
+++ b/saleor/graphql/checkout/tests/test_checkout.py
@@ -1064,8 +1064,8 @@ def expected_dummy_gateway():
GET_CHECKOUT_PAYMENTS_QUERY = """
-query getCheckoutPayments($token: UUID!, $channel: String!) {
- checkout(token: $token, channel: $channel) {
+query getCheckoutPayments($token: UUID!) {
+ checkout(token: $token) {
availablePaymentGateways {
id
name
@@ -1084,10 +1084,7 @@ def test_checkout_available_payment_gateways(
api_client, checkout_with_item, expected_dummy_gateway,
):
query = GET_CHECKOUT_PAYMENTS_QUERY
- variables = {
- "token": str(checkout_with_item.token),
- "channel": checkout_with_item.channel.slug,
- }
+ variables = {"token": str(checkout_with_item.token)}
response = api_client.post_graphql(query, variables)
content = get_graphql_content(response)
@@ -1105,10 +1102,7 @@ def test_checkout_available_payment_gateways_currency_specified_USD(
query = GET_CHECKOUT_PAYMENTS_QUERY
- variables = {
- "token": str(checkout_with_item.token),
- "channel": checkout_with_item.channel.slug,
- }
+ variables = {"token": str(checkout_with_item.token)}
response = api_client.post_graphql(query, variables)
content = get_graphql_content(response)
@@ -1127,10 +1121,7 @@ def test_checkout_available_payment_gateways_currency_specified_EUR(
query = GET_CHECKOUT_PAYMENTS_QUERY
- variables = {
- "token": str(checkout_with_item.token),
- "channel": checkout_with_item.channel.slug,
- }
+ variables = {"token": str(checkout_with_item.token)}
response = api_client.post_graphql(query, variables)
content = get_graphql_content(response)
@@ -1141,8 +1132,8 @@ def test_checkout_available_payment_gateways_currency_specified_EUR(
GET_CHECKOUT_AVAILABLE_SHIPPING_METHODS = """
-query getCheckout($token: UUID!, $channel: String!) {
- checkout(token: $token, channel: $channel) {
+query getCheckout($token: UUID!) {
+ checkout(token: $token) {
availableShippingMethods {
name
price {
@@ -1161,10 +1152,7 @@ def test_checkout_available_shipping_methods(
checkout_with_item.save()
query = GET_CHECKOUT_AVAILABLE_SHIPPING_METHODS
- variables = {
- "token": checkout_with_item.token,
- "channel": checkout_with_item.channel.slug,
- }
+ variables = {"token": checkout_with_item.token}
response = api_client.post_graphql(query, variables)
content = get_graphql_content(response)
data = content["data"]["checkout"]
@@ -1204,10 +1192,7 @@ def test_checkout_available_shipping_methods_with_price_displayed(
query = GET_CHECKOUT_AVAILABLE_SHIPPING_METHODS
- variables = {
- "token": checkout_with_item.token,
- "channel": checkout_with_item.channel.slug,
- }
+ variables = {"token": checkout_with_item.token}
response = api_client.post_graphql(query, variables)
content = get_graphql_content(response)
data = content["data"]["checkout"]
@@ -1222,10 +1207,7 @@ def test_checkout_no_available_shipping_methods_without_address(
api_client, checkout_with_item
):
query = GET_CHECKOUT_AVAILABLE_SHIPPING_METHODS
- variables = {
- "token": checkout_with_item.token,
- "channel": checkout_with_item.channel.slug,
- }
+ variables = {"token": checkout_with_item.token}
response = api_client.post_graphql(query, variables)
content = get_graphql_content(response)
data = content["data"]["checkout"]
@@ -1236,7 +1218,7 @@ def test_checkout_no_available_shipping_methods_without_address(
def test_checkout_no_available_shipping_methods_without_lines(api_client, checkout):
query = GET_CHECKOUT_AVAILABLE_SHIPPING_METHODS
- variables = {"token": checkout.token, "channel": checkout.channel.slug}
+ variables = {"token": checkout.token}
response = api_client.post_graphql(query, variables)
content = get_graphql_content(response)
data = content["data"]["checkout"]
@@ -2180,8 +2162,8 @@ TRANSACTION_CONFIRM_GATEWAY_RESPONSE = GatewayResponse(
def test_fetch_checkout_by_token(user_api_client, checkout_with_item):
query = """
- query getCheckout($token: UUID!, $channel: String!) {
- checkout(token: $token, channel: $channel) {
+ query getCheckout($token: UUID!) {
+ checkout(token: $token) {
token,
lines {
variant {
@@ -2205,8 +2187,8 @@ def test_fetch_checkout_by_token(user_api_client, checkout_with_item):
QUERY_CHECKOUT_USER_ID = """
- query getCheckout($token: UUID!, $channel: String!) {
- checkout(token: $token, channel: $channel) {
+ query getCheckout($token: UUID!) {
+ checkout(token: $token) {
user {
id
}
@@ -2217,7 +2199,7 @@ QUERY_CHECKOUT_USER_ID = """
def test_anonymous_client_cant_fetch_checkout_user(api_client, checkout):
query = QUERY_CHECKOUT_USER_ID
- variables = {"token": str(checkout.token), "channel": checkout.channel.slug}
+ variables = {"token": str(checkout.token)}
response = api_client.post_graphql(query, variables)
assert_no_permission(response)
@@ -2229,7 +2211,7 @@ def test_authorized_access_to_checkout_user_as_customer(
checkout.user = customer_user
checkout.save()
- variables = {"token": str(checkout.token), "channel": checkout.channel.slug}
+ variables = {"token": str(checkout.token)}
customer_user_id = graphene.Node.to_global_id("User", customer_user.id)
response = user_api_client.post_graphql(query, variables)
@@ -2248,7 +2230,7 @@ def test_authorized_access_to_checkout_user_as_staff(
checkout.user = customer_user
checkout.save()
- variables = {"token": str(checkout.token), "channel": checkout.channel.slug}
+ variables = {"token": str(checkout.token)}
customer_user_id = graphene.Node.to_global_id("User", customer_user.id)
response = staff_api_client.post_graphql(
@@ -2269,7 +2251,7 @@ def test_authorized_access_to_checkout_user_as_staff_no_permission(
checkout.user = customer_user
checkout.save()
- variables = {"token": str(checkout.token), "channel": checkout.channel.slug}
+ variables = {"token": str(checkout.token)}
response = staff_api_client.post_graphql(
query,
@@ -2281,8 +2263,8 @@ def test_authorized_access_to_checkout_user_as_staff_no_permission(
QUERY_CHECKOUT = """
- query getCheckout($token: UUID!, $channel: String!) {
- checkout(token: $token, channel: $channel) {
+ query getCheckout($token: UUID!) {
+ checkout(token: $token) {
token
}
}
@@ -2297,8 +2279,8 @@ def test_query_anonymous_customer_checkout_as_anonymous_customer(api_client, che
QUERY_CHECKOUT_CHANNEL_SLUG = """
- query getCheckout($token: UUID!, $channel: String!) {
- checkout(token: $token, channel: $channel) {
+ query getCheckout($token: UUID!) {
+ checkout(token: $token) {
token
channel {
slug
@@ -2314,7 +2296,7 @@ def test_query_anonymous_customer_channel_checkout_as_anonymous_customer(
query = QUERY_CHECKOUT_CHANNEL_SLUG
checkout_token = str(checkout.token)
channel_slug = checkout.channel.slug
- variables = {"token": checkout_token, "channel": channel_slug}
+ variables = {"token": checkout_token}
response = api_client.post_graphql(query, variables)
content = get_graphql_content(response)
@@ -2329,7 +2311,9 @@ def test_query_anonymous_customer_channel_checkout_as_customer(
query = QUERY_CHECKOUT_CHANNEL_SLUG
checkout_token = str(checkout.token)
channel_slug = checkout.channel.slug
- variables = {"token": checkout_token, "channel": channel_slug}
+ variables = {
+ "token": checkout_token,
+ }
response = user_api_client.post_graphql(query, variables)
content = get_graphql_content(response)
@@ -2339,7 +2323,7 @@ def test_query_anonymous_customer_channel_checkout_as_customer(
def test_query_anonymous_customer_checkout_as_customer(user_api_client, checkout):
- variables = {"token": str(checkout.token), "channel": checkout.channel.slug}
+ variables = {"token": str(checkout.token)}
response = user_api_client.post_graphql(QUERY_CHECKOUT, variables)
content = get_graphql_content(response)
assert content["data"]["checkout"]["token"] == str(checkout.token)
@@ -2348,7 +2332,7 @@ def test_query_anonymous_customer_checkout_as_customer(user_api_client, checkout
def test_query_anonymous_customer_checkout_as_staff_user(
staff_api_client, checkout, permission_manage_checkouts
):
- variables = {"token": str(checkout.token), "channel": checkout.channel.slug}
+ variables = {"token": str(checkout.token)}
response = staff_api_client.post_graphql(
QUERY_CHECKOUT,
variables,
@@ -2362,7 +2346,7 @@ def test_query_anonymous_customer_checkout_as_staff_user(
def test_query_anonymous_customer_checkout_as_app(
app_api_client, checkout, permission_manage_checkouts
):
- variables = {"token": str(checkout.token), "channel": checkout.channel.slug}
+ variables = {"token": str(checkout.token)}
response = app_api_client.post_graphql(
QUERY_CHECKOUT,
variables,
@@ -2378,7 +2362,7 @@ def test_query_customer_checkout_as_anonymous_customer(
):
checkout.user = customer_user
checkout.save(update_fields=["user"])
- variables = {"token": str(checkout.token), "channel": checkout.channel.slug}
+ variables = {"token": str(checkout.token)}
response = api_client.post_graphql(QUERY_CHECKOUT, variables)
content = get_graphql_content(response)
assert not content["data"]["checkout"]
@@ -2387,7 +2371,7 @@ def test_query_customer_checkout_as_anonymous_customer(
def test_query_customer_checkout_as_customer(user_api_client, checkout, customer_user):
checkout.user = customer_user
checkout.save(update_fields=["user"])
- variables = {"token": str(checkout.token), "channel": checkout.channel.slug}
+ variables = {"token": str(checkout.token)}
response = user_api_client.post_graphql(QUERY_CHECKOUT, variables)
content = get_graphql_content(response)
assert content["data"]["checkout"]["token"] == str(checkout.token)
@@ -2398,7 +2382,7 @@ def test_query_other_customer_checkout_as_customer(
):
checkout.user = staff_user
checkout.save(update_fields=["user"])
- variables = {"token": str(checkout.token), "channel": checkout.channel.slug}
+ variables = {"token": str(checkout.token)}
response = user_api_client.post_graphql(QUERY_CHECKOUT, variables)
content = get_graphql_content(response)
assert not content["data"]["checkout"]
@@ -2409,7 +2393,7 @@ def test_query_customer_checkout_as_staff_user(
):
checkout.user = customer_user
checkout.save(update_fields=["user"])
- variables = {"token": str(checkout.token), "channel": checkout.channel.slug}
+ variables = {"token": str(checkout.token)}
response = app_api_client.post_graphql(
QUERY_CHECKOUT,
variables,
@@ -2425,7 +2409,7 @@ def test_query_customer_checkout_as_app(
):
checkout.user = customer_user
checkout.save(update_fields=["user"])
- variables = {"token": str(checkout.token), "channel": checkout.channel.slug}
+ variables = {"token": str(checkout.token)}
response = staff_api_client.post_graphql(
QUERY_CHECKOUT,
variables,
@@ -2437,7 +2421,7 @@ def test_query_customer_checkout_as_app(
def test_fetch_checkout_invalid_token(user_api_client, channel_USD):
- variables = {"token": str(uuid.uuid4()), "channel": channel_USD.slug}
+ variables = {"token": str(uuid.uuid4())}
response = user_api_client.post_graphql(QUERY_CHECKOUT, variables)
content = get_graphql_content(response)
data = content["data"]["checkout"]
@@ -2446,8 +2430,8 @@ def test_fetch_checkout_invalid_token(user_api_client, channel_USD):
def test_checkout_prices(user_api_client, checkout_with_item):
query = """
- query getCheckout($token: UUID!, $channel: String!) {
- checkout(token: $token, channel: $channel) {
+ query getCheckout($token: UUID!) {
+ checkout(token: $token) {
token,
totalPrice {
currency
@@ -2472,10 +2456,7 @@ def test_checkout_prices(user_api_client, checkout_with_item):
}
}
"""
- variables = {
- "token": str(checkout_with_item.token),
- "channel": checkout_with_item.channel.slug,
- }
+ variables = {"token": str(checkout_with_item.token)}
response = user_api_client.post_graphql(query, variables)
content = get_graphql_content(response)
data = content["data"]["checkout"]
diff --git a/saleor/graphql/checkout/tests/test_checkout_digital.py b/saleor/graphql/checkout/tests/test_checkout_digital.py
index da543688a0..b52c1ff6b7 100644
--- a/saleor/graphql/checkout/tests/test_checkout_digital.py
+++ b/saleor/graphql/checkout/tests/test_checkout_digital.py
@@ -68,8 +68,8 @@ def test_checkout_has_no_available_shipping_methods(
"""Test no shipping method are available on digital orders."""
query = """
- query getCheckout($token: UUID!, $channel: String!) {
- checkout(token: $token, channel: $channel) {
+ query getCheckout($token: UUID!) {
+ checkout(token: $token) {
availableShippingMethods {
name
}
@@ -83,7 +83,7 @@ def test_checkout_has_no_available_shipping_methods(
checkout.shipping_address = address
checkout.save(update_fields=["shipping_address"])
- variables = {"token": checkout.token, "channel": checkout.channel.slug}
+ variables = {"token": checkout.token}
response = api_client.post_graphql(query, variables)
content = get_graphql_content(response)
data = content["data"]["checkout"]
diff --git a/saleor/graphql/checkout/tests/test_checkout_promo_codes.py b/saleor/graphql/checkout/tests/test_checkout_promo_codes.py
index 33a3790789..c14e19d792 100644
--- a/saleor/graphql/checkout/tests/test_checkout_promo_codes.py
+++ b/saleor/graphql/checkout/tests/test_checkout_promo_codes.py
@@ -90,8 +90,8 @@ def test_checkout_totals_use_discounts(
sale.products.add(product)
query = """
- query getCheckout($token: UUID, $channel: String) {
- checkout(token: $token, channel: $channel) {
+ query getCheckout($token: UUID) {
+ checkout(token: $token) {
lines {
totalPrice {
gross {
@@ -113,7 +113,7 @@ def test_checkout_totals_use_discounts(
}
"""
- variables = {"token": str(checkout.token), "channel": checkout.channel.slug}
+ variables = {"token": str(checkout.token)}
response = api_client.post_graphql(query, variables)
content = get_graphql_content(response)
data = content["data"]["checkout"]
@@ -141,8 +141,8 @@ def test_checkout_totals_use_discounts(
QUERY_GET_CHECKOUT_GIFT_CARD_CODES = """
-query getCheckout($token: UUID!, $channel: String!) {
- checkout(token: $token, channel: $channel) {
+query getCheckout($token: UUID!) {
+ checkout(token: $token) {
token
giftCards {
displayCode
@@ -157,10 +157,7 @@ query getCheckout($token: UUID!, $channel: String!) {
def test_checkout_get_gift_card_code(user_api_client, checkout_with_gift_card):
gift_card = checkout_with_gift_card.gift_cards.first()
- variables = {
- "token": str(checkout_with_gift_card.token),
- "channel": checkout_with_gift_card.channel.slug,
- }
+ variables = {"token": str(checkout_with_gift_card.token)}
response = user_api_client.post_graphql(
QUERY_GET_CHECKOUT_GIFT_CARD_CODES, variables
)
@@ -177,10 +174,7 @@ def test_checkout_get_gift_card_codes(
checkout_with_gift_card.save()
gift_card_first = checkout_with_gift_card.gift_cards.first()
gift_card_last = checkout_with_gift_card.gift_cards.last()
- variables = {
- "token": str(checkout_with_gift_card.token),
- "channel": checkout_with_gift_card.channel.slug,
- }
+ variables = {"token": str(checkout_with_gift_card.token)}
response = user_api_client.post_graphql(
QUERY_GET_CHECKOUT_GIFT_CARD_CODES, variables
)
@@ -193,7 +187,7 @@ def test_checkout_get_gift_card_codes(
def test_checkout_get_gift_card_code_without_gift_card(user_api_client, checkout):
- variables = {"token": str(checkout.token), "channel": checkout.channel.slug}
+ variables = {"token": str(checkout.token)}
response = user_api_client.post_graphql(
QUERY_GET_CHECKOUT_GIFT_CARD_CODES, variables
)
diff --git a/saleor/graphql/core/fields.py b/saleor/graphql/core/fields.py
index 1eca121f5b..aebbbd6228 100644
--- a/saleor/graphql/core/fields.py
+++ b/saleor/graphql/core/fields.py
@@ -228,17 +228,3 @@ class ChannelContextFilterConnectionField(FilterInputConnectionField):
edges_with_context.append(edge)
connection.edges = edges_with_context
return connection
-
-
-class FieldWithChannel(graphene.Field):
- def __init__(self, type, *args, **kwargs):
- kwargs.setdefault(
- "channel",
- graphene.Argument(
- graphene.String,
- description=(
- "Slug of the channel for which the data should be returned."
- ),
- ),
- )
- super().__init__(type, *args, **kwargs)
diff --git a/saleor/graphql/core/tests/test_scalars.py b/saleor/graphql/core/tests/test_scalars.py
index cab931c5fb..8a1c521ecd 100644
--- a/saleor/graphql/core/tests/test_scalars.py
+++ b/saleor/graphql/core/tests/test_scalars.py
@@ -1,8 +1,8 @@
from ...tests.utils import get_graphql_content
QUERY_CHECKOUT = """
-query getCheckout($token: UUID!, $channel: String!) {
- checkout(token: $token, channel: $channel) {
+query getCheckout($token: UUID!) {
+ checkout(token: $token) {
token
}
}
@@ -10,14 +10,14 @@ query getCheckout($token: UUID!, $channel: String!) {
def test_uuid_scalar_value_passed_as_variable(api_client, checkout):
- variables = {"token": str(checkout.token), "channel": checkout.channel.slug}
+ variables = {"token": str(checkout.token)}
response = api_client.post_graphql(QUERY_CHECKOUT, variables)
content = get_graphql_content(response)
assert content["data"]["checkout"]["token"] == str(checkout.token)
def test_uuid_scalar_wrong_value_passed_as_variable(api_client, checkout):
- variables = {"token": "wrong-token", "channel": checkout.channel.slug}
+ variables = {"token": "wrong-token"}
response = api_client.post_graphql(QUERY_CHECKOUT, variables)
content = get_graphql_content(response, ignore_errors=True)
assert len(content["errors"]) == 1
@@ -25,11 +25,10 @@ def test_uuid_scalar_wrong_value_passed_as_variable(api_client, checkout):
def test_uuid_scalar_value_passed_in_input(api_client, checkout):
token = checkout.token
- channel_slug = checkout.channel.slug
query = f"""
query{{
- checkout(token: "{token}", channel: "{channel_slug}") {{
+ checkout(token: "{token}") {{
token
}}
}}
@@ -41,11 +40,10 @@ def test_uuid_scalar_value_passed_in_input(api_client, checkout):
def test_uuid_scalar_wrong_value_passed_in_input(api_client, checkout):
token = "wrong-token"
- channel_slug = checkout.channel.slug
query = f"""
query{{
- checkout(token: "{token}", channel: "{channel_slug}") {{
+ checkout(token: "{token}") {{
token
}}
}}
diff --git a/saleor/graphql/meta/tests/test_meta_queries.py b/saleor/graphql/meta/tests/test_meta_queries.py
index 90f41f7087..4e9d7f960e 100644
--- a/saleor/graphql/meta/tests/test_meta_queries.py
+++ b/saleor/graphql/meta/tests/test_meta_queries.py
@@ -143,8 +143,8 @@ def test_query_public_meta_for_staff_as_app(
QUERY_CHECKOUT_PUBLIC_META = """
- query checkoutMeta($token: UUID!, $channel: String!){
- checkout(token: $token, channel: $channel){
+ query checkoutMeta($token: UUID!){
+ checkout(token: $token){
metadata{
key
value
@@ -158,7 +158,7 @@ def test_query_public_meta_for_checkout_as_anonymous_user(api_client, checkout):
# given
checkout.store_value_in_metadata({PUBLIC_KEY: PUBLIC_VALUE})
checkout.save(update_fields=["metadata"])
- variables = {"token": checkout.pk, "channel": checkout.channel.slug}
+ variables = {"token": checkout.pk}
# when
response = api_client.post_graphql(QUERY_CHECKOUT_PUBLIC_META, variables)
@@ -177,7 +177,7 @@ def test_query_public_meta_for_other_customer_checkout_as_anonymous_user(
checkout.user = customer_user
checkout.store_value_in_metadata({PUBLIC_KEY: PUBLIC_VALUE})
checkout.save(update_fields=["user", "metadata"])
- variables = {"token": checkout.pk, "channel": checkout.channel.slug}
+ variables = {"token": checkout.pk}
# when
response = api_client.post_graphql(QUERY_CHECKOUT_PUBLIC_META, variables)
@@ -192,7 +192,7 @@ def test_query_public_meta_for_checkout_as_customer(user_api_client, checkout):
checkout.user = user_api_client.user
checkout.store_value_in_metadata({PUBLIC_KEY: PUBLIC_VALUE})
checkout.save(update_fields=["user", "metadata"])
- variables = {"token": checkout.pk, "channel": checkout.channel.slug}
+ variables = {"token": checkout.pk}
# when
response = user_api_client.post_graphql(QUERY_CHECKOUT_PUBLIC_META, variables)
@@ -211,7 +211,7 @@ def test_query_public_meta_for_checkout_as_staff(
checkout.user = customer_user
checkout.store_value_in_metadata({PUBLIC_KEY: PUBLIC_VALUE})
checkout.save(update_fields=["user", "metadata"])
- variables = {"token": checkout.pk, "channel": checkout.channel.slug}
+ variables = {"token": checkout.pk}
# when
response = staff_api_client.post_graphql(
@@ -235,7 +235,7 @@ def test_query_public_meta_for_checkout_as_app(
checkout.user = customer_user
checkout.store_value_in_metadata({PUBLIC_KEY: PUBLIC_VALUE})
checkout.save(update_fields=["user", "metadata"])
- variables = {"token": checkout.pk, "channel": checkout.channel.slug}
+ variables = {"token": checkout.pk}
# when
response = app_api_client.post_graphql(
@@ -1515,8 +1515,8 @@ def test_query_private_meta_for_staff_as_app(
QUERY_CHECKOUT_PRIVATE_META = """
- query checkoutMeta($token: UUID!, $channel: String!){
- checkout(token: $token, channel: $channel){
+ query checkoutMeta($token: UUID!){
+ checkout(token: $token){
privateMetadata{
key
value
@@ -1528,7 +1528,7 @@ QUERY_CHECKOUT_PRIVATE_META = """
def test_query_private_meta_for_checkout_as_anonymous_user(api_client, checkout):
# given
- variables = {"token": checkout.pk, "channel": checkout.channel.slug}
+ variables = {"token": checkout.pk}
# when
response = api_client.post_graphql(QUERY_CHECKOUT_PRIVATE_META, variables)
@@ -1543,7 +1543,7 @@ def test_query_private_meta_for_other_customer_checkout_as_anonymous_user(
# given
checkout.user = customer_user
checkout.save(update_fields=["user"])
- variables = {"token": checkout.pk, "channel": checkout.channel.slug}
+ variables = {"token": checkout.pk}
# when
response = api_client.post_graphql(QUERY_CHECKOUT_PRIVATE_META, variables)
@@ -1557,7 +1557,7 @@ def test_query_private_meta_for_checkout_as_customer(user_api_client, checkout):
# given
checkout.user = user_api_client.user
checkout.save(update_fields=["user"])
- variables = {"token": checkout.pk, "channel": checkout.channel.slug}
+ variables = {"token": checkout.pk}
# when
response = user_api_client.post_graphql(QUERY_CHECKOUT_PRIVATE_META, variables)
@@ -1573,7 +1573,7 @@ def test_query_private_meta_for_checkout_as_staff(
checkout.user = customer_user
checkout.store_value_in_private_metadata({PRIVATE_KEY: PRIVATE_VALUE})
checkout.save(update_fields=["user", "private_metadata"])
- variables = {"token": checkout.pk, "channel": checkout.channel.slug}
+ variables = {"token": checkout.pk}
# when
response = staff_api_client.post_graphql(
@@ -1597,7 +1597,7 @@ def test_query_private_meta_for_checkout_as_app(
checkout.user = customer_user
checkout.store_value_in_private_metadata({PRIVATE_KEY: PRIVATE_VALUE})
checkout.save(update_fields=["user", "private_metadata"])
- variables = {"token": checkout.pk, "channel": checkout.channel.slug}
+ variables = {"token": checkout.pk}
# when
response = app_api_client.post_graphql(
diff --git a/saleor/graphql/schema.graphql b/saleor/graphql/schema.graphql
index 850ccb7b23..24c403d413 100644
--- a/saleor/graphql/schema.graphql
+++ b/saleor/graphql/schema.graphql
@@ -4188,7 +4188,7 @@ type Query {
exportFile(id: ID!): ExportFile
exportFiles(filter: ExportFileFilterInput, sortBy: ExportFileSortingInput, before: String, after: String, first: Int, last: Int): ExportFileCountableConnection
taxTypes: [TaxType]
- checkout(token: UUID, channel: String): Checkout
+ checkout(token: UUID): Checkout
checkouts(channel: String, before: String, after: String, first: Int, last: Int): CheckoutCountableConnection
checkoutLine(id: ID): CheckoutLine
checkoutLines(before: String, after: String, first: Int, last: Int): CheckoutLineCountableConnection
diff --git a/saleor/tests/fixtures.py b/saleor/tests/fixtures.py
index 73bf50dead..f40bdecc8d 100644
--- a/saleor/tests/fixtures.py
+++ b/saleor/tests/fixtures.py
@@ -2476,23 +2476,6 @@ def collection_list(db, channel_USD):
return collections
-def collection_list_unpublished(collection_list):
- collections = Collection.objects.filter(
- pk__in=[collection.pk for collection in collection_list]
- )
- collections.update(is_published=False)
- return collections
-
-
-def draft_collection(db):
- collection = Collection.objects.create(
- name="Draft collection", slug="draft-collection", is_published=False
- )
- return collection
-
-
@pytest.fixture
def page(db):
data = {