diff --git a/allauth/account/utils.py b/allauth/account/utils.py index 3b5e15a5b5..c04e4e9475 100644 --- a/allauth/account/utils.py +++ b/allauth/account/utils.py @@ -5,7 +5,7 @@ from django.conf import settings from django.contrib import messages -from django.contrib.auth import update_session_auth_hash +from django.contrib.auth import get_user_model, update_session_auth_hash from django.core.exceptions import FieldDoesNotExist from django.db import models from django.db.models import Q @@ -18,7 +18,6 @@ from allauth.core.exceptions import ImmediateHttpResponse from allauth.utils import ( get_request_param, - get_user_model, import_callable, valid_email_or_none, ) diff --git a/allauth/conftest.py b/allauth/conftest.py index afad29d346..5e95ad200b 100644 --- a/allauth/conftest.py +++ b/allauth/conftest.py @@ -2,12 +2,13 @@ from contextlib import contextmanager from unittest.mock import patch +from django.contrib.auth import get_user_model + import pytest from allauth.account.models import EmailAddress from allauth.account.utils import user_email, user_username from allauth.core import context -from allauth.utils import get_user_model @pytest.fixture diff --git a/allauth/socialaccount/providers/discord/tests.py b/allauth/socialaccount/providers/discord/tests.py index d3649ae47f..7a806cfadb 100644 --- a/allauth/socialaccount/providers/discord/tests.py +++ b/allauth/socialaccount/providers/discord/tests.py @@ -1,3 +1,5 @@ +from django.contrib.auth import get_user_model + from allauth.account.models import EmailAddress from allauth.account.utils import user_email, user_username from allauth.socialaccount import app_settings @@ -5,7 +7,6 @@ from allauth.socialaccount.providers.discord.provider import DiscordProvider from allauth.socialaccount.tests import OAuth2TestsMixin from allauth.tests import MockedResponse, TestCase -from allauth.utils import get_user_model class DiscordTests(OAuth2TestsMixin, TestCase): diff --git a/allauth/socialaccount/providers/facebook/tests.py b/allauth/socialaccount/providers/facebook/tests.py index 40f5a70382..a22e68ca8a 100644 --- a/allauth/socialaccount/providers/facebook/tests.py +++ b/allauth/socialaccount/providers/facebook/tests.py @@ -1,5 +1,6 @@ import json +from django.contrib.auth import get_user_model from django.test.client import RequestFactory from django.test.utils import override_settings from django.urls import reverse @@ -9,7 +10,6 @@ from allauth.socialaccount.models import SocialAccount from allauth.socialaccount.tests import OAuth2TestsMixin from allauth.tests import MockedResponse, TestCase, patch -from allauth.utils import get_user_model from .provider import FacebookProvider diff --git a/allauth/socialaccount/providers/openid/tests.py b/allauth/socialaccount/providers/openid/tests.py index 39bdcfe0df..d2fcda238e 100644 --- a/allauth/socialaccount/providers/openid/tests.py +++ b/allauth/socialaccount/providers/openid/tests.py @@ -1,5 +1,6 @@ from unittest import expectedFailure +from django.contrib.auth import get_user_model from django.test import override_settings from django.urls import reverse @@ -7,7 +8,6 @@ from allauth.socialaccount.models import SocialAccount from allauth.tests import Mock, TestCase, patch -from allauth.utils import get_user_model from . import views from .utils import AXAttribute diff --git a/allauth/socialaccount/tests/__init__.py b/allauth/socialaccount/tests/__init__.py index 75957d5267..132722b362 100644 --- a/allauth/socialaccount/tests/__init__.py +++ b/allauth/socialaccount/tests/__init__.py @@ -7,6 +7,7 @@ from urllib.parse import parse_qs, urlparse from django.conf import settings +from django.contrib.auth import get_user_model from django.test import RequestFactory from django.test.utils import override_settings from django.urls import reverse @@ -25,7 +26,6 @@ mocked_response, patch, ) -from allauth.utils import get_user_model def setup_app(provider_id): diff --git a/allauth/socialaccount/tests/test_signup.py b/allauth/socialaccount/tests/test_signup.py index 28390a508b..a5ee4c3fdb 100644 --- a/allauth/socialaccount/tests/test_signup.py +++ b/allauth/socialaccount/tests/test_signup.py @@ -1,4 +1,5 @@ import django +from django.contrib.auth import get_user_model from django.contrib.auth.models import AnonymousUser from django.contrib.messages.middleware import MessageMiddleware from django.contrib.sessions.middleware import SessionMiddleware @@ -16,7 +17,6 @@ from allauth.socialaccount.models import SocialAccount, SocialApp, SocialLogin from allauth.socialaccount.views import signup from allauth.tests import TestCase -from allauth.utils import get_user_model class SignupTests(TestCase): diff --git a/allauth/socialaccount/tests/test_utils.py b/allauth/socialaccount/tests/test_utils.py index f92d9a9911..86ad54b095 100644 --- a/allauth/socialaccount/tests/test_utils.py +++ b/allauth/socialaccount/tests/test_utils.py @@ -1,8 +1,8 @@ +from django.contrib.auth import get_user_model from django.test.utils import override_settings from allauth.socialaccount.models import SocialAccount from allauth.tests import TestCase -from allauth.utils import get_user_model class UtilTests(TestCase):