mirror of
				https://github.com/django/django.git
				synced 2025-10-31 12:05:47 +00:00 
			
		
		
		
	Added conditional skips for all tests dependent on the default User model
This commit is contained in:
		
							parent
							
								
									40ea8b8882
								
							
						
					
					
						commit
						20d1892491
					
				
					 13 changed files with 56 additions and 14 deletions
				
			
		|  | @ -4,10 +4,11 @@ from django.conf import settings | ||||||
| from django.contrib.auth.models import User, Group, Permission, AnonymousUser | from django.contrib.auth.models import User, Group, Permission, AnonymousUser | ||||||
| from django.contrib.contenttypes.models import ContentType | from django.contrib.contenttypes.models import ContentType | ||||||
| from django.core.exceptions import ImproperlyConfigured | from django.core.exceptions import ImproperlyConfigured | ||||||
| from django.test import TestCase | from django.test import TestCase, skipIfCustomUser | ||||||
| from django.test.utils import override_settings | from django.test.utils import override_settings | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | @skipIfCustomUser | ||||||
| class BackendTest(TestCase): | class BackendTest(TestCase): | ||||||
| 
 | 
 | ||||||
|     backend = 'django.contrib.auth.backends.ModelBackend' |     backend = 'django.contrib.auth.backends.ModelBackend' | ||||||
|  | @ -151,6 +152,7 @@ class SimpleRowlevelBackend(object): | ||||||
|             return ['none'] |             return ['none'] | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | @skipIfCustomUser | ||||||
| class RowlevelBackendTest(TestCase): | class RowlevelBackendTest(TestCase): | ||||||
|     """ |     """ | ||||||
|     Tests for auth backend that supports object level permissions |     Tests for auth backend that supports object level permissions | ||||||
|  | @ -223,6 +225,7 @@ class AnonymousUserBackendTest(TestCase): | ||||||
|         self.assertEqual(self.user1.get_all_permissions(TestObj()), set(['anon'])) |         self.assertEqual(self.user1.get_all_permissions(TestObj()), set(['anon'])) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | @skipIfCustomUser | ||||||
| @override_settings(AUTHENTICATION_BACKENDS=[]) | @override_settings(AUTHENTICATION_BACKENDS=[]) | ||||||
| class NoBackendsTest(TestCase): | class NoBackendsTest(TestCase): | ||||||
|     """ |     """ | ||||||
|  | @ -235,6 +238,7 @@ class NoBackendsTest(TestCase): | ||||||
|         self.assertRaises(ImproperlyConfigured, self.user.has_perm, ('perm', TestObj(),)) |         self.assertRaises(ImproperlyConfigured, self.user.has_perm, ('perm', TestObj(),)) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | @skipIfCustomUser | ||||||
| class InActiveUserBackendTest(TestCase): | class InActiveUserBackendTest(TestCase): | ||||||
|     """ |     """ | ||||||
|     Tests for a inactive user |     Tests for a inactive user | ||||||
|  |  | ||||||
|  | @ -3,10 +3,11 @@ import locale | ||||||
| from django.contrib.auth.management.commands import createsuperuser | from django.contrib.auth.management.commands import createsuperuser | ||||||
| from django.contrib.auth.models import User, AnonymousUser | from django.contrib.auth.models import User, AnonymousUser | ||||||
| from django.core.management import call_command | from django.core.management import call_command | ||||||
| from django.test import TestCase | from django.test import TestCase, skipIfCustomUser | ||||||
| from django.utils.six import StringIO | from django.utils.six import StringIO | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | @skipIfCustomUser | ||||||
| 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" | ||||||
|  |  | ||||||
|  | @ -3,11 +3,11 @@ import os | ||||||
| from django.conf import global_settings | from django.conf import global_settings | ||||||
| from django.contrib.auth import authenticate | from django.contrib.auth import authenticate | ||||||
| from django.db.models import Q | from django.db.models import Q | ||||||
| from django.template import context | from django.test import TestCase, skipIfCustomUser | ||||||
| from django.test import TestCase |  | ||||||
| from django.test.utils import override_settings | from django.test.utils import override_settings | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | @skipIfCustomUser | ||||||
| @override_settings( | @override_settings( | ||||||
|     TEMPLATE_DIRS=( |     TEMPLATE_DIRS=( | ||||||
|             os.path.join(os.path.dirname(__file__), 'templates'), |             os.path.join(os.path.dirname(__file__), 'templates'), | ||||||
|  |  | ||||||
|  | @ -1,7 +1,10 @@ | ||||||
| from django.conf import settings | from django.conf import settings | ||||||
| from django.contrib.auth.decorators import login_required | from django.contrib.auth.decorators import login_required | ||||||
| from django.contrib.auth.tests.views import AuthViewsTestCase | from django.contrib.auth.tests.views import AuthViewsTestCase | ||||||
|  | from django.test import skipIfCustomUser | ||||||
| 
 | 
 | ||||||
|  | 
 | ||||||
|  | @skipIfCustomUser | ||||||
| class LoginRequiredTestCase(AuthViewsTestCase): | class LoginRequiredTestCase(AuthViewsTestCase): | ||||||
|     """ |     """ | ||||||
|     Tests the login_required decorators |     Tests the login_required decorators | ||||||
|  |  | ||||||
|  | @ -6,14 +6,14 @@ from django.contrib.auth.forms import (UserCreationForm, AuthenticationForm, | ||||||
|     PasswordChangeForm, SetPasswordForm, UserChangeForm, PasswordResetForm) |     PasswordChangeForm, SetPasswordForm, UserChangeForm, PasswordResetForm) | ||||||
| from django.core import mail | from django.core import mail | ||||||
| from django.forms.fields import Field, EmailField | from django.forms.fields import Field, EmailField | ||||||
| from django.test import TestCase | from django.test import TestCase, skipIfCustomUser | ||||||
| from django.test.utils import override_settings | from django.test.utils import override_settings | ||||||
| from django.utils.encoding import force_text | from django.utils.encoding import force_text | ||||||
| from django.utils import six |  | ||||||
| from django.utils import translation | from django.utils import translation | ||||||
| from django.utils.translation import ugettext as _ | from django.utils.translation import ugettext as _ | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | @skipIfCustomUser | ||||||
| @override_settings(USE_TZ=False, PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',)) | @override_settings(USE_TZ=False, PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',)) | ||||||
| class UserCreationFormTest(TestCase): | class UserCreationFormTest(TestCase): | ||||||
| 
 | 
 | ||||||
|  | @ -81,6 +81,7 @@ class UserCreationFormTest(TestCase): | ||||||
|         self.assertEqual(repr(u), '<User: jsmith@example.com>') |         self.assertEqual(repr(u), '<User: jsmith@example.com>') | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | @skipIfCustomUser | ||||||
| @override_settings(USE_TZ=False, PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',)) | @override_settings(USE_TZ=False, PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',)) | ||||||
| class AuthenticationFormTest(TestCase): | class AuthenticationFormTest(TestCase): | ||||||
| 
 | 
 | ||||||
|  | @ -133,6 +134,7 @@ class AuthenticationFormTest(TestCase): | ||||||
|         self.assertEqual(form.non_field_errors(), []) |         self.assertEqual(form.non_field_errors(), []) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | @skipIfCustomUser | ||||||
| @override_settings(USE_TZ=False, PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',)) | @override_settings(USE_TZ=False, PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',)) | ||||||
| class SetPasswordFormTest(TestCase): | class SetPasswordFormTest(TestCase): | ||||||
| 
 | 
 | ||||||
