Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Change mutation name
fowczarekd849171ba41c
diff --git a/saleor/graphql/account/mutations.py b/saleor/graphql/account/mutations.pyindex 06a373ef4e..430e30792c 100644--- a/saleor/graphql/account/mutations.py+++ b/saleor/graphql/account/mutations.py@@ -297,9 +297,11 @@ class AccountUpdate(CustomerCreate):return super().perform_mutation(root, info, **data)-class AccountDelete(BaseMutation):+class AccountRequestDeletion(BaseMutation):class Meta:- description = "Remove user account after email confirmation"+ description = (+ "Sends an email with the account removal link for the logged-in user."+ )@classmethoddef check_permissions(cls, user):@@ -309,7 +311,7 @@ class AccountDelete(BaseMutation):def perform_mutation(cls, root, info, **data):user = info.context.useremails.send_account_delete_confirmation_email.delay(str(user.token), user.email)- return AccountDelete()+ return AccountRequestDeletion()class UserDelete(UserDeleteMixin, ModelDeleteMutation):diff --git a/saleor/graphql/account/schema.py b/saleor/graphql/account/schema.pyindex fa50eddb34..881da54b4c 100644--- a/saleor/graphql/account/schema.py+++ b/saleor/graphql/account/schema.py@@ -8,7 +8,7 @@ from .bulk_mutations import CustomerBulkDelete, StaffBulkDelete, UserBulkSetActifrom .enums import CountryCodeEnumfrom .filters import CustomerFilter, StaffUserFilterfrom .mutations import (- AccountDelete,+ AccountRequestDeletion,AccountUpdate,AddressCreate,AddressDelete,@@ -112,7 +112,7 @@ class AccountMutations(graphene.ObjectType):logged_user_update = LoggedUserUpdate.Field()account_update = AccountUpdate.Field()- account_delete = AccountDelete.Field()+ account_request_deletion = AccountRequestDeletion.Field()staff_create = StaffCreate.Field()staff_delete = StaffDelete.Field()diff --git a/saleor/graphql/schema.graphql b/saleor/graphql/schema.graphqlindex b301ca9d2b..6fc6e7181b 100644--- a/saleor/graphql/schema.graphql+++ b/saleor/graphql/schema.graphql@@ -3,10 +3,6 @@ schema {mutation: Mutations}-type AccountDelete {- errors: [Error!]-}-input AccountInput {firstName: StringlastName: String@@ -14,6 +10,10 @@ input AccountInput {defaultShippingAddress: AddressInput}+type AccountRequestDeletion {+ errors: [Error!]+}+type AccountUpdate {errors: [Error!]user: User@@ -1671,7 +1671,7 @@ type Mutations {customerSetDefaultAddress(id: ID!, type: AddressTypeEnum!): CustomerSetDefaultAddressloggedUserUpdate(input: UserAddressInput!): LoggedUserUpdateaccountUpdate(input: AccountInput!): AccountUpdate- accountDelete: AccountDelete+ accountRequestDeletion: AccountRequestDeletionstaffCreate(input: StaffCreateInput!): StaffCreatestaffDelete(id: ID!): StaffDeletestaffBulkDelete(ids: [ID]!): StaffBulkDeletediff --git a/tests/api/test_account.py b/tests/api/test_account.pyindex b39a14e7d9..6968c9f6af 100644--- a/tests/api/test_account.py+++ b/tests/api/test_account.py@@ -938,9 +938,9 @@ def test_logged_customer_update_anonymous_user(api_client, query):assert_no_permission(response)-ACCOUNT_DELETE_QUERY = """- mutation accountDelete {- accountDelete {+ACCOUNT_REQUEST_DELETION_QUERY = """+ mutation accountRequestDeletion {+ accountRequestDeletion {errors {fieldmessage@@ -951,12 +951,14 @@ ACCOUNT_DELETE_QUERY = """@patch("saleor.account.emails.send_account_delete_confirmation_email.delay")-def test_account_delete(send_account_delete_confirmation_email_mock, user_api_client):+def test_account_request_deletion(+ send_account_delete_confirmation_email_mock, user_api_client+):user = user_api_client.user- response = user_api_client.post_graphql(ACCOUNT_DELETE_QUERY)+ response = user_api_client.post_graphql(ACCOUNT_REQUEST_DELETION_QUERY)content = get_graphql_content(response)- data = content["data"]["accountDelete"]+ data = content["data"]["accountRequestDeletion"]assert not data["errors"]send_account_delete_confirmation_email_mock.assert_called_once_with(@@ -965,10 +967,10 @@ def test_account_delete(send_account_delete_confirmation_email_mock, user_api_cl@patch("saleor.account.emails.send_account_delete_confirmation_email.delay")-def test_account_delete_anonymous_user(+def test_account_request_deletion_anonymous_user(send_account_delete_confirmation_email_mock, api_client):- response = api_client.post_graphql(ACCOUNT_DELETE_QUERY, {})+ response = api_client.post_graphql(ACCOUNT_REQUEST_DELETION_QUERY, {})assert_no_permission(response)send_account_delete_confirmation_email_mock.assert_not_called()