Ticket #12103: 12103_tests.diff

File 12103_tests.diff, 779 bytes (added by Brandon M Height, 14 years ago)

Tests associated to the patch. Unfortunately I did this with doctests. I intend to write this into a unittest but this should suffice for now.

  • django/contrib/auth/tests/forms.py

    False  
    105105>>> user.is_active = True
    106106>>> user.save()
    107107
     108# The user is inactive but allowed to login
     109
     110>>> data = {
     111...     'username': 'jsmith',
     112...     'password': 'test123',
     113... }
     114>>> user.is_active = False
     115>>> user.save()
     116>>> class AuthenticationFormWithInactiveUsersOkay(AuthenticationForm):
     117...     def confirm_login_allowed(self, user):
     118...         pass
     119>>> form = AuthenticationFormWithInactiveUsersOkay(None, data)
     120>>> form.is_valid()
     121True
     122
     123>>> user.is_active = True
     124>>> user.save()
     125
    108126# The success case
    109127
    110128>>> form = AuthenticationForm(None, data)
Back to Top