summaryrefslogtreecommitdiff
path: root/tests/auth_tests/test_basic.py
diff options
context:
space:
mode:
authorLoïc Bistuer <loic.bistuer@gmail.com>2016-05-18 17:38:42 +0700
committerTim Graham <timograham@gmail.com>2016-05-18 06:38:42 -0400
commit4ff1e6ef58999f730db26ab97e233589c6be9b4f (patch)
treed422291d3f61679778b2774299f93131b02e4aae /tests/auth_tests/test_basic.py
parent2a4af0ea43512370764303d35bc5309f8abce666 (diff)
Fixed running auth_tests in isolation after 3a47d42fa33012b2156bf04058d933df6b3082d2.
Diffstat (limited to 'tests/auth_tests/test_basic.py')
-rw-r--r--tests/auth_tests/test_basic.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/auth_tests/test_basic.py b/tests/auth_tests/test_basic.py
index caefa9c7a0..7421f66e49 100644
--- a/tests/auth_tests/test_basic.py
+++ b/tests/auth_tests/test_basic.py
@@ -3,16 +3,25 @@ from __future__ import unicode_literals
import warnings
+from django.apps import apps
from django.contrib.auth import get_user_model
from django.contrib.auth.models import AnonymousUser, User
from django.core.exceptions import ImproperlyConfigured
from django.db import IntegrityError
+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):
+ if kwargs['setting'] == 'AUTH_USER_MODEL':
+ apps.clear_cache()
+
+
class BasicTestCase(TestCase):
def test_user(self):
"Check that users can be created and can set their password"