|  | @ -160,6 +162,7 @@ class SetPasswordFormTest(TestCase): | ||||||
|         self.assertTrue(form.is_valid()) |         self.assertTrue(form.is_valid()) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | @skipIfCustomUser | ||||||
| @override_settings(USE_TZ=False, PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',)) | @override_settings(USE_TZ=False, PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',)) | ||||||
| class PasswordChangeFormTest(TestCase): | class PasswordChangeFormTest(TestCase): | ||||||
| 
 | 
 | ||||||
|  | @ -208,6 +211,7 @@ class PasswordChangeFormTest(TestCase): | ||||||
|                          ['old_password', 'new_password1', 'new_password2']) |                          ['old_password', 'new_password1', 'new_password2']) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | @skipIfCustomUser | ||||||
| @override_settings(USE_TZ=False, PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',)) | @override_settings(USE_TZ=False, PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',)) | ||||||
| class UserChangeFormTest(TestCase): | class UserChangeFormTest(TestCase): | ||||||
| 
 | 
 | ||||||
|  | @ -255,6 +259,7 @@ class UserChangeFormTest(TestCase): | ||||||
|         form.as_table() |         form.as_table() | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | @skipIfCustomUser | ||||||
| @override_settings(USE_TZ=False, PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',)) | @override_settings(USE_TZ=False, PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',)) | ||||||
| class PasswordResetFormTest(TestCase): | class PasswordResetFormTest(TestCase): | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -7,12 +7,13 @@ from django.contrib.auth.models import User | ||||||
| from django.contrib.auth.tests import CustomUser | from django.contrib.auth.tests import CustomUser | ||||||
| from django.core.management import call_command | from django.core.management import call_command | ||||||
| from django.core.management.base import CommandError | from django.core.management.base import CommandError | ||||||
| from django.test import TestCase | from django.test import TestCase, skipIfCustomUser | ||||||
| from django.test.utils import override_settings | from django.test.utils import override_settings | ||||||
| from django.utils import six | from django.utils import six | ||||||
| from django.utils.six import StringIO | from django.utils.six import StringIO | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | @skipIfCustomUser | ||||||
| class GetDefaultUsernameTestCase(TestCase): | class GetDefaultUsernameTestCase(TestCase): | ||||||
| 
 | 
 | ||||||
