Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Code reformat, schema update
Tomasz Szymański2cf07ee33203
diff --git a/saleor/graphql/account/mutations/base.py b/saleor/graphql/account/mutations/base.pyindex cfce2775f5..88bde3484d 100644--- a/saleor/graphql/account/mutations/base.py+++ b/saleor/graphql/account/mutations/base.py@@ -160,7 +160,7 @@ class ConfirmAccount(BaseMutation):)email = graphene.String(description="E-mail of the user performing account confirmation.",- required=True+ required=True,)class Meta:diff --git a/saleor/graphql/schema.graphql b/saleor/graphql/schema.graphqlindex 7f3ce8cee7..b61f97ffb0 100644--- a/saleor/graphql/schema.graphql+++ b/saleor/graphql/schema.graphql@@ -1027,6 +1027,10 @@ enum ConfigurationTypeFieldEnum {PASSWORD}+type ConfirmAccount {+ errors: [Error!]+}+enum CountryCode {AFAX@@ -2259,6 +2263,7 @@ type Mutation {checkoutUpdatePrivateMetadata(id: ID!, input: MetaInput!): CheckoutUpdatePrivateMetacheckoutClearPrivateMetadata(id: ID!, input: MetaPath!): CheckoutClearPrivateMetarequestPasswordReset(email: String!, redirectUrl: String!): RequestPasswordReset+ confirmAccount(email: String!, token: String!): ConfirmAccountsetPassword(token: String!, email: String!, password: String!): SetPasswordpasswordChange(newPassword: String!, oldPassword: String!): PasswordChangeaccountAddressCreate(input: AddressInput!, type: AddressTypeEnum): AccountAddressCreatediff --git a/saleor/settings.py b/saleor/settings.pyindex 0fa9ecc970..1378a0135c 100644--- a/saleor/settings.py+++ b/saleor/settings.py@@ -128,7 +128,10 @@ EMAIL_BACKEND = email_config["EMAIL_BACKEND"]EMAIL_USE_TLS = email_config["EMAIL_USE_TLS"]EMAIL_USE_SSL = email_config["EMAIL_USE_SSL"]-ENABLE_ACCOUNT_CONFIRMATION_BY_EMAIL = True+# WARNING: frontend confirmation screen is NOT created yet.+# Enabling this feature will cause incomplete registrations.+# Should remain disabled unless you know what you're doing!+ENABLE_ACCOUNT_CONFIRMATION_BY_EMAIL = FalseENABLE_SSL = get_bool_from_env("ENABLE_SSL", False)diff --git a/tests/api/test_account.py b/tests/api/test_account.pyindex ec042c5e70..3ffce41c51 100644--- a/tests/api/test_account.py+++ b/tests/api/test_account.py@@ -579,6 +579,7 @@ ACCOUNT_REGISTER_MUTATION = """"""+@override_settings(ENABLE_ACCOUNT_CONFIRMATION_BY_EMAIL=True)@patch("saleor.account.emails._send_account_confirmation_email")def test_customer_register(send_account_confirmation_email_mock, user_api_client):email = "[email protected]"@@ -606,7 +607,9 @@ def test_customer_register(send_account_confirmation_email_mock, user_api_client@override_settings(ENABLE_ACCOUNT_CONFIRMATION_BY_EMAIL=False)@patch("saleor.account.emails._send_account_confirmation_email")-def test_customer_register_disabled_email_confirmation(send_account_confirmation_email_mock, user_api_client):+def test_customer_register_disabled_email_confirmation(+ send_account_confirmation_email_mock, user_api_client+):variables = {"email": "[email protected]", "password": "Password"}user_api_client.post_graphql(ACCOUNT_REGISTER_MUTATION, variables)assert send_account_confirmation_email_mock.delay.call_count == 0@@ -2144,38 +2147,33 @@ def test_account_confirmation(user_api_client, customer_user):variables = {"email": customer_user.email,- "token": default_token_generator.make_token(customer_user)+ "token": default_token_generator.make_token(customer_user),}user_api_client.post_graphql(CONFIRM_ACCOUNT_MUTATION, variables)customer_user.refresh_from_db()- assert customer_user.is_active == True+ assert customer_user.is_active is Truedef test_account_confirmation_invalid_user(user_api_client, customer_user):variables = {"email": "[email protected]",- "token": default_token_generator.make_token(customer_user)+ "token": default_token_generator.make_token(customer_user),}response = user_api_client.post_graphql(CONFIRM_ACCOUNT_MUTATION, variables)content = get_graphql_content(response)- assert content["data"]["confirmAccount"]["errors"] == [{- "field": "email",- "message": "User with this email doesn't exist"- }]+ assert content["data"]["confirmAccount"]["errors"] == [+ {"field": "email", "message": "User with this email doesn't exist"}+ ]def test_account_confirmation_invalid_token(user_api_client, customer_user):- variables = {- "email": customer_user.email,- "token": "invalid_token"- }+ variables = {"email": customer_user.email, "token": "invalid_token"}response = user_api_client.post_graphql(CONFIRM_ACCOUNT_MUTATION, variables)content = get_graphql_content(response)- assert content["data"]["confirmAccount"]["errors"] == [{- "field": "token",- "message": "Invalid or expired token."- }]+ assert content["data"]["confirmAccount"]["errors"] == [+ {"field": "token", "message": "Invalid or expired token."}+ ]@patch("saleor.account.emails._send_password_reset_email")