diff --git a/django/contrib/auth/tests/context_processors.py b/django/contrib/auth/tests/context_processors.py index 0eb5e5eb3c..dcd50fc6cc 100644 --- a/django/contrib/auth/tests/context_processors.py +++ b/django/contrib/auth/tests/context_processors.py @@ -97,7 +97,8 @@ class AuthContextProcessorTests(TestCase): self.assertEqual(user, response.context['user']) AuthContextProcessorTests = override_settings( - TEMPLATE_DIRS = ( + TEMPLATE_DIRS=( os.path.join(os.path.dirname(__file__), 'templates'), - ) + ), + USE_TZ=False, # required for loading the fixture )(AuthContextProcessorTests) diff --git a/django/contrib/auth/tests/forms.py b/django/contrib/auth/tests/forms.py index 2bacc8e611..e4c8bf2586 100644 --- a/django/contrib/auth/tests/forms.py +++ b/django/contrib/auth/tests/forms.py @@ -1,10 +1,12 @@ from __future__ import with_statement import os +from django.contrib.auth.models import User +from django.contrib.auth.forms import (UserCreationForm, AuthenticationForm, + PasswordChangeForm, SetPasswordForm, UserChangeForm, PasswordResetForm) from django.core import mail from django.forms.fields import Field, EmailField -from django.contrib.auth.models import User -from django.contrib.auth.forms import UserCreationForm, AuthenticationForm, PasswordChangeForm, SetPasswordForm, UserChangeForm, PasswordResetForm from django.test import TestCase +from django.test.utils import override_settings from django.utils.encoding import force_unicode from django.utils import translation @@ -74,6 +76,8 @@ class UserCreationFormTest(TestCase): u = form.save() self.assertEqual(repr(u), '') +UserCreationFormTest = override_settings(USE_TZ=False)(UserCreationFormTest) + class AuthenticationFormTest(TestCase): @@ -125,6 +129,8 @@ class AuthenticationFormTest(TestCase): self.assertTrue(form.is_valid()) self.assertEqual(form.non_field_errors(), []) +AuthenticationFormTest = override_settings(USE_TZ=False)(AuthenticationFormTest) + class SetPasswordFormTest(TestCase): @@ -151,6 +157,8 @@ class SetPasswordFormTest(TestCase): form = SetPasswordForm(user, data) self.assertTrue(form.is_valid()) +SetPasswordFormTest = override_settings(USE_TZ=False)(SetPasswordFormTest) + class PasswordChangeFormTest(TestCase): @@ -198,6 +206,8 @@ class PasswordChangeFormTest(TestCase): self.assertEqual(PasswordChangeForm(user, {}).fields.keys(), ['old_password', 'new_password1', 'new_password2']) +PasswordChangeFormTest = override_settings(USE_TZ=False)(PasswordChangeFormTest) + class UserChangeFormTest(TestCase): @@ -226,6 +236,8 @@ class UserChangeFormTest(TestCase): # Just check we can create it form = MyUserForm({}) +UserChangeFormTest = override_settings(USE_TZ=False)(UserChangeFormTest) + class PasswordResetFormTest(TestCase): @@ -304,3 +316,5 @@ class PasswordResetFormTest(TestCase): self.assertFalse(form.is_valid()) self.assertEqual(form["email"].errors, [u"The user account associated with this e-mail address cannot reset the password."]) + +PasswordResetFormTest = override_settings(USE_TZ=False)(PasswordResetFormTest) diff --git a/django/contrib/auth/tests/models.py b/django/contrib/auth/tests/models.py index 25121966a0..243a39533d 100644 --- a/django/contrib/auth/tests/models.py +++ b/django/contrib/auth/tests/models.py @@ -1,6 +1,7 @@ from django.conf import settings from django.test import TestCase -from django.contrib.auth.models import (Group, User, +from django.test.utils import override_settings +svn from django.contrib.auth.models import (Group, User, SiteProfileNotAvailable, UserManager) @@ -37,6 +38,8 @@ class ProfileTestCase(TestCase): settings.AUTH_PROFILE_MODULE = 'foo.bar' self.assertRaises(SiteProfileNotAvailable, user.get_profile) +ProfileTestCase = override_settings(USE_TZ=False)(ProfileTestCase) + class NaturalKeysTestCase(TestCase): fixtures = ['authtestdata.json'] @@ -50,6 +53,8 @@ class NaturalKeysTestCase(TestCase): users_group = Group.objects.create(name='users') self.assertEquals(Group.objects.get_by_natural_key('users'), users_group) +NaturalKeysTestCase = override_settings(USE_TZ=False)(NaturalKeysTestCase) + class LoadDataWithoutNaturalKeysTestCase(TestCase): fixtures = ['regular.json'] @@ -59,6 +64,8 @@ class LoadDataWithoutNaturalKeysTestCase(TestCase): group = Group.objects.get(name='my_group') self.assertEquals(group, user.groups.get()) +LoadDataWithoutNaturalKeysTestCase = override_settings(USE_TZ=False)(LoadDataWithoutNaturalKeysTestCase) + class LoadDataWithNaturalKeysTestCase(TestCase): fixtures = ['natural.json'] @@ -68,6 +75,8 @@ class LoadDataWithNaturalKeysTestCase(TestCase): group = Group.objects.get(name='my_group') self.assertEquals(group, user.groups.get()) +LoadDataWithNaturalKeysTestCase = override_settings(USE_TZ=False)(LoadDataWithNaturalKeysTestCase) + class UserManagerTestCase(TestCase): diff --git a/django/contrib/auth/tests/signals.py b/django/contrib/auth/tests/signals.py index 3806021dcc..fc308c582d 100644 --- a/django/contrib/auth/tests/signals.py +++ b/django/contrib/auth/tests/signals.py @@ -1,4 +1,5 @@ from django.test import TestCase +from django.test.utils import override_settings from django.contrib.auth import signals @@ -45,3 +46,5 @@ class SignalTestCase(TestCase): self.client.get('/logout/next_page/') self.assertEqual(len(self.logged_out), 1) self.assertEqual(self.logged_out[0].username, 'testclient') + +SignalTestCase = override_settings(USE_TZ=False)(SignalTestCase) diff --git a/django/contrib/auth/tests/views.py b/django/contrib/auth/tests/views.py index 1975266f4f..72440864da 100644 --- a/django/contrib/auth/tests/views.py +++ b/django/contrib/auth/tests/views.py @@ -12,6 +12,7 @@ from django.http import QueryDict from django.utils.encoding import force_unicode from django.utils.html import escape from django.test import TestCase +from django.test.utils import override_settings from django.contrib.auth import SESSION_KEY, REDIRECT_FIELD_NAME from django.contrib.auth.forms import (AuthenticationForm, PasswordChangeForm, @@ -52,6 +53,8 @@ class AuthViewsTestCase(TestCase): def assertContainsEscaped(self, response, text, **kwargs): return self.assertContains(response, escape(force_unicode(text)), **kwargs) +AuthViewsTestCase = override_settings(USE_TZ=False)(AuthViewsTestCase) + class AuthViewNamedURLTests(AuthViewsTestCase): urls = 'django.contrib.auth.urls'