summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--MANIFEST.in2
-rw-r--r--django/contrib/auth/tests/__init__.py1
-rw-r--r--tests/auth_tests/__init__.py1
-rw-r--r--tests/auth_tests/backend_alias.py (renamed from django/contrib/auth/tests/backend_alias.py)2
-rw-r--r--tests/auth_tests/fixtures/authtestdata.json (renamed from django/contrib/auth/fixtures/authtestdata.json)0
-rw-r--r--tests/auth_tests/fixtures/context-processors-users.xml (renamed from django/contrib/auth/fixtures/context-processors-users.xml)0
-rw-r--r--tests/auth_tests/fixtures/custom_user.json (renamed from django/contrib/auth/fixtures/custom_user.json)0
-rw-r--r--tests/auth_tests/fixtures/natural.json (renamed from django/contrib/auth/fixtures/natural.json)0
-rw-r--r--tests/auth_tests/fixtures/regular.json (renamed from django/contrib/auth/fixtures/regular.json)0
-rw-r--r--tests/auth_tests/settings.py (renamed from django/contrib/auth/tests/settings.py)0
-rw-r--r--tests/auth_tests/templates/context_processors/auth_attrs_access.html (renamed from django/contrib/auth/tests/templates/context_processors/auth_attrs_access.html)0
-rw-r--r--tests/auth_tests/templates/context_processors/auth_attrs_messages.html (renamed from django/contrib/auth/tests/templates/context_processors/auth_attrs_messages.html)0
-rw-r--r--tests/auth_tests/templates/context_processors/auth_attrs_no_access.html (renamed from django/contrib/auth/tests/templates/context_processors/auth_attrs_no_access.html)0
-rw-r--r--tests/auth_tests/templates/context_processors/auth_attrs_perm_in_perms.html (renamed from django/contrib/auth/tests/templates/context_processors/auth_attrs_perm_in_perms.html)0
-rw-r--r--tests/auth_tests/templates/context_processors/auth_attrs_perms.html (renamed from django/contrib/auth/tests/templates/context_processors/auth_attrs_perms.html)0
-rw-r--r--tests/auth_tests/templates/context_processors/auth_attrs_test_access.html (renamed from django/contrib/auth/tests/templates/context_processors/auth_attrs_test_access.html)0
-rw-r--r--tests/auth_tests/templates/context_processors/auth_attrs_user.html (renamed from django/contrib/auth/tests/templates/context_processors/auth_attrs_user.html)0
-rw-r--r--tests/auth_tests/templates/registration/html_password_reset_email.html (renamed from django/contrib/auth/tests/templates/registration/html_password_reset_email.html)0
-rw-r--r--tests/auth_tests/templates/registration/logged_out.html (renamed from django/contrib/auth/tests/templates/registration/logged_out.html)0
-rw-r--r--tests/auth_tests/templates/registration/login.html (renamed from django/contrib/auth/tests/templates/registration/login.html)0
-rw-r--r--tests/auth_tests/templates/registration/password_change_form.html (renamed from django/contrib/auth/tests/templates/registration/password_change_form.html)0
-rw-r--r--tests/auth_tests/templates/registration/password_reset_complete.html (renamed from django/contrib/auth/tests/templates/registration/password_reset_complete.html)0
-rw-r--r--tests/auth_tests/templates/registration/password_reset_confirm.html (renamed from django/contrib/auth/tests/templates/registration/password_reset_confirm.html)0
-rw-r--r--tests/auth_tests/templates/registration/password_reset_done.html (renamed from django/contrib/auth/tests/templates/registration/password_reset_done.html)0
-rw-r--r--tests/auth_tests/templates/registration/password_reset_email.html (renamed from django/contrib/auth/tests/templates/registration/password_reset_email.html)0
-rw-r--r--tests/auth_tests/templates/registration/password_reset_form.html (renamed from django/contrib/auth/tests/templates/registration/password_reset_form.html)0
-rw-r--r--tests/auth_tests/templates/registration/password_reset_subject.txt (renamed from django/contrib/auth/tests/templates/registration/password_reset_subject.txt)0
-rw-r--r--tests/auth_tests/test_auth_backends.py (renamed from django/contrib/auth/tests/test_auth_backends.py)25
-rw-r--r--tests/auth_tests/test_basic.py (renamed from django/contrib/auth/tests/test_basic.py)3
-rw-r--r--tests/auth_tests/test_context_processors.py (renamed from django/contrib/auth/tests/test_context_processors.py)4
-rw-r--r--tests/auth_tests/test_decorators.py (renamed from django/contrib/auth/tests/test_decorators.py)7
-rw-r--r--tests/auth_tests/test_forms.py (renamed from django/contrib/auth/tests/test_forms.py)7
-rw-r--r--tests/auth_tests/test_handlers.py (renamed from django/contrib/auth/tests/test_handlers.py)3
-rw-r--r--tests/auth_tests/test_hashers.py (renamed from django/contrib/auth/tests/test_hashers.py)4
-rw-r--r--tests/auth_tests/test_management.py (renamed from django/contrib/auth/tests/test_management.py)20
-rw-r--r--tests/auth_tests/test_middleware.py (renamed from django/contrib/auth/tests/test_middleware.py)0
-rw-r--r--tests/auth_tests/test_models.py (renamed from django/contrib/auth/tests/test_models.py)9
-rw-r--r--tests/auth_tests/test_remote_user.py (renamed from django/contrib/auth/tests/test_remote_user.py)13
-rw-r--r--tests/auth_tests/test_signals.py (renamed from django/contrib/auth/tests/test_signals.py)4
-rw-r--r--tests/auth_tests/test_templates.py (renamed from django/contrib/auth/tests/test_templates.py)4
-rw-r--r--tests/auth_tests/test_tokens.py (renamed from django/contrib/auth/tests/test_tokens.py)2
-rw-r--r--tests/auth_tests/test_views.py (renamed from django/contrib/auth/tests/test_views.py)17
-rw-r--r--tests/auth_tests/urls.py (renamed from django/contrib/auth/tests/urls.py)0
-rw-r--r--tests/auth_tests/urls_admin.py (renamed from django/contrib/auth/tests/urls_admin.py)0
44 files changed, 32 insertions, 96 deletions
diff --git a/MANIFEST.in b/MANIFEST.in
index 94437d69a3..bf94bbd650 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -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 *
diff --git a/django/contrib/auth/tests/__init__.py b/django/contrib/auth/tests/__init__.py
index 2c308642e5..e69de29bb2 100644
--- a/django/contrib/auth/tests/__init__.py
+++ b/django/contrib/auth/tests/__init__.py
@@ -1 +0,0 @@
-# The password for the fixture data users is 'password'
diff --git a/tests/auth_tests/__init__.py b/tests/auth_tests/__init__.py
new file mode 100644
index 0000000000..2c308642e5
--- /dev/null
+++ b/tests/auth_tests/__init__.py
@@ -0,0 +1 @@
+# The password for the fixture data users is 'password'
diff --git a/django/contrib/auth/tests/backend_alias.py b/tests/auth_tests/backend_alias.py
index 7314bac4ee..ae14d1538c 100644
--- a/django/contrib/auth/tests/backend_alias.py
+++ b/tests/auth_tests/backend_alias.py
@@ -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']
diff --git a/django/contrib/auth/fixtures/authtestdata.json b/tests/auth_tests/fixtures/authtestdata.json
index 931328899b..931328899b 100644
--- a/django/contrib/auth/fixtures/authtestdata.json
+++ b/tests/auth_tests/fixtures/authtestdata.json
diff --git a/django/contrib/auth/fixtures/context-processors-users.xml b/tests/auth_tests/fixtures/context-processors-users.xml
index aba8f4aace..aba8f4aace 100644
--- a/django/contrib/auth/fixtures/context-processors-users.xml
+++ b/tests/auth_tests/fixtures/context-processors-users.xml
diff --git a/django/contrib/auth/fixtures/custom_user.json b/tests/auth_tests/fixtures/custom_user.json
index 770bea6541..770bea6541 100644
--- a/django/contrib/auth/fixtures/custom_user.json
+++ b/tests/auth_tests/fixtures/custom_user.json
diff --git a/django/contrib/auth/fixtures/natural.json b/tests/auth_tests/fixtures/natural.json
index 7811c7a548..7811c7a548 100644
--- a/django/contrib/auth/fixtures/natural.json
+++ b/tests/auth_tests/fixtures/natural.json
diff --git a/django/contrib/auth/fixtures/regular.json b/tests/auth_tests/fixtures/regular.json
index b9f2680766..b9f2680766 100644
--- a/django/contrib/auth/fixtures/regular.json
+++ b/tests/auth_tests/fixtures/regular.json
diff --git a/django/contrib/auth/tests/settings.py b/tests/auth_tests/settings.py
index 7da6144d4b..7da6144d4b 100644
--- a/django/contrib/auth/tests/settings.py
+++ b/tests/auth_tests/settings.py
diff --git a/django/contrib/auth/tests/templates/context_processors/auth_attrs_access.html b/tests/auth_tests/templates/context_processors/auth_attrs_access.html
index b5c65db28d..b5c65db28d 100644
--- a/django/contrib/auth/tests/templates/context_processors/auth_attrs_access.html
+++ b/tests/auth_tests/templates/context_processors/auth_attrs_access.html
diff --git a/django/contrib/auth/tests/templates/context_processors/auth_attrs_messages.html b/tests/auth_tests/templates/context_processors/auth_attrs_messages.html
index 7b7e448ad2..7b7e448ad2 100644
--- a/django/contrib/auth/tests/templates/context_processors/auth_attrs_messages.html
+++ b/tests/auth_tests/templates/context_processors/auth_attrs_messages.html
diff --git a/django/contrib/auth/tests/templates/context_processors/auth_attrs_no_access.html b/tests/auth_tests/templates/context_processors/auth_attrs_no_access.html
index 8b13789179..8b13789179 100644
--- a/django/contrib/auth/tests/templates/context_processors/auth_attrs_no_access.html
+++ b/tests/auth_tests/templates/context_processors/auth_attrs_no_access.html
diff --git a/django/contrib/auth/tests/templates/context_processors/auth_attrs_perm_in_perms.html b/tests/auth_tests/templates/context_processors/auth_attrs_perm_in_perms.html
index 3a18cd7405..3a18cd7405 100644
--- a/django/contrib/auth/tests/templates/context_processors/auth_attrs_perm_in_perms.html
+++ b/tests/auth_tests/templates/context_processors/auth_attrs_perm_in_perms.html
diff --git a/django/contrib/auth/tests/templates/context_processors/auth_attrs_perms.html b/tests/auth_tests/templates/context_processors/auth_attrs_perms.html
index 6f441afc10..6f441afc10 100644
--- a/django/contrib/auth/tests/templates/context_processors/auth_attrs_perms.html
+++ b/tests/auth_tests/templates/context_processors/auth_attrs_perms.html
diff --git a/django/contrib/auth/tests/templates/context_processors/auth_attrs_test_access.html b/tests/auth_tests/templates/context_processors/auth_attrs_test_access.html
index a28ff937f8..a28ff937f8 100644
--- a/django/contrib/auth/tests/templates/context_processors/auth_attrs_test_access.html
+++ b/tests/auth_tests/templates/context_processors/auth_attrs_test_access.html
diff --git a/django/contrib/auth/tests/templates/context_processors/auth_attrs_user.html b/tests/auth_tests/templates/context_processors/auth_attrs_user.html
index dc4c6b17c1..dc4c6b17c1 100644
--- a/django/contrib/auth/tests/templates/context_processors/auth_attrs_user.html
+++ b/tests/auth_tests/templates/context_processors/auth_attrs_user.html
diff --git a/django/contrib/auth/tests/templates/registration/html_password_reset_email.html b/tests/auth_tests/templates/registration/html_password_reset_email.html
index 1ebb550048..1ebb550048 100644
--- a/django/contrib/auth/tests/templates/registration/html_password_reset_email.html
+++ b/tests/auth_tests/templates/registration/html_password_reset_email.html
diff --git a/django/contrib/auth/tests/templates/registration/logged_out.html b/tests/auth_tests/templates/registration/logged_out.html
index 0a06d9554a..0a06d9554a 100644
--- a/django/contrib/auth/tests/templates/registration/logged_out.html
+++ b/tests/auth_tests/templates/registration/logged_out.html
diff --git a/django/contrib/auth/tests/templates/registration/login.html b/tests/auth_tests/templates/registration/login.html
index 5dd03cba72..5dd03cba72 100644
--- a/django/contrib/auth/tests/templates/registration/login.html
+++ b/tests/auth_tests/templates/registration/login.html
diff --git a/django/contrib/auth/tests/templates/registration/password_change_form.html b/tests/auth_tests/templates/registration/password_change_form.html
index f9a859ae9f..f9a859ae9f 100644
--- a/django/contrib/auth/tests/templates/registration/password_change_form.html
+++ b/tests/auth_tests/templates/registration/password_change_form.html
diff --git a/django/contrib/auth/tests/templates/registration/password_reset_complete.html b/tests/auth_tests/templates/registration/password_reset_complete.html
index b6569b29d4..b6569b29d4 100644
--- a/django/contrib/auth/tests/templates/registration/password_reset_complete.html
+++ b/tests/auth_tests/templates/registration/password_reset_complete.html
diff --git a/django/contrib/auth/tests/templates/registration/password_reset_confirm.html b/tests/auth_tests/templates/registration/password_reset_confirm.html
index 42677d6766..42677d6766 100644
--- a/django/contrib/auth/tests/templates/registration/password_reset_confirm.html
+++ b/tests/auth_tests/templates/registration/password_reset_confirm.html
diff --git a/django/contrib/auth/tests/templates/registration/password_reset_done.html b/tests/auth_tests/templates/registration/password_reset_done.html
index 3a764cadf1..3a764cadf1 100644
--- a/django/contrib/auth/tests/templates/registration/password_reset_done.html
+++ b/tests/auth_tests/templates/registration/password_reset_done.html
diff --git a/django/contrib/auth/tests/templates/registration/password_reset_email.html b/tests/auth_tests/templates/registration/password_reset_email.html
index baac2fc2dd..baac2fc2dd 100644
--- a/django/contrib/auth/tests/templates/registration/password_reset_email.html
+++ b/tests/auth_tests/templates/registration/password_reset_email.html
diff --git a/django/contrib/auth/tests/templates/registration/password_reset_form.html b/tests/auth_tests/templates/registration/password_reset_form.html
index f9a859ae9f..f9a859ae9f 100644
--- a/django/contrib/auth/tests/templates/registration/password_reset_form.html
+++ b/tests/auth_tests/templates/registration/password_reset_form.html
diff --git a/django/contrib/auth/tests/templates/registration/password_reset_subject.txt b/tests/auth_tests/templates/registration/password_reset_subject.txt
index 904b645c6c..904b645c6c 100644
--- a/django/contrib/auth/tests/templates/registration/password_reset_subject.txt
+++ b/tests/auth_tests/templates/registration/password_reset_subject.txt
diff --git a/django/contrib/auth/tests/test_auth_backends.py b/tests/auth_tests/test_auth_backends.py
index 2abdc4d797..5dde319197 100644
--- a/django/contrib/auth/tests/test_auth_backends.py
+++ b/tests/auth_tests/test_auth_backends.py
@@ -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):
diff --git a/django/contrib/auth/tests/test_basic.py b/tests/auth_tests/test_basic.py
index ca7db755e6..6fe88f769f 100644
--- a/django/contrib/auth/tests/test_basic.py
+++ b/tests/auth_tests/test_basic.py
@@ -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'):
diff --git a/django/contrib/auth/tests/test_context_processors.py b/tests/auth_tests/test_context_processors.py
index 3e1c19e91d..26d73f2841 100644
--- a/django/contrib/auth/tests/test_context_processors.py
+++ b/tests/auth_tests/test_context_processors.py
@@ -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
)
diff --git a/django/contrib/auth/tests/test_decorators.py b/tests/auth_tests/test_decorators.py
index c5602be219..ff1b1f52a2 100644
--- a/django/contrib/auth/tests/test_decorators.py
+++ b/tests/auth_tests/test_decorators.py
@@ -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
diff --git a/django/contrib/auth/tests/test_forms.py b/tests/auth_tests/test_forms.py
index 6437ef6b2e..9d6b48cb69 100644
--- a/django/contrib/auth/tests/test_forms.py
+++ b/tests/auth_tests/test_forms.py
@@ -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,
diff --git a/django/contrib/auth/tests/test_handlers.py b/tests/auth_tests/test_handlers.py
index a6a4f9cd06..e2ceab9c4e 100644
--- a/django/contrib/auth/tests/test_handlers.py
+++ b/tests/auth_tests/test_handlers.py
@@ -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
diff --git a/django/contrib/auth/tests/test_hashers.py b/tests/auth_tests/test_hashers.py
index 52253d6efb..f264926aff 100644
--- a/django/contrib/auth/tests/test_hashers.py
+++ b/tests/auth_tests/test_hashers.py
@@ -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'])
diff --git a/django/contrib/auth/tests/test_management.py b/tests/auth_tests/test_management.py
index cb785ba8fd..159dc8894d 100644
--- a/django/contrib/auth/tests/test_management.py
+++ b/tests/auth_tests/test_management.py
@@ -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(
diff --git a/django/contrib/auth/tests/test_middleware.py b/tests/auth_tests/test_middleware.py
index 44372bce01..44372bce01 100644
--- a/django/contrib/auth/tests/test_middleware.py
+++ b/tests/auth_tests/test_middleware.py
diff --git a/django/contrib/auth/tests/test_models.py b/tests/auth_tests/test_models.py
index ee51b15a98..66e1d17696 100644
--- a/django/contrib/auth/tests/test_models.py
+++ b/tests/auth_tests/test_models.py
@@ -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
diff --git a/django/contrib/auth/tests/test_remote_user.py b/tests/auth_tests/test_remote_user.py
index 6f7de6f2ef..d0f3f2283f 100644
--- a/django/contrib/auth/tests/test_remote_user.py
+++ b/tests/auth_tests/test_remote_user.py
@@ -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'
diff --git a/django/contrib/auth/tests/test_signals.py b/tests/auth_tests/test_signals.py
index 909c28a36d..893dbad605 100644
--- a/django/contrib/auth/tests/test_signals.py
+++ b/tests/auth_tests/test_signals.py
@@ -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']
diff --git a/django/contrib/auth/tests/test_templates.py b/tests/auth_tests/test_templates.py
index ab3aea42db..75c4e8b784 100644
--- a/django/contrib/auth/tests/test_templates.py
+++ b/tests/auth_tests/test_templates.py
@@ -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):
diff --git a/django/contrib/auth/tests/test_tokens.py b/tests/auth_tests/test_tokens.py
index b9433bdcfa..f2b94a35f8 100644
--- a/django/contrib/auth/tests/test_tokens.py
+++ b/tests/auth_tests/test_tokens.py
@@ -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):
diff --git a/django/contrib/auth/tests/test_views.py b/tests/auth_tests/test_views.py
index f125c1799a..628513c60a 100644
--- a/django/contrib/auth/tests/test_views.py
+++ b/tests/auth_tests/test_views.py
@@ -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):
diff --git a/django/contrib/auth/tests/urls.py b/tests/auth_tests/urls.py
index 6f83e0f420..6f83e0f420 100644
--- a/django/contrib/auth/tests/urls.py
+++ b/tests/auth_tests/urls.py
diff --git a/django/contrib/auth/tests/urls_admin.py b/tests/auth_tests/urls_admin.py
index 8d2fe3fd10..8d2fe3fd10 100644
--- a/django/contrib/auth/tests/urls_admin.py
+++ b/tests/auth_tests/urls_admin.py