|     def setUp(self): |     def setUp(self): | ||||||
|  | @ -41,6 +42,7 @@ class GetDefaultUsernameTestCase(TestCase): | ||||||
|         self.assertEqual(management.get_default_username(), 'julia') |         self.assertEqual(management.get_default_username(), 'julia') | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | @skipIfCustomUser | ||||||
| class ChangepasswordManagementCommandTestCase(TestCase): | class ChangepasswordManagementCommandTestCase(TestCase): | ||||||
| 
 | 
 | ||||||
|     def setUp(self): |     def setUp(self): | ||||||
|  | @ -76,6 +78,7 @@ class ChangepasswordManagementCommandTestCase(TestCase): | ||||||
|             command.execute("joe", stdout=self.stdout, stderr=self.stderr) |             command.execute("joe", stdout=self.stdout, stderr=self.stderr) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | @skipIfCustomUser | ||||||
| class CreatesuperuserManagementCommandTestCase(TestCase): | class CreatesuperuserManagementCommandTestCase(TestCase): | ||||||
| 
 | 
 | ||||||
|     def test_createsuperuser(self): |     def test_createsuperuser(self): | ||||||
|  |  | ||||||
|  | @ -1,10 +1,11 @@ | ||||||
| from django.conf import settings | from django.conf import settings | ||||||
| from django.test import TestCase | from django.test import TestCase, skipIfCustomUser | ||||||
| from django.test.utils import override_settings | from django.test.utils import override_settings | ||||||
| from django.contrib.auth.models import (Group, User, | from django.contrib.auth.models import (Group, User, | ||||||
|     SiteProfileNotAvailable, UserManager) |     SiteProfileNotAvailable, UserManager) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | @skipIfCustomUser | ||||||
| @override_settings(USE_TZ=False, AUTH_PROFILE_MODULE='') | @override_settings(USE_TZ=False, AUTH_PROFILE_MODULE='') | ||||||
| class ProfileTestCase(TestCase): | class ProfileTestCase(TestCase): | ||||||
| 
 | 
 | ||||||
