Fixed running auth_tests in isolation after 3a47d42fa3
.
This commit is contained in:
parent
2a4af0ea43
commit
4ff1e6ef58
|
@ -3,16 +3,25 @@ from __future__ import unicode_literals
|
||||||
|
|
||||||
import warnings
|
import warnings
|
||||||
|
|
||||||
|
from django.apps import apps
|
||||||
from django.contrib.auth import get_user_model
|
from django.contrib.auth import get_user_model
|
||||||
from django.contrib.auth.models import AnonymousUser, User
|
from django.contrib.auth.models import AnonymousUser, User
|
||||||
from django.core.exceptions import ImproperlyConfigured
|
from django.core.exceptions import ImproperlyConfigured
|
||||||
from django.db import IntegrityError
|
from django.db import IntegrityError
|
||||||
|
from django.dispatch import receiver
|
||||||
from django.test import TestCase, override_settings
|
from django.test import TestCase, override_settings
|
||||||
|
from django.test.signals import setting_changed
|
||||||
from django.utils import translation
|
from django.utils import translation
|
||||||
|
|
||||||
from .models import CustomUser
|
from .models import CustomUser
|
||||||
|
|
||||||
|
|
||||||
|
@receiver(setting_changed)
|
||||||
|
def user_model_swapped(**kwargs):
|
||||||
|
if kwargs['setting'] == 'AUTH_USER_MODEL':
|
||||||
|
apps.clear_cache()
|
||||||
|
|
||||||
|
|
||||||
class BasicTestCase(TestCase):
|
class BasicTestCase(TestCase):
|
||||||
def test_user(self):
|
def test_user(self):
|
||||||
"Check that users can be created and can set their password"
|
"Check that users can be created and can set their password"
|
||||||
|
|
Loading…
Reference in New Issue