From 8229bce749e53f10b7f22a6717d6d244d982bdbb Mon Sep 17 00:00:00 2001 From: Raymond Penners Date: Fri, 1 Nov 2024 13:55:44 +0100 Subject: [PATCH] tests(account): Test PasswordResetDoneView/LoginRequiredMiddleware --- ChangeLog.rst | 4 ++++ allauth/account/tests/test_reset_password.py | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ChangeLog.rst b/ChangeLog.rst index 7196e6a959..001aa71525 100644 --- a/ChangeLog.rst +++ b/ChangeLog.rst @@ -7,6 +7,10 @@ Fixes - A ``NoReverseMatch`` could occur when using ``ACCOUNT_LOGIN_BY_CODE_REQUIRED = True`` while ``ACCOUNT_LOGIN_BY_CODE_ENABLED = False``, fixed. +- The ``PasswordResetDoneView`` did not behave correctly when using Django's + ``LoginRequiredMiddleware``, as it was not properly marked as + ``@login_not_required``. + 65.1.0 (2024-10-23) ******************* diff --git a/allauth/account/tests/test_reset_password.py b/allauth/account/tests/test_reset_password.py index 459793d973..865cd2d06a 100644 --- a/allauth/account/tests/test_reset_password.py +++ b/allauth/account/tests/test_reset_password.py @@ -32,12 +32,14 @@ def f(user): @pytest.mark.django_db def test_reset_password_unknown_account(client, settings): settings.ACCOUNT_PREVENT_ENUMERATION = True - client.post( + resp = client.post( reverse("account_reset_password"), data={"email": "unknown@example.org"}, + follow=True, ) assert len(mail.outbox) == 1 assert mail.outbox[0].to == ["unknown@example.org"] + assert resp.redirect_chain == [(reverse("account_reset_password_done"), 302)] @pytest.mark.django_db