Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Remove depracated lines from account mutations
IKarbowiakd8f0a75eaf73
diff --git a/saleor/graphql/account/mutations/base.py b/saleor/graphql/account/mutations/base.pyindex 92a72e708c..34dc5bdf21 100644--- a/saleor/graphql/account/mutations/base.py+++ b/saleor/graphql/account/mutations/base.py@@ -308,13 +308,6 @@ class CustomerInput(UserInput, UserAddressInput):class UserCreateInput(CustomerInput):- send_password_email = graphene.Boolean(- description=(- "DEPRECATED: Will be removed in Saleor 2.10, if mutation has `redirect_url`"- " in input then customer get email with link to set a password. "- "Send an email with a link to set a password."- )- )redirect_url = graphene.String(description=("URL of a view where users should be redirected to "@@ -353,19 +346,6 @@ class BaseCustomerCreate(ModelMutation, I18nMixin):)cleaned_input[BILLING_ADDRESS_FIELD] = billing_address- # DEPRECATED: We should remove this condition when dropping- # `send_password_email` from mutation input.- if cleaned_input.get("send_password_email"):- if not cleaned_input.get("redirect_url"):- raise ValidationError(- {- "redirect_url": ValidationError(- "Redirect url is required to send a password.",- code=AccountErrorCode.REQUIRED,- )- }- )-if cleaned_input.get("redirect_url"):try:validate_storefront_url(cleaned_input.get("redirect_url"))diff --git a/saleor/graphql/account/mutations/staff.py b/saleor/graphql/account/mutations/staff.pyindex 64d95c9301..d74272a886 100644--- a/saleor/graphql/account/mutations/staff.py+++ b/saleor/graphql/account/mutations/staff.py@@ -44,13 +44,6 @@ class StaffInput(UserInput):class StaffCreateInput(StaffInput):- send_password_email = graphene.Boolean(- description=(- "DEPRECATED: Will be removed in Saleor 2.10, if mutation has `redirect_url`"- " in input then staff get email with link to set a password. "- "Send an email with a link to set the password."- )- )redirect_url = graphene.String(description=("URL of a view where users should be redirected to "@@ -175,19 +168,6 @@ class StaffCreate(ModelMutation):def clean_input(cls, info, instance, data):cleaned_input = super().clean_input(info, instance, data)- # DEPRECATED: We should remove this condition when dropping- # `send_password_email` from mutation input.- if cleaned_input.get("send_password_email"):- if not cleaned_input.get("redirect_url"):- raise ValidationError(- {- "redirect_url": ValidationError(- "Redirect url is required to send a password.",- AccountErrorCode.REQUIRED,- )- }- )-if cleaned_input.get("redirect_url"):try:validate_storefront_url(cleaned_input.get("redirect_url"))diff --git a/saleor/graphql/schema.graphql b/saleor/graphql/schema.graphqlindex 6fccce7884..7935af72c6 100644--- a/saleor/graphql/schema.graphql+++ b/saleor/graphql/schema.graphql@@ -4066,7 +4066,6 @@ input StaffCreateInput {isActive: Booleannote: Stringpermissions: [PermissionEnum]- sendPasswordEmail: BooleanredirectUrl: String}@@ -4328,7 +4327,6 @@ input UserCreateInput {email: StringisActive: Booleannote: String- sendPasswordEmail: BooleanredirectUrl: String}diff --git a/tests/api/test_account.py b/tests/api/test_account.pyindex a65a089ebf..d3581924bf 100644--- a/tests/api/test_account.py+++ b/tests/api/test_account.py@@ -605,7 +605,7 @@ CUSTOMER_CREATE_MUTATION = """mutation CreateCustomer($email: String, $firstName: String, $lastName: String,$note: String, $billing: AddressInput, $shipping: AddressInput,- $send_mail: Boolean, $redirect_url: String) {+ $redirect_url: String) {customerCreate(input: {email: $email,firstName: $firstName,@@ -613,7 +613,6 @@ CUSTOMER_CREATE_MUTATION = """note: $note,defaultShippingAddress: $shipping,defaultBillingAddress: $billing- sendPasswordEmail: $send_mailredirectUrl: $redirect_url}) {errors {@@ -736,24 +735,6 @@ def test_customer_create_without_send_password(User.objects.get(email=email)-def test_customer_create_without_redirect_url_deprecated_send_mail_flag(- staff_api_client, permission_manage_users-):- email = "[email protected]"- variables = {"email": email, "send_mail": True}- response = staff_api_client.post_graphql(- CUSTOMER_CREATE_MUTATION, variables, permissions=[permission_manage_users]- )- content = get_graphql_content(response)- data = content["data"]["customerCreate"]- assert data["accountErrors"][0] == {- "field": "redirectUrl",- "code": AccountErrorCode.REQUIRED.name,- }- staff_user = User.objects.filter(email=email)- assert not staff_user--def test_customer_create_with_invalid_url(staff_api_client, permission_manage_users):email = "[email protected]"variables = {"email": email, "redirect_url": "invalid"}@@ -1299,10 +1280,9 @@ def test_customer_delete_errors(customer_user, admin_user, staff_user):STAFF_CREATE_MUTATION = """mutation CreateStaff(- $email: String, $permissions: [PermissionEnum],- $send_mail: Boolean, $redirect_url: String) {+ $email: String, $permissions: [PermissionEnum], $redirect_url: String) {staffCreate(input: {email: $email, permissions: $permissions,- sendPasswordEmail: $send_mail, redirectUrl: $redirect_url}) {+ redirectUrl: $redirect_url}) {errors {fieldmessage@@ -1404,24 +1384,6 @@ def test_staff_create_without_send_password(User.objects.get(email=email)-def test_staff_create_without_redirect_url_deprecated_send_mail_flag(- staff_api_client, media_root, permission_manage_staff-):- email = "[email protected]"- variables = {"email": email, "send_mail": True}- response = staff_api_client.post_graphql(- STAFF_CREATE_MUTATION, variables, permissions=[permission_manage_staff]- )- content = get_graphql_content(response)- data = content["data"]["staffCreate"]- assert data["accountErrors"][0] == {- "field": "redirectUrl",- "code": AccountErrorCode.REQUIRED.name,- }- staff_user = User.objects.filter(email=email)- assert not staff_user--def test_staff_create_with_invalid_url(staff_api_client, media_root, permission_manage_staff):