Skip to content

Commit

Permalink
tests(account): ACCOUNT_EMAIL_CONFIRMATION_ANONYMOUS_REDIRECT_URL
Browse files Browse the repository at this point in the history
  • Loading branch information
pennersr committed Oct 7, 2024
1 parent f03ff4d commit e9972e6
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions allauth/account/tests/test_email_verification.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,3 +338,25 @@ def test_email_verification_login_redirect(client, db, settings, password_factor
assert resp["location"] == reverse("account_email_verification_sent")
resp = client.get(reverse("account_login"))
assert resp.status_code == 200


def test_email_verification_redirect_url(client, db, settings, user_password):
settings.ACCOUNT_EMAIL_VERIFICATION = app_settings.EmailVerificationMethod.MANDATORY
settings.ACCOUNT_EMAIL_CONFIRMATION_ANONYMOUS_REDIRECT_URL = "/foobar"
settings.ACCOUNT_CONFIRM_EMAIL_ON_GET = True
email = "user@email.org"
resp = client.post(
reverse("account_signup"),
{
"username": "johndoe",
"email": email,
"password1": user_password,
"password2": user_password,
},
)
assert resp.status_code == 302
assert resp["location"] == reverse("account_email_verification_sent")
confirmation = EmailConfirmationHMAC(EmailAddress.objects.get(email=email))
resp = client.get(reverse("account_confirm_email", args=[confirmation.key]))
assert resp.status_code == 302
assert resp["location"] == "/foobar"

0 comments on commit e9972e6

Please sign in to comment.