-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(account): Added prefilling of email field in signup form
Co-authored-by: varun kumar <[email protected]>
- Loading branch information
1 parent
f98c9a3
commit ddadb93
Showing
2 changed files
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ | |
from django.test.utils import override_settings | ||
from django.urls import reverse | ||
|
||
import pytest | ||
from pytest_django.asserts import assertTemplateUsed | ||
|
||
from allauth.account import app_settings | ||
|
@@ -371,3 +372,16 @@ def test_prevent_enumeration_on(settings, user_factory): | |
assert resp.context["form"].errors == { | ||
"email": ["A user is already registered with this email address."] | ||
} | ||
|
||
|
||
@pytest.mark.django_db | ||
def test_get_initial_with_valid_email(): | ||
"""Test that the email field is populated with a valid email.""" | ||
request = RequestFactory().get("/signup/[email protected]") | ||
from allauth.account.views import signup | ||
|
||
SessionMiddleware(lambda request: None).process_request(request) | ||
request.user = AnonymousUser() | ||
with context.request_context(request): | ||
view = signup(request) | ||
assert view.context_data["view"].get_initial()["email"] == "[email protected]" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters