Skip to content

Commit

Permalink
tests(account): Signup next URL vs email verification
Browse files Browse the repository at this point in the history
  • Loading branch information
pennersr committed Sep 19, 2024
1 parent eb79e3a commit d52f8d7
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions allauth/account/tests/test_email_verification_by_code.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import re

from django.conf import settings
from django.contrib.auth import get_user_model
from django.urls import reverse

Expand Down Expand Up @@ -33,10 +34,19 @@ def email_verification_settings(settings):
return settings


def test_signup(client, db, settings, password_factory, get_last_code):
@pytest.mark.parametrize(
"query,expected_url",
[
("", settings.LOGIN_REDIRECT_URL),
("?next=/foo", "/foo"),
],
)
def test_signup(
client, db, settings, password_factory, get_last_code, query, expected_url
):
password = password_factory()
resp = client.post(
reverse("account_signup"),
reverse("account_signup") + query,
{
"username": "johndoe",
"email": "[email protected]",
Expand All @@ -52,7 +62,7 @@ def test_signup(client, db, settings, password_factory, get_last_code):
assert resp.status_code == 200
resp = client.post(reverse("account_email_verification_sent"), data={"code": code})
assert resp.status_code == 302
assert resp["location"] == settings.LOGIN_REDIRECT_URL
assert resp["location"] == expected_url


def test_signup_prevent_enumeration(
Expand Down

0 comments on commit d52f8d7

Please sign in to comment.