mirror of
https://github.com/django/django.git
synced 2025-08-04 10:59:45 +00:00
Fixed #26089 -- Removed custom user test models from public API.
Thanks to Tim Graham for the review.
This commit is contained in:
parent
19318507d9
commit
6eb3ce11e4
12 changed files with 47 additions and 38 deletions
|
@ -3,13 +3,14 @@ from __future__ import unicode_literals
|
|||
from django.apps import apps
|
||||
from django.contrib.auth import get_user_model
|
||||
from django.contrib.auth.models import AnonymousUser, User
|
||||
from django.contrib.auth.tests.custom_user import CustomUser
|
||||
from django.core.exceptions import ImproperlyConfigured
|
||||
from django.dispatch import receiver
|
||||
from django.test import TestCase, override_settings
|
||||
from django.test.signals import setting_changed
|
||||
from django.utils import translation
|
||||
|
||||
from .models import CustomUser
|
||||
|
||||
|
||||
@receiver(setting_changed)
|
||||
def user_model_swapped(**kwargs):
|
||||
|
@ -87,7 +88,7 @@ class BasicTestCase(TestCase):
|
|||
"The current user model can be retrieved"
|
||||
self.assertEqual(get_user_model(), User)
|
||||
|
||||
@override_settings(AUTH_USER_MODEL='auth.CustomUser')
|
||||
@override_settings(AUTH_USER_MODEL='auth_tests.CustomUser')
|
||||
def test_swappable_user(self):
|
||||
"The current user model can be swapped out for another"
|
||||
self.assertEqual(get_user_model(), CustomUser)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue