Ticket #17940: 17940.patch

File 17940.patch, 6.2 KB (added by Aymeric Augustin, 13 years ago)
  • django/contrib/auth/tests/views.py

     
    1212from django.utils.encoding import force_unicode
    1313from django.utils.html import escape
    1414from django.test import TestCase
     15from django.test.utils import override_settings
    1516
    1617from django.contrib.auth import SESSION_KEY, REDIRECT_FIELD_NAME
    1718from django.contrib.auth.forms import (AuthenticationForm, PasswordChangeForm,
     
    5253    def assertContainsEscaped(self, response, text, **kwargs):
    5354        return self.assertContains(response, escape(force_unicode(text)), **kwargs)
    5455
     56AuthViewsTestCase = override_settings(USE_TZ=False)(AuthViewsTestCase)
    5557
     58
    5659class AuthViewNamedURLTests(AuthViewsTestCase):
    5760    urls = 'django.contrib.auth.urls'
    5861
  • django/contrib/auth/tests/signals.py

     
    11from django.test import TestCase
     2from django.test.utils import override_settings
    23from django.contrib.auth import signals
    34
    45
     
    4546        self.client.get('/logout/next_page/')
    4647        self.assertEqual(len(self.logged_out), 1)
    4748        self.assertEqual(self.logged_out[0].username, 'testclient')
     49
     50SignalTestCase = override_settings(USE_TZ=False)(SignalTestCase)
  • django/contrib/auth/tests/context_processors.py

     
    77from django.test import TestCase
    88from django.test.utils import override_settings
    99
    10 
    1110class AuthContextProcessorTests(TestCase):
    1211    """
    1312    Tests for the ``django.contrib.auth.context_processors.auth`` processor
     
    9796        self.assertEqual(user, response.context['user'])
    9897
    9998AuthContextProcessorTests = override_settings(
    100     TEMPLATE_DIRS = (
     99    TEMPLATE_DIRS=(
    101100            os.path.join(os.path.dirname(__file__), 'templates'),
    102         )
     101        ),
     102    USE_TZ=False,                           # required for loading the fixture
    103103)(AuthContextProcessorTests)
  • django/contrib/auth/tests/models.py

     
    11from django.conf import settings
    22from django.test import TestCase
     3from django.test.utils import override_settings
    34from django.contrib.auth.models import (Group, User,
    45    SiteProfileNotAvailable, UserManager)
    56
     
    3738        settings.AUTH_PROFILE_MODULE = 'foo.bar'
    3839        self.assertRaises(SiteProfileNotAvailable, user.get_profile)
    3940
     41ProfileTestCase = override_settings(USE_TZ=False)(ProfileTestCase)
    4042
     43
    4144class NaturalKeysTestCase(TestCase):
    4245    fixtures = ['authtestdata.json']
    4346
     
    5053        users_group = Group.objects.create(name='users')
    5154        self.assertEquals(Group.objects.get_by_natural_key('users'), users_group)
    5255
     56NaturalKeysTestCase = override_settings(USE_TZ=False)(NaturalKeysTestCase)
    5357
     58
    5459class LoadDataWithoutNaturalKeysTestCase(TestCase):
    5560    fixtures = ['regular.json']
    5661
     
    5964        group = Group.objects.get(name='my_group')
    6065        self.assertEquals(group, user.groups.get())
    6166
     67LoadDataWithoutNaturalKeysTestCase = override_settings(USE_TZ=False)(LoadDataWithoutNaturalKeysTestCase)
    6268
     69
    6370class LoadDataWithNaturalKeysTestCase(TestCase):
    6471    fixtures = ['natural.json']
    6572
     
    6875        group = Group.objects.get(name='my_group')
    6976        self.assertEquals(group, user.groups.get())
    7077
     78LoadDataWithNaturalKeysTestCase = override_settings(USE_TZ=False)(LoadDataWithNaturalKeysTestCase)
    7179
     80
    7281class UserManagerTestCase(TestCase):
    7382
    7483    def test_create_user(self):
  • django/contrib/auth/tests/forms.py

     
    55from django.contrib.auth.models import User
    66from django.contrib.auth.forms import UserCreationForm, AuthenticationForm,  PasswordChangeForm, SetPasswordForm, UserChangeForm, PasswordResetForm
    77from django.test import TestCase
     8from django.test.utils import override_settings
    89from django.utils.encoding import force_unicode
    910from django.utils import translation
    1011
     
    7475        u = form.save()
    7576        self.assertEqual(repr(u), '<User: jsmith@example.com>')
    7677
     78UserCreationFormTest = override_settings(USE_TZ=False)(UserCreationFormTest)
    7779
     80
    7881class AuthenticationFormTest(TestCase):
    7982
    8083    fixtures = ['authtestdata.json']
     
    125128        self.assertTrue(form.is_valid())
    126129        self.assertEqual(form.non_field_errors(), [])
    127130
     131AuthenticationFormTest = override_settings(USE_TZ=False)(AuthenticationFormTest)
    128132
     133
    129134class SetPasswordFormTest(TestCase):
    130135
    131136    fixtures = ['authtestdata.json']
     
    151156        form = SetPasswordForm(user, data)
    152157        self.assertTrue(form.is_valid())
    153158
     159SetPasswordFormTest = override_settings(USE_TZ=False)(SetPasswordFormTest)
    154160
     161
    155162class PasswordChangeFormTest(TestCase):
    156163
    157164    fixtures = ['authtestdata.json']
     
    198205        self.assertEqual(PasswordChangeForm(user, {}).fields.keys(),
    199206                         ['old_password', 'new_password1', 'new_password2'])
    200207
     208PasswordChangeFormTest = override_settings(USE_TZ=False)(PasswordChangeFormTest)
    201209
     210
    202211class UserChangeFormTest(TestCase):
    203212
    204213    fixtures = ['authtestdata.json']
     
    226235        # Just check we can create it
    227236        form = MyUserForm({})
    228237
     238UserChangeFormTest = override_settings(USE_TZ=False)(UserChangeFormTest)
    229239
     240
    230241class PasswordResetFormTest(TestCase):
    231242
    232243    fixtures = ['authtestdata.json']
     
    304315        self.assertFalse(form.is_valid())
    305316        self.assertEqual(form["email"].errors,
    306317                         [u"The user account associated with this e-mail address cannot reset the password."])
     318
     319PasswordResetFormTest = override_settings(USE_TZ=False)(PasswordResetFormTest)
Back to Top