Ticket #17940: 17940.patch
File 17940.patch, 6.2 KB (added by , 13 years ago) |
---|
-
django/contrib/auth/tests/views.py
12 12 from django.utils.encoding import force_unicode 13 13 from django.utils.html import escape 14 14 from django.test import TestCase 15 from django.test.utils import override_settings 15 16 16 17 from django.contrib.auth import SESSION_KEY, REDIRECT_FIELD_NAME 17 18 from django.contrib.auth.forms import (AuthenticationForm, PasswordChangeForm, … … 52 53 def assertContainsEscaped(self, response, text, **kwargs): 53 54 return self.assertContains(response, escape(force_unicode(text)), **kwargs) 54 55 56 AuthViewsTestCase = override_settings(USE_TZ=False)(AuthViewsTestCase) 55 57 58 56 59 class AuthViewNamedURLTests(AuthViewsTestCase): 57 60 urls = 'django.contrib.auth.urls' 58 61 -
django/contrib/auth/tests/signals.py
1 1 from django.test import TestCase 2 from django.test.utils import override_settings 2 3 from django.contrib.auth import signals 3 4 4 5 … … 45 46 self.client.get('/logout/next_page/') 46 47 self.assertEqual(len(self.logged_out), 1) 47 48 self.assertEqual(self.logged_out[0].username, 'testclient') 49 50 SignalTestCase = override_settings(USE_TZ=False)(SignalTestCase) -
django/contrib/auth/tests/context_processors.py
7 7 from django.test import TestCase 8 8 from django.test.utils import override_settings 9 9 10 11 10 class AuthContextProcessorTests(TestCase): 12 11 """ 13 12 Tests for the ``django.contrib.auth.context_processors.auth`` processor … … 97 96 self.assertEqual(user, response.context['user']) 98 97 99 98 AuthContextProcessorTests = override_settings( 100 TEMPLATE_DIRS =(99 TEMPLATE_DIRS=( 101 100 os.path.join(os.path.dirname(__file__), 'templates'), 102 ) 101 ), 102 USE_TZ=False, # required for loading the fixture 103 103 )(AuthContextProcessorTests) -
django/contrib/auth/tests/models.py
1 1 from django.conf import settings 2 2 from django.test import TestCase 3 from django.test.utils import override_settings 3 4 from django.contrib.auth.models import (Group, User, 4 5 SiteProfileNotAvailable, UserManager) 5 6 … … 37 38 settings.AUTH_PROFILE_MODULE = 'foo.bar' 38 39 self.assertRaises(SiteProfileNotAvailable, user.get_profile) 39 40 41 ProfileTestCase = override_settings(USE_TZ=False)(ProfileTestCase) 40 42 43 41 44 class NaturalKeysTestCase(TestCase): 42 45 fixtures = ['authtestdata.json'] 43 46 … … 50 53 users_group = Group.objects.create(name='users') 51 54 self.assertEquals(Group.objects.get_by_natural_key('users'), users_group) 52 55 56 NaturalKeysTestCase = override_settings(USE_TZ=False)(NaturalKeysTestCase) 53 57 58 54 59 class LoadDataWithoutNaturalKeysTestCase(TestCase): 55 60 fixtures = ['regular.json'] 56 61 … … 59 64 group = Group.objects.get(name='my_group') 60 65 self.assertEquals(group, user.groups.get()) 61 66 67 LoadDataWithoutNaturalKeysTestCase = override_settings(USE_TZ=False)(LoadDataWithoutNaturalKeysTestCase) 62 68 69 63 70 class LoadDataWithNaturalKeysTestCase(TestCase): 64 71 fixtures = ['natural.json'] 65 72 … … 68 75 group = Group.objects.get(name='my_group') 69 76 self.assertEquals(group, user.groups.get()) 70 77 78 LoadDataWithNaturalKeysTestCase = override_settings(USE_TZ=False)(LoadDataWithNaturalKeysTestCase) 71 79 80 72 81 class UserManagerTestCase(TestCase): 73 82 74 83 def test_create_user(self): -
django/contrib/auth/tests/forms.py
5 5 from django.contrib.auth.models import User 6 6 from django.contrib.auth.forms import UserCreationForm, AuthenticationForm, PasswordChangeForm, SetPasswordForm, UserChangeForm, PasswordResetForm 7 7 from django.test import TestCase 8 from django.test.utils import override_settings 8 9 from django.utils.encoding import force_unicode 9 10 from django.utils import translation 10 11 … … 74 75 u = form.save() 75 76 self.assertEqual(repr(u), '<User: jsmith@example.com>') 76 77 78 UserCreationFormTest = override_settings(USE_TZ=False)(UserCreationFormTest) 77 79 80 78 81 class AuthenticationFormTest(TestCase): 79 82 80 83 fixtures = ['authtestdata.json'] … … 125 128 self.assertTrue(form.is_valid()) 126 129 self.assertEqual(form.non_field_errors(), []) 127 130 131 AuthenticationFormTest = override_settings(USE_TZ=False)(AuthenticationFormTest) 128 132 133 129 134 class SetPasswordFormTest(TestCase): 130 135 131 136 fixtures = ['authtestdata.json'] … … 151 156 form = SetPasswordForm(user, data) 152 157 self.assertTrue(form.is_valid()) 153 158 159 SetPasswordFormTest = override_settings(USE_TZ=False)(SetPasswordFormTest) 154 160 161 155 162 class PasswordChangeFormTest(TestCase): 156 163 157 164 fixtures = ['authtestdata.json'] … … 198 205 self.assertEqual(PasswordChangeForm(user, {}).fields.keys(), 199 206 ['old_password', 'new_password1', 'new_password2']) 200 207 208 PasswordChangeFormTest = override_settings(USE_TZ=False)(PasswordChangeFormTest) 201 209 210 202 211 class UserChangeFormTest(TestCase): 203 212 204 213 fixtures = ['authtestdata.json'] … … 226 235 # Just check we can create it 227 236 form = MyUserForm({}) 228 237 238 UserChangeFormTest = override_settings(USE_TZ=False)(UserChangeFormTest) 229 239 240 230 241 class PasswordResetFormTest(TestCase): 231 242 232 243 fixtures = ['authtestdata.json'] … … 304 315 self.assertFalse(form.is_valid()) 305 316 self.assertEqual(form["email"].errors, 306 317 [u"The user account associated with this e-mail address cannot reset the password."]) 318 319 PasswordResetFormTest = override_settings(USE_TZ=False)(PasswordResetFormTest)