From 40433eaf3eecec0d4cc334befad97a519ccfc4ff Mon Sep 17 00:00:00 2001 From: Raymond Penners Date: Thu, 22 Aug 2024 15:11:36 +0200 Subject: [PATCH] tests: Add request context --- allauth/account/adapter.py | 2 +- allauth/socialaccount/tests/test_signup.py | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/allauth/account/adapter.py b/allauth/account/adapter.py index 5d99b0eddf..54291267f3 100644 --- a/allauth/account/adapter.py +++ b/allauth/account/adapter.py @@ -19,7 +19,7 @@ validate_password, ) from django.contrib.sites.shortcuts import get_current_site -from django.core.exceptions import FieldDoesNotExist, PermissionDenied +from django.core.exceptions import FieldDoesNotExist from django.core.mail import EmailMessage, EmailMultiAlternatives from django.http import HttpResponse, HttpResponseRedirect from django.shortcuts import resolve_url diff --git a/allauth/socialaccount/tests/test_signup.py b/allauth/socialaccount/tests/test_signup.py index 80b63f625b..56ce2d9aa8 100644 --- a/allauth/socialaccount/tests/test_signup.py +++ b/allauth/socialaccount/tests/test_signup.py @@ -22,12 +22,13 @@ def f(client, sociallogin): request = request_factory.get("/") request.user = AnonymousUser() - resp = complete_social_login(request, sociallogin) - session = client.session - for k, v in request.session.items(): - session[k] = v - session.save() - return resp + with context.request_context(request): + resp = complete_social_login(request, sociallogin) + session = client.session + for k, v in request.session.items(): + session[k] = v + session.save() + return resp return f