Loading django/contrib/auth/tests/test_auth_backends.py +5 −4 Original line number Diff line number Diff line from __future__ import unicode_literals from datetime import date from django.conf import settings from django.contrib.auth.backends import ModelBackend from django.contrib.auth.models import User, Group, Permission, AnonymousUser from django.contrib.auth.tests.utils import skipIfCustomUser Loading Loading @@ -34,12 +33,14 @@ class BaseModelBackendTest(object): backend = 'django.contrib.auth.backends.ModelBackend' def setUp(self): self.curr_auth = list(settings.AUTHENTICATION_BACKENDS) settings.AUTHENTICATION_BACKENDS = [self.backend] self.patched_settings = modify_settings( AUTHENTICATION_BACKENDS={'append': self.backend}, ) self.patched_settings.enable() self.create_users() def tearDown(self): settings.AUTHENTICATION_BACKENDS = self.curr_auth self.patched_settings.disable() # The custom_perms test messes with ContentTypes, which will # be cached; flush the cache to ensure there are no side effects # Refs #14975, #14925 Loading django/contrib/auth/tests/test_remote_user.py +7 −8 Original line number Diff line number Diff line Loading @@ -6,7 +6,7 @@ from django.contrib.auth.backends import RemoteUserBackend from django.contrib.auth.middleware import RemoteUserMiddleware from django.contrib.auth.models import User from django.contrib.auth.tests.utils import skipIfCustomUser from django.test import TestCase, override_settings from django.test import TestCase, modify_settings, override_settings from django.utils import timezone Loading @@ -23,15 +23,14 @@ class RemoteUserTest(TestCase): known_user2 = 'knownuser2' def setUp(self): self.curr_middleware = list(settings.MIDDLEWARE_CLASSES) self.curr_auth = list(settings.AUTHENTICATION_BACKENDS) settings.MIDDLEWARE_CLASSES = settings.MIDDLEWARE_CLASSES + [self.middleware] settings.AUTHENTICATION_BACKENDS = settings.AUTHENTICATION_BACKENDS + [self.backend] self.patched_settings = modify_settings( AUTHENTICATION_BACKENDS={'append': self.backend}, MIDDLEWARE_CLASSES={'append': self.middleware}, ) self.patched_settings.enable() def tearDown(self): """Restores settings to avoid breaking other tests.""" settings.MIDDLEWARE_CLASSES = self.curr_middleware settings.AUTHENTICATION_BACKENDS = self.curr_auth self.patched_settings.disable() def test_no_remote_user(self): """ Loading Loading
django/contrib/auth/tests/test_auth_backends.py +5 −4 Original line number Diff line number Diff line from __future__ import unicode_literals from datetime import date from django.conf import settings from django.contrib.auth.backends import ModelBackend from django.contrib.auth.models import User, Group, Permission, AnonymousUser from django.contrib.auth.tests.utils import skipIfCustomUser Loading Loading @@ -34,12 +33,14 @@ class BaseModelBackendTest(object): backend = 'django.contrib.auth.backends.ModelBackend' def setUp(self): self.curr_auth = list(settings.AUTHENTICATION_BACKENDS) settings.AUTHENTICATION_BACKENDS = [self.backend] self.patched_settings = modify_settings( AUTHENTICATION_BACKENDS={'append': self.backend}, ) self.patched_settings.enable() self.create_users() def tearDown(self): settings.AUTHENTICATION_BACKENDS = self.curr_auth self.patched_settings.disable() # The custom_perms test messes with ContentTypes, which will # be cached; flush the cache to ensure there are no side effects # Refs #14975, #14925 Loading
django/contrib/auth/tests/test_remote_user.py +7 −8 Original line number Diff line number Diff line Loading @@ -6,7 +6,7 @@ from django.contrib.auth.backends import RemoteUserBackend from django.contrib.auth.middleware import RemoteUserMiddleware from django.contrib.auth.models import User from django.contrib.auth.tests.utils import skipIfCustomUser from django.test import TestCase, override_settings from django.test import TestCase, modify_settings, override_settings from django.utils import timezone Loading @@ -23,15 +23,14 @@ class RemoteUserTest(TestCase): known_user2 = 'knownuser2' def setUp(self): self.curr_middleware = list(settings.MIDDLEWARE_CLASSES) self.curr_auth = list(settings.AUTHENTICATION_BACKENDS) settings.MIDDLEWARE_CLASSES = settings.MIDDLEWARE_CLASSES + [self.middleware] settings.AUTHENTICATION_BACKENDS = settings.AUTHENTICATION_BACKENDS + [self.backend] self.patched_settings = modify_settings( AUTHENTICATION_BACKENDS={'append': self.backend}, MIDDLEWARE_CLASSES={'append': self.middleware}, ) self.patched_settings.enable() def tearDown(self): """Restores settings to avoid breaking other tests.""" settings.MIDDLEWARE_CLASSES = self.curr_middleware settings.AUTHENTICATION_BACKENDS = self.curr_auth self.patched_settings.disable() def test_no_remote_user(self): """ Loading