|  | @ -30,6 +31,7 @@ class ProfileTestCase(TestCase): | ||||||
|             user.get_profile() |             user.get_profile() | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | @skipIfCustomUser | ||||||
| @override_settings(USE_TZ=False) | @override_settings(USE_TZ=False) | ||||||
| class NaturalKeysTestCase(TestCase): | class NaturalKeysTestCase(TestCase): | ||||||
|     fixtures = ['authtestdata.json'] |     fixtures = ['authtestdata.json'] | ||||||
|  | @ -44,6 +46,7 @@ class NaturalKeysTestCase(TestCase): | ||||||
|         self.assertEqual(Group.objects.get_by_natural_key('users'), users_group) |         self.assertEqual(Group.objects.get_by_natural_key('users'), users_group) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | @skipIfCustomUser | ||||||
| @override_settings(USE_TZ=False) | @override_settings(USE_TZ=False) | ||||||
| class LoadDataWithoutNaturalKeysTestCase(TestCase): | class LoadDataWithoutNaturalKeysTestCase(TestCase): | ||||||
|     fixtures = ['regular.json'] |     fixtures = ['regular.json'] | ||||||
|  | @ -54,6 +57,7 @@ class LoadDataWithoutNaturalKeysTestCase(TestCase): | ||||||
|         self.assertEqual(group, user.groups.get()) |         self.assertEqual(group, user.groups.get()) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | @skipIfCustomUser | ||||||
| @override_settings(USE_TZ=False) | @override_settings(USE_TZ=False) | ||||||
| class LoadDataWithNaturalKeysTestCase(TestCase): | class LoadDataWithNaturalKeysTestCase(TestCase): | ||||||
|     fixtures = ['natural.json'] |     fixtures = ['natural.json'] | ||||||
|  | @ -64,6 +68,7 @@ class LoadDataWithNaturalKeysTestCase(TestCase): | ||||||
|         self.assertEqual(group, user.groups.get()) |         self.assertEqual(group, user.groups.get()) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | @skipIfCustomUser | ||||||
| class UserManagerTestCase(TestCase): | class UserManagerTestCase(TestCase): | ||||||
| 
 | 
 | ||||||
|     def test_create_user(self): |     def test_create_user(self): | ||||||
|  |  | ||||||
|  | @ -3,10 +3,11 @@ from datetime import datetime | ||||||
| from django.conf import settings | from django.conf import settings | ||||||
| from django.contrib.auth.backends import RemoteUserBackend | from django.contrib.auth.backends import RemoteUserBackend | ||||||
| from django.contrib.auth.models import User | from django.contrib.auth.models import User | ||||||
| from django.test import TestCase | from django.test import TestCase, skipIfCustomUser | ||||||
| from django.utils import timezone | from django.utils import timezone | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | @skipIfCustomUser | ||||||
| class RemoteUserTest(TestCase): | class RemoteUserTest(TestCase): | ||||||
| 
 | 
 | ||||||
|     urls = 'django.contrib.auth.tests.urls' |     urls = 'django.contrib.auth.tests.urls' | ||||||
|  | @ -106,6 +107,7 @@ class RemoteUserNoCreateBackend(RemoteUserBackend): | ||||||
|     create_unknown_user = False |     create_unknown_user = False | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | @skipIfCustomUser | ||||||
| class RemoteUserNoCreateTest(RemoteUserTest): | class RemoteUserNoCreateTest(RemoteUserTest): | ||||||
|     """ |     """ | ||||||
|     Contains the same tests as RemoteUserTest, but using a custom auth backend |     Contains the same tests as RemoteUserTest, but using a custom auth backend | ||||||
|  | @ -142,6 +144,7 @@ class CustomRemoteUserBackend(RemoteUserBackend): | ||||||
|         return user |         return user | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | @skipIfCustomUser | ||||||
| class RemoteUserCustomTest(RemoteUserTest): | class RemoteUserCustomTest(RemoteUserTest): | ||||||
|     """ |     """ | ||||||
|     Tests a custom RemoteUserBackend subclass that overrides the clean_username |     Tests a custom RemoteUserBackend subclass that overrides the clean_username | ||||||
|  |  | ||||||
|  | @ -1,8 +1,9 @@ | ||||||
| from django.test import TestCase | from django.test import TestCase, skipIfCustomUser | ||||||
| from django.test.utils import override_settings | from django.test.utils import override_settings | ||||||
| from django.contrib.auth import signals | from django.contrib.auth import signals | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | @skipIfCustomUser | ||||||
| @override_settings(USE_TZ=False, PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',)) | @override_settings(USE_TZ=False, PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',)) | ||||||
| class SignalTestCase(TestCase): | class SignalTestCase(TestCase): | ||||||
|     urls = 'django.contrib.auth.tests.urls' |     urls = 'django.contrib.auth.tests.urls' | ||||||
|  |  | ||||||
|  | @ -4,10 +4,11 @@ from datetime import date, timedelta | ||||||
| from django.conf import settings | from django.conf import settings | ||||||
| from django.contrib.auth.models import User | from django.contrib.auth.models import User | ||||||
| from django.contrib.auth.tokens import PasswordResetTokenGenerator | from django.contrib.auth.tokens import PasswordResetTokenGenerator | ||||||
| from django.test import TestCase | from django.test import TestCase, skipIfCustomUser | ||||||
| from django.utils import unittest | from django.utils import unittest | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | @skipIfCustomUser | ||||||
| class TokenGeneratorTest(TestCase): | class TokenGeneratorTest(TestCase): | ||||||
| 
 | 
 | ||||||
