Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Use assert_called_once_with in account tests
fowczarek553cf000fd28
diff --git a/saleor/graphql/account/mutations/account.py b/saleor/graphql/account/mutations/account.pyindex d220e914a3..fedec8df47 100644--- a/saleor/graphql/account/mutations/account.py+++ b/saleor/graphql/account/mutations/account.py@@ -225,17 +225,11 @@ class AccountSetDefaultAddress(BaseMutation):return cls(user=user)-class AccountRequestPasswordResetInput(graphene.InputObjectType):- email = graphene.String(- required=True,- description=("Email of the user that will be used for password recovery."),- )--class AccountRequestPasswordReset(BaseMutation):class Arguments:- input = AccountRequestPasswordResetInput(- description="Fields required to reset customer's password", required=True+ email = graphene.String(+ required=True,+ description=("Email of the user that will be used for password recovery."),)class Meta:@@ -246,7 +240,7 @@ class AccountRequestPasswordReset(BaseMutation):@classmethoddef perform_mutation(cls, _root, info, **data):- email = data.get("input")["email"]+ email = data["email"]try:user = models.User.objects.get(email=email)except ObjectDoesNotExist:diff --git a/tests/api/test_account.py b/tests/api/test_account.pyindex 5b3c47cab5..c0255467f8 100644--- a/tests/api/test_account.py+++ b/tests/api/test_account.py@@ -1,7 +1,7 @@import jsonimport reimport uuid-from unittest.mock import MagicMock, Mock, patch+from unittest.mock import ANY, MagicMock, Mock, patchimport grapheneimport pytest@@ -1403,13 +1403,9 @@ def test_request_password_reset_email(data = content["data"]["customerRequestPasswordReset"]assert data == {"errors": []}assert send_password_reset_mock.call_count == 1- args, kwargs = send_password_reset_mock.call_args- call_context = args[0]- call_email = args[1]- call_user_pk = args[2]- assert call_email == customer_user.email- assert "token" in call_context- assert call_user_pk == customer_user.pk+ send_password_reset_mock.assert_called_once_with(+ ANY, customer_user.email, customer_user.pk+ )@patch("saleor.account.emails.send_password_reset_email.delay")@@ -1435,13 +1431,9 @@ def test_deprecated_password_reset_email(data = content["data"]["passwordReset"]assert data == {"errors": []}assert send_password_reset_mock.call_count == 1- args, kwargs = send_password_reset_mock.call_args- call_context = args[0]- call_email = args[1]- call_user_pk = args[2]- assert call_email == email- assert "token" in call_context- assert call_user_pk == customer_user.pk+ send_password_reset_mock.assert_called_once_with(+ ANY, customer_user.email, customer_user.pk+ )@patch("saleor.account.emails.send_password_reset_email.delay")@@ -1842,7 +1834,7 @@ CUSTOMER_PASSWORD_RESET_MUTATION = """ACCOUNT_PASSWORD_RESET_MUTATION = """mutation AccountRequestPasswordReset($email: String!) {- accountRequestPasswordReset(input: {email: $email}) {+ accountRequestPasswordReset(email: $email) {errors {fieldmessage