Moved contrib.auth tests out of contrib.

This commit is contained in:
Tim Graham 2015-02-10 09:17:08 -05:00
parent 8192a164de
commit 2d7aca3da0
44 changed files with 32 additions and 96 deletions

View File

@ -18,9 +18,7 @@ recursive-include django/contrib/*/locale *
recursive-include django/contrib/admin/templates *
recursive-include django/contrib/admin/static *
recursive-include django/contrib/admindocs/templates *
recursive-include django/contrib/auth/fixtures *
recursive-include django/contrib/auth/templates *
recursive-include django/contrib/auth/tests/templates *
recursive-include django/contrib/gis/gdal/tests/data *
recursive-include django/contrib/gis/static *
recursive-include django/contrib/gis/templates *

View File

@ -1 +0,0 @@
# The password for the fixture data users is 'password'

View File

@ -0,0 +1 @@
# The password for the fixture data users is 'password'

View File

@ -1,4 +1,4 @@
# For testing that auth backends can be referenced using a convenience import
from django.contrib.auth.tests.test_auth_backends import ImportedModelBackend
from .test_auth_backends import ImportedModelBackend
__all__ = ['ImportedModelBackend']

View File

@ -9,7 +9,6 @@ from django.contrib.auth.models import AnonymousUser, Group, Permission, User
from django.contrib.auth.tests.custom_user import (
CustomPermissionsUser, CustomUser, ExtensionUser,
)
from django.contrib.auth.tests.utils import skipIfCustomUser
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ImproperlyConfigured, PermissionDenied
from django.http import HttpRequest
@ -176,7 +175,7 @@ class BaseModelBackendTest(object):
user = self.UserModel._default_manager.get(pk=self.superuser.pk)
self.assertEqual(len(user.get_all_permissions()), len(Permission.objects.all()))
@override_settings(PASSWORD_HASHERS=['django.contrib.auth.tests.test_auth_backends.CountingMD5PasswordHasher'])
@override_settings(PASSWORD_HASHERS=['auth_tests.test_auth_backends.CountingMD5PasswordHasher'])
def test_authentication_timing(self):
"""Hasher is run once regardless of whether the user exists. Refs #20760."""
# Re-set the password, because this tests overrides PASSWORD_HASHERS
@ -193,7 +192,6 @@ class BaseModelBackendTest(object):
self.assertEqual(CountingMD5PasswordHasher.calls, 1)
@skipIfCustomUser
class ModelBackendTest(BaseModelBackendTest, TestCase):
"""
Tests for the ModelBackend using the default User model.
@ -340,9 +338,8 @@ class SimpleRowlevelBackend(object):
return ['none']
@skipIfCustomUser
@modify_settings(AUTHENTICATION_BACKENDS={
'append': 'django.contrib.auth.tests.test_auth_backends.SimpleRowlevelBackend',
'append': 'auth_tests.test_auth_backends.SimpleRowlevelBackend',
})
class RowlevelBackendTest(TestCase):
"""
@ -381,7 +378,7 @@ class RowlevelBackendTest(TestCase):
@override_settings(
AUTHENTICATION_BACKENDS=['django.contrib.auth.tests.test_auth_backends.SimpleRowlevelBackend'],
AUTHENTICATION_BACKENDS=['auth_tests.test_auth_backends.SimpleRowlevelBackend'],
)
class AnonymousUserBackendTest(TestCase):
"""
@ -407,7 +404,6 @@ class AnonymousUserBackendTest(TestCase):
self.assertEqual(self.user1.get_all_permissions(TestObj()), {'anon'})
@skipIfCustomUser
@override_settings(AUTHENTICATION_BACKENDS=[])
class NoBackendsTest(TestCase):
"""
@ -420,8 +416,7 @@ class NoBackendsTest(TestCase):
self.assertRaises(ImproperlyConfigured, self.user.has_perm, ('perm', TestObj(),))
@skipIfCustomUser
@override_settings(AUTHENTICATION_BACKENDS=['django.contrib.auth.tests.test_auth_backends.SimpleRowlevelBackend'])
@override_settings(AUTHENTICATION_BACKENDS=['auth_tests.test_auth_backends.SimpleRowlevelBackend'])
class InActiveUserBackendTest(TestCase):
"""
Tests for an inactive user
@ -459,12 +454,11 @@ class PermissionDeniedBackend(object):
raise PermissionDenied
@skipIfCustomUser
class PermissionDeniedBackendTest(TestCase):
"""
Tests that other backends are not checked once a backend raises PermissionDenied
"""
backend = 'django.contrib.auth.tests.test_auth_backends.PermissionDeniedBackend'
backend = 'auth_tests.test_auth_backends.PermissionDeniedBackend'
def setUp(self):
self.user1 = User.objects.create_user('test', 'test@example.com', 'test')
@ -502,12 +496,11 @@ class NewModelBackend(ModelBackend):
pass
@skipIfCustomUser
class ChangedBackendSettingsTest(TestCase):
"""
Tests for changes in the settings.AUTHENTICATION_BACKENDS
"""
backend = 'django.contrib.auth.tests.test_auth_backends.NewModelBackend'
backend = 'auth_tests.test_auth_backends.NewModelBackend'
TEST_USERNAME = 'test_user'
TEST_PASSWORD = 'test_password'
@ -559,14 +552,13 @@ class TypeErrorBackend(object):
raise TypeError
@skipIfCustomUser
class TypeErrorBackendTest(TestCase):
"""
Tests that a TypeError within a backend is propagated properly.
Regression test for ticket #18171
"""
backend = 'django.contrib.auth.tests.test_auth_backends.TypeErrorBackend'
backend = 'auth_tests.test_auth_backends.TypeErrorBackend'
def setUp(self):
self.user1 = User.objects.create_user('test', 'test@example.com', 'test')
@ -576,7 +568,6 @@ class TypeErrorBackendTest(TestCase):
self.assertRaises(TypeError, authenticate, username='test', password='test')
@skipIfCustomUser
class ImproperlyConfiguredUserModelTest(TestCase):
"""
Tests that an exception from within get_user_model is propagated and doesn't
@ -610,7 +601,7 @@ class ImportedBackendTests(TestCase):
as the one defined in AUTHENTICATION_BACKENDS setting.
"""
backend = 'django.contrib.auth.tests.backend_alias.ImportedModelBackend'
backend = 'auth_tests.backend_alias.ImportedModelBackend'
@override_settings(AUTHENTICATION_BACKENDS=[backend])
def test_backend_path(self):

View File

@ -4,7 +4,6 @@ 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.contrib.auth.tests.utils import skipIfCustomUser
from django.core.exceptions import ImproperlyConfigured
from django.dispatch import receiver
from django.test import TestCase, override_settings
@ -22,7 +21,6 @@ def user_model_swapped(**kwargs):
apps.clear_cache()
@skipIfCustomUser
class BasicTestCase(TestCase):
def test_user(self):
"Check that users can be created and can set their password"
@ -108,7 +106,6 @@ class BasicTestCase(TestCase):
with self.assertRaises(ImproperlyConfigured):
get_user_model()
@skipIfCustomUser
def test_user_verbose_names_translatable(self):
"Default User model verbose names are translatable (#19945)"
with translation.override('en'):

View File

@ -6,7 +6,6 @@ from django.db.models import Q
from django.test import TestCase, override_settings
from .settings import AUTH_MIDDLEWARE_CLASSES, AUTH_TEMPLATES
from .utils import skipIfCustomUser
class MockUser(object):
@ -58,10 +57,9 @@ class PermWrapperTests(TestCase):
self.EQLimiterObject() in pldict
@skipIfCustomUser
@override_settings(
PASSWORD_HASHERS=['django.contrib.auth.hashers.SHA1PasswordHasher'],
ROOT_URLCONF='django.contrib.auth.tests.urls',
ROOT_URLCONF='auth_tests.urls',
TEMPLATES=AUTH_TEMPLATES,
USE_TZ=False, # required for loading the fixture
)

View File

@ -1,16 +1,15 @@
from django.conf import settings
from django.contrib.auth import models
from django.contrib.auth.decorators import login_required, permission_required
from django.contrib.auth.tests.test_views import AuthViewsTestCase
from django.contrib.auth.tests.utils import skipIfCustomUser
from django.core.exceptions import PermissionDenied
from django.http import HttpResponse
from django.test import TestCase, override_settings
from django.test.client import RequestFactory
from .test_views import AuthViewsTestCase
@skipIfCustomUser
@override_settings(ROOT_URLCONF='django.contrib.auth.tests.urls')
@override_settings(ROOT_URLCONF='auth_tests.urls')
class LoginRequiredTestCase(AuthViewsTestCase):
"""
Tests the login_required decorators

View File

@ -19,10 +19,8 @@ from django.utils.text import capfirst
from django.utils.translation import ugettext as _
from .settings import AUTH_TEMPLATES
from .utils import skipIfCustomUser
@skipIfCustomUser
@override_settings(USE_TZ=False, PASSWORD_HASHERS=['django.contrib.auth.hashers.SHA1PasswordHasher'])
class UserCreationFormTest(TestCase):
@ -90,7 +88,6 @@ class UserCreationFormTest(TestCase):
self.assertEqual(repr(u), '<User: jsmith@example.com>')
@skipIfCustomUser
@override_settings(USE_TZ=False, PASSWORD_HASHERS=['django.contrib.auth.hashers.SHA1PasswordHasher'])
class AuthenticationFormTest(TestCase):
@ -203,7 +200,6 @@ class AuthenticationFormTest(TestCase):
self.assertEqual(form.fields['username'].label, "")
@skipIfCustomUser
@override_settings(USE_TZ=False, PASSWORD_HASHERS=['django.contrib.auth.hashers.SHA1PasswordHasher'])
class SetPasswordFormTest(TestCase):
@ -231,7 +227,6 @@ class SetPasswordFormTest(TestCase):
self.assertTrue(form.is_valid())
@skipIfCustomUser
@override_settings(USE_TZ=False, PASSWORD_HASHERS=['django.contrib.auth.hashers.SHA1PasswordHasher'])
class PasswordChangeFormTest(TestCase):
@ -280,7 +275,6 @@ class PasswordChangeFormTest(TestCase):
['old_password', 'new_password1', 'new_password2'])
@skipIfCustomUser
@override_settings(USE_TZ=False, PASSWORD_HASHERS=['django.contrib.auth.hashers.SHA1PasswordHasher'])
class UserChangeFormTest(TestCase):
@ -359,7 +353,6 @@ class UserChangeFormTest(TestCase):
self.assertEqual(form.initial['password'], form['password'].value())
@skipIfCustomUser
@override_settings(
PASSWORD_HASHERS=['django.contrib.auth.hashers.SHA1PasswordHasher'],
TEMPLATES=AUTH_TEMPLATES,

View File

@ -5,7 +5,6 @@ from django.contrib.auth.handlers.modwsgi import (
)
from django.contrib.auth.models import Group, User
from django.contrib.auth.tests.custom_user import CustomUser
from django.contrib.auth.tests.utils import skipIfCustomUser
from django.test import TransactionTestCase, override_settings
@ -21,7 +20,6 @@ class ModWsgiHandlerTestCase(TransactionTestCase):
'django.contrib.contenttypes',
]
@skipIfCustomUser
def test_check_password(self):
"""
Verify that check_password returns the correct values as per
@ -62,7 +60,6 @@ class ModWsgiHandlerTestCase(TransactionTestCase):
# Valid user with incorrect password
self.assertFalse(check_password({}, 'test@example.com', 'incorrect'))
@skipIfCustomUser
def test_groups_for_user(self):
"""
Check that groups_for_user returns correct values as per

View File

@ -295,7 +295,7 @@ class TestUtilsHashPass(SimpleTestCase):
state['upgraded'] = True
with self.settings(PASSWORD_HASHERS=[
'django.contrib.auth.tests.test_hashers.PBKDF2SingleIterationHasher']):
'auth_tests.test_hashers.PBKDF2SingleIterationHasher']):
encoded = make_password('letmein')
algo, iterations, salt, hash = encoded.split('$', 3)
self.assertEqual(iterations, '1')
@ -308,7 +308,7 @@ class TestUtilsHashPass(SimpleTestCase):
# updated to the new iteration count.
with self.settings(PASSWORD_HASHERS=[
'django.contrib.auth.hashers.PBKDF2PasswordHasher',
'django.contrib.auth.tests.test_hashers.PBKDF2SingleIterationHasher']):
'auth_tests.test_hashers.PBKDF2SingleIterationHasher']):
self.assertTrue(check_password('letmein', encoded, setter))
self.assertTrue(state['upgraded'])

View File

@ -13,9 +13,9 @@ from django.contrib.auth.management.commands import (
)
from django.contrib.auth.models import Group, User
from django.contrib.auth.tests.custom_user import (
CustomUser, CustomUserWithFK, Email,
CustomUser, CustomUserBadRequiredFields, CustomUserNonListRequiredFields,
CustomUserNonUniqueUsername, CustomUserWithFK, Email,
)
from django.contrib.auth.tests.utils import skipIfCustomUser
from django.contrib.contenttypes.models import ContentType
from django.core import checks, exceptions
from django.core.management import call_command
@ -23,6 +23,7 @@ from django.core.management.base import CommandError
from django.test import TestCase, override_settings, override_system_checks
from django.utils import six
from django.utils.encoding import force_str
from django.utils.translation import ugettext_lazy as _
def mock_inputs(inputs):
@ -74,7 +75,6 @@ class MockTTY(object):
return True
@skipIfCustomUser
class GetDefaultUsernameTestCase(TestCase):
def setUp(self):
@ -103,7 +103,6 @@ class GetDefaultUsernameTestCase(TestCase):
self.assertEqual(management.get_default_username(), 'julia')
@skipIfCustomUser
class ChangepasswordManagementCommandTestCase(TestCase):
def setUp(self):
@ -155,7 +154,6 @@ class ChangepasswordManagementCommandTestCase(TestCase):
command.execute(username="J\xfalia", stdout=self.stdout)
@skipIfCustomUser
@override_settings(SILENCED_SYSTEM_CHECKS=['fields.W342']) # ForeignKey(unique=True)
class CreatesuperuserManagementCommandTestCase(TestCase):
@ -216,11 +214,9 @@ class CreatesuperuserManagementCommandTestCase(TestCase):
'u\u017eivatel': 'foo', # username (cz)
'email': 'nolocale@somewhere.org'})
def test_non_ascii_verbose_name(self):
# Aliased so the string doesn't get extracted
from django.utils.translation import ugettext_lazy as ulazy
username_field = User._meta.get_field('username')
old_verbose_name = username_field.verbose_name
username_field.verbose_name = ulazy('u\u017eivatel')
username_field.verbose_name = _('u\u017eivatel')
new_io = six.StringIO()
try:
call_command(
@ -422,8 +418,6 @@ class CustomUserModelValidationTestCase(TestCase):
@override_system_checks([check_user_model])
def test_required_fields_is_list(self):
"REQUIRED_FIELDS should be a list."
from .custom_user import CustomUserNonListRequiredFields
errors = checks.run_checks()
expected = [
checks.Error(
@ -439,8 +433,6 @@ class CustomUserModelValidationTestCase(TestCase):
@override_system_checks([check_user_model])
def test_username_not_in_required_fields(self):
"USERNAME_FIELD should not appear in REQUIRED_FIELDS."
from .custom_user import CustomUserBadRequiredFields
errors = checks.run_checks()
expected = [
checks.Error(
@ -457,8 +449,6 @@ class CustomUserModelValidationTestCase(TestCase):
@override_system_checks([check_user_model])
def test_username_non_unique(self):
"A non-unique USERNAME_FIELD should raise a model validation error."
from .custom_user import CustomUserNonUniqueUsername
errors = checks.run_checks()
expected = [
checks.Error(
@ -480,8 +470,6 @@ class CustomUserModelValidationTestCase(TestCase):
""" A non-unique USERNAME_FIELD should raise an error only if we use the
default authentication backend. Otherwise, an warning should be raised.
"""
from .custom_user import CustomUserNonUniqueUsername
errors = checks.run_checks()
expected = [
checks.Warning(

View File

@ -2,14 +2,14 @@ from django.contrib.auth import get_user_model
from django.contrib.auth.models import (
AbstractUser, Group, Permission, User, UserManager,
)
from django.contrib.auth.tests.utils import skipIfCustomUser
# Needed so model is installed when tests are run independently:
from django.contrib.auth.tests.custom_user import IsActiveTestUser1 # NOQA
from django.contrib.contenttypes.models import ContentType
from django.core import mail
from django.db.models.signals import post_save
from django.test import TestCase, override_settings
@skipIfCustomUser
@override_settings(USE_TZ=False)
class NaturalKeysTestCase(TestCase):
fixtures = ['authtestdata.json']
@ -24,7 +24,6 @@ class NaturalKeysTestCase(TestCase):
self.assertEqual(Group.objects.get_by_natural_key('users'), users_group)
@skipIfCustomUser
@override_settings(USE_TZ=False)
class LoadDataWithoutNaturalKeysTestCase(TestCase):
fixtures = ['regular.json']
@ -35,7 +34,6 @@ class LoadDataWithoutNaturalKeysTestCase(TestCase):
self.assertEqual(group, user.groups.get())
@skipIfCustomUser
@override_settings(USE_TZ=False)
class LoadDataWithNaturalKeysTestCase(TestCase):
fixtures = ['natural.json']
@ -100,7 +98,6 @@ class LoadDataWithNaturalKeysAndMultipleDatabasesTestCase(TestCase):
self.assertEqual(perm_other.content_type_id, other_objects[0].id)
@skipIfCustomUser
class UserManagerTestCase(TestCase):
def test_create_user(self):
@ -167,7 +164,6 @@ class IsActiveTestCase(TestCase):
Tests the behavior of the guaranteed is_active attribute
"""
@skipIfCustomUser
def test_builtin_user_isactive(self):
user = User.objects.create(username='foo', email='foo@bar.com')
# is_active is true by default
@ -195,7 +191,6 @@ class IsActiveTestCase(TestCase):
self.assertEqual(user_fetched.is_active, True)
@skipIfCustomUser
class TestCreateSuperUserSignals(TestCase):
"""
Simple test case for ticket #20541

View File

@ -5,13 +5,11 @@ from django.contrib.auth import authenticate
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, modify_settings, override_settings
from django.utils import timezone
@skipIfCustomUser
@override_settings(ROOT_URLCONF='django.contrib.auth.tests.urls')
@override_settings(ROOT_URLCONF='auth_tests.urls')
class RemoteUserTest(TestCase):
middleware = 'django.contrib.auth.middleware.RemoteUserMiddleware'
@ -153,14 +151,13 @@ class RemoteUserNoCreateBackend(RemoteUserBackend):
create_unknown_user = False
@skipIfCustomUser
class RemoteUserNoCreateTest(RemoteUserTest):
"""
Contains the same tests as RemoteUserTest, but using a custom auth backend
class that doesn't create unknown users.
"""
backend = 'django.contrib.auth.tests.test_remote_user.RemoteUserNoCreateBackend'
backend = 'auth_tests.test_remote_user.RemoteUserNoCreateBackend'
def test_unknown_user(self):
num_users = User.objects.count()
@ -189,14 +186,13 @@ class CustomRemoteUserBackend(RemoteUserBackend):
return user
@skipIfCustomUser
class RemoteUserCustomTest(RemoteUserTest):
"""
Tests a custom RemoteUserBackend subclass that overrides the clean_username
and configure_user methods.
"""
backend = 'django.contrib.auth.tests.test_remote_user.CustomRemoteUserBackend'
backend = 'auth_tests.test_remote_user.CustomRemoteUserBackend'
# REMOTE_USER strings with email addresses for the custom backend to
# clean.
known_user = 'knownuser@example.com'
@ -227,13 +223,12 @@ class CustomHeaderMiddleware(RemoteUserMiddleware):
header = 'HTTP_AUTHUSER'
@skipIfCustomUser
class CustomHeaderRemoteUserTest(RemoteUserTest):
"""
Tests a custom RemoteUserMiddleware subclass with custom HTTP auth user
header.
"""
middleware = (
'django.contrib.auth.tests.test_remote_user.CustomHeaderMiddleware'
'auth_tests.test_remote_user.CustomHeaderMiddleware'
)
header = 'HTTP_AUTHUSER'

View File

@ -1,14 +1,12 @@
from django.contrib.auth import signals
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.client import RequestFactory
@skipIfCustomUser
@override_settings(USE_TZ=False,
PASSWORD_HASHERS=['django.contrib.auth.hashers.SHA1PasswordHasher'],
ROOT_URLCONF='django.contrib.auth.tests.urls')
ROOT_URLCONF='auth_tests.urls')
class SignalTestCase(TestCase):
fixtures = ['authtestdata.json']

View File

@ -1,6 +1,5 @@
from django.contrib.auth import authenticate
from django.contrib.auth.models import User
from django.contrib.auth.tests.utils import skipIfCustomUser
from django.contrib.auth.tokens import PasswordResetTokenGenerator
from django.contrib.auth.views import (
password_change, password_change_done, password_reset,
@ -11,10 +10,9 @@ from django.utils.encoding import force_bytes, force_text
from django.utils.http import urlsafe_base64_encode
@skipIfCustomUser
@override_settings(
PASSWORD_HASHERS=['django.contrib.auth.hashers.SHA1PasswordHasher'],
ROOT_URLCONF='django.contrib.auth.tests.urls',
ROOT_URLCONF='auth_tests.urls',
)
class AuthTemplateTests(TestCase):

View File

@ -4,12 +4,10 @@ from datetime import date, timedelta
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.auth.tests.utils import skipIfCustomUser
from django.contrib.auth.tokens import PasswordResetTokenGenerator
from django.test import TestCase
@skipIfCustomUser
class TokenGeneratorTest(TestCase):
def test_make_token(self):

View File

@ -13,6 +13,8 @@ from django.contrib.auth.forms import (
AuthenticationForm, PasswordChangeForm, SetPasswordForm,
)
from django.contrib.auth.models import User
# Needed so model is installed when tests are run independently:
from django.contrib.auth.tests.custom_user import CustomUser # NOQA
from django.contrib.auth.views import login as login_view, redirect_to_login
from django.contrib.sessions.middleware import SessionMiddleware
from django.contrib.sites.requests import RequestSite
@ -30,10 +32,7 @@ from django.utils.http import urlquote
from django.utils.six.moves.urllib.parse import ParseResult, urlparse
from django.utils.translation import LANGUAGE_SESSION_KEY
# Needed so model is installed when tests are run independently:
from .custom_user import CustomUser # NOQA
from .settings import AUTH_TEMPLATES
from .utils import skipIfCustomUser
@override_settings(
@ -44,7 +43,7 @@ from .utils import skipIfCustomUser
TEMPLATES=AUTH_TEMPLATES,
USE_TZ=False,
PASSWORD_HASHERS=['django.contrib.auth.hashers.SHA1PasswordHasher'],
ROOT_URLCONF='django.contrib.auth.tests.urls',
ROOT_URLCONF='auth_tests.urls',
)
class AuthViewsTestCase(TestCase):
"""
@ -88,7 +87,6 @@ class AuthViewsTestCase(TestCase):
self.fail("%r != %r (%s doesn't match)" % (url, expected, attr))
@skipIfCustomUser
@override_settings(ROOT_URLCONF='django.contrib.auth.urls')
class AuthViewNamedURLTests(AuthViewsTestCase):
@ -114,7 +112,6 @@ class AuthViewNamedURLTests(AuthViewsTestCase):
self.fail("Reversal of url named '%s' failed with NoReverseMatch" % name)
@skipIfCustomUser
class PasswordResetTest(AuthViewsTestCase):
def test_email_not_found(self):
@ -357,7 +354,6 @@ class CustomUserPasswordResetTest(AuthViewsTestCase):
self.assertContains(response, "Please enter your new password")
@skipIfCustomUser
class ChangePasswordTest(AuthViewsTestCase):
def fail_login(self, password='password'):
@ -466,7 +462,6 @@ class SessionAuthenticationTests(AuthViewsTestCase):
self.assertRedirects(response, '/password_change/done/')
@skipIfCustomUser
class LoginTest(AuthViewsTestCase):
def test_current_site_in_context_after_login(self):
@ -616,7 +611,6 @@ class LoginTest(AuthViewsTestCase):
self.assertNotEqual(original_session_key, self.client.session.session_key)
@skipIfCustomUser
class LoginURLSettings(AuthViewsTestCase):
"""Tests for settings.LOGIN_URL."""
def assertLoginURLEquals(self, url, parse_qs=False):
@ -659,7 +653,6 @@ class LoginURLSettings(AuthViewsTestCase):
self.assertLoginURLEquals('/login/?next=/login_required/')
@skipIfCustomUser
class LoginRedirectUrlTest(AuthViewsTestCase):
"""Tests for settings.LOGIN_REDIRECT_URL."""
def assertLoginRedirectURLEqual(self, url):
@ -698,7 +691,6 @@ class RedirectToLoginTests(AuthViewsTestCase):
self.assertEqual(expected, login_redirect_response.url)
@skipIfCustomUser
class LogoutTest(AuthViewsTestCase):
def confirm_logged_out(self):
@ -820,13 +812,12 @@ class LogoutTest(AuthViewsTestCase):
# Redirect in test_user_change_password will fail if session auth hash
# isn't updated after password change (#21649)
@skipIfCustomUser
@modify_settings(MIDDLEWARE_CLASSES={
'append': 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
})
@override_settings(
PASSWORD_HASHERS=['django.contrib.auth.hashers.SHA1PasswordHasher'],
ROOT_URLCONF='django.contrib.auth.tests.urls_admin',
ROOT_URLCONF='auth_tests.urls_admin',
)
class ChangelistTests(AuthViewsTestCase):