|     def test_make_token(self): |     def test_make_token(self): | ||||||
|  |  | ||||||
|  | @ -10,7 +10,7 @@ from django.http import QueryDict | ||||||
| from django.utils.encoding import force_text | from django.utils.encoding import force_text | ||||||
| from django.utils.html import escape | from django.utils.html import escape | ||||||
| from django.utils.http import urlquote | from django.utils.http import urlquote | ||||||
| from django.test import TestCase | from django.test import TestCase, skipIfCustomUser | ||||||
| from django.test.utils import override_settings | from django.test.utils import override_settings | ||||||
| 
 | 
 | ||||||
| from django.contrib.auth import SESSION_KEY, REDIRECT_FIELD_NAME | from django.contrib.auth import SESSION_KEY, REDIRECT_FIELD_NAME | ||||||
|  | @ -49,6 +49,7 @@ class AuthViewsTestCase(TestCase): | ||||||
|         return self.assertContains(response, escape(force_text(text)), **kwargs) |         return self.assertContains(response, escape(force_text(text)), **kwargs) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | @skipIfCustomUser | ||||||
| class AuthViewNamedURLTests(AuthViewsTestCase): | class AuthViewNamedURLTests(AuthViewsTestCase): | ||||||
|     urls = 'django.contrib.auth.urls' |     urls = 'django.contrib.auth.urls' | ||||||
| 
 | 
 | ||||||
|  | @ -74,6 +75,7 @@ class AuthViewNamedURLTests(AuthViewsTestCase): | ||||||
|                 self.fail("Reversal of url named '%s' failed with NoReverseMatch" % name) |                 self.fail("Reversal of url named '%s' failed with NoReverseMatch" % name) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | @skipIfCustomUser | ||||||
| class PasswordResetTest(AuthViewsTestCase): | class PasswordResetTest(AuthViewsTestCase): | ||||||
| 
 | 
 | ||||||
|     def test_email_not_found(self): |     def test_email_not_found(self): | ||||||
|  | @ -171,6 +173,7 @@ class PasswordResetTest(AuthViewsTestCase): | ||||||
|         self.assertContainsEscaped(response, SetPasswordForm.error_messages['password_mismatch']) |         self.assertContainsEscaped(response, SetPasswordForm.error_messages['password_mismatch']) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | @skipIfCustomUser | ||||||
| class ChangePasswordTest(AuthViewsTestCase): | class ChangePasswordTest(AuthViewsTestCase): | ||||||
| 
 | 
 | ||||||
|     def fail_login(self, password='password'): |     def fail_login(self, password='password'): | ||||||
|  | @ -230,6 +233,7 @@ class ChangePasswordTest(AuthViewsTestCase): | ||||||
|             self.assertTrue(response['Location'].endswith('/login/?next=/password_change/done/')) |             self.assertTrue(response['Location'].endswith('/login/?next=/password_change/done/')) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | @skipIfCustomUser | ||||||
| class LoginTest(AuthViewsTestCase): | class LoginTest(AuthViewsTestCase): | ||||||
| 
 | 
 | ||||||
