diff --git a/allauth/account/tests/test_signup.py b/allauth/account/tests/test_signup.py index ed7c5933e8..f6736087a5 100644 --- a/allauth/account/tests/test_signup.py +++ b/allauth/account/tests/test_signup.py @@ -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=test@example.com") + 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"], "test@example.com" + )