Skip to content

Commit

Permalink
Add testcase for testing signup get_initialmethod
Browse files Browse the repository at this point in the history
  • Loading branch information
varun kumar committed Sep 12, 2023
1 parent 68faa4a commit 47ea67f
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions allauth/account/tests/test_signup.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,3 +315,16 @@ def test_django_password_validation(self):
"password1",
["This password is too short. It must contain at least 9 characters."],
)

def test_get_initial_with_valid_email(self):
"""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()
view = signup(request)
view.request = request
self.assertEqual(
view.context_data["view"].get_initial()["email"], "[email protected]"
)

0 comments on commit 47ea67f

Please sign in to comment.