|     def test_current_site_in_context_after_login(self): |     def test_current_site_in_context_after_login(self): | ||||||
|  | @ -288,6 +292,7 @@ class LoginTest(AuthViewsTestCase): | ||||||
|                             "%s should be allowed" % good_url) |                             "%s should be allowed" % good_url) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | @skipIfCustomUser | ||||||
| class LoginURLSettings(AuthViewsTestCase): | class LoginURLSettings(AuthViewsTestCase): | ||||||
| 
 | 
 | ||||||
|     def setUp(self): |     def setUp(self): | ||||||
|  | @ -346,6 +351,7 @@ class LoginURLSettings(AuthViewsTestCase): | ||||||
|                                                     querystring.urlencode('/'))) |                                                     querystring.urlencode('/'))) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | @skipIfCustomUser | ||||||
| class LogoutTest(AuthViewsTestCase): | class LogoutTest(AuthViewsTestCase): | ||||||
| 
 | 
 | ||||||
|     def confirm_logged_out(self): |     def confirm_logged_out(self): | ||||||
|  |  | ||||||
|  | @ -5,5 +5,6 @@ Django Unit Test and Doctest framework. | ||||||
| from django.test.client import Client, RequestFactory | from django.test.client import Client, RequestFactory | ||||||
| from django.test.testcases import (TestCase, TransactionTestCase, | from django.test.testcases import (TestCase, TransactionTestCase, | ||||||
|     SimpleTestCase, LiveServerTestCase, skipIfDBFeature, |     SimpleTestCase, LiveServerTestCase, skipIfDBFeature, | ||||||
|     skipUnlessDBFeature) |     skipUnlessDBFeature, skipIfCustomUser | ||||||
|  | ) | ||||||
| from django.test.utils import Approximate | from django.test.utils import Approximate | ||||||
|  |  | ||||||
|  | @ -44,10 +44,12 @@ from django.utils import unittest as ut2 | ||||||
| from django.utils.encoding import force_text | from django.utils.encoding import force_text | ||||||
| from django.utils import six | from django.utils import six | ||||||
| from django.utils.unittest.util import safe_repr | from django.utils.unittest.util import safe_repr | ||||||
|  | from django.utils.unittest import skipIf | ||||||
| from django.views.static import serve | from django.views.static import serve | ||||||
| 
 | 
 | ||||||
| __all__ = ('DocTestRunner', 'OutputChecker', 'TestCase', 'TransactionTestCase', | __all__ = ('DocTestRunner', 'OutputChecker', 'TestCase', 'TransactionTestCase', | ||||||
|            'SimpleTestCase', 'skipIfDBFeature', 'skipUnlessDBFeature') |            'SimpleTestCase', 'skipIfDBFeature', 'skipUnlessDBFeature', | ||||||
|  |            'skipIfCustomUser') | ||||||
| 
 | 
 | ||||||
| normalize_long_ints = lambda s: re.sub(r'(?<![\w])(\d+)L(?![\w])', '\\1', s) | normalize_long_ints = lambda s: re.sub(r'(?<![\w])(\d+)L(?![\w])', '\\1', s) | ||||||
| normalize_decimals = lambda s: re.sub(r"Decimal\('(\d+(\.\d*)?)'\)", | normalize_decimals = lambda s: re.sub(r"Decimal\('(\d+(\.\d*)?)'\)", | ||||||
|  | @ -906,6 +908,13 @@ def skipUnlessDBFeature(feature): | ||||||
|                          "Database doesn't support feature %s" % feature) |                          "Database doesn't support feature %s" % feature) | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
|  | def skipIfCustomUser(test_func): | ||||||
|  |     """ | ||||||
|  |     Skip a test if a custom user model is in use. | ||||||
|  |     """ | ||||||
|  |     return skipIf(settings.AUTH_USER_MODEL != 'auth.User', 'Custom user model in use')(test_func) | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| class QuietWSGIRequestHandler(WSGIRequestHandler): | class QuietWSGIRequestHandler(WSGIRequestHandler): | ||||||
|     """ |     """ | ||||||
|     Just a regular WSGIRequestHandler except it doesn't log to the standard |     Just a regular WSGIRequestHandler except it doesn't log to the standard | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Russell Keith-Magee
						Russell Keith-Magee