Ticket #10017: 10017-tests.patch

File 10017-tests.patch, 1.2 KB (added by Leo Shklovskii, 16 years ago)
  • django/contrib/auth/tests/forms.py

     
    190190False
    191191>>> form['username'].errors
    192192[u'This value must contain only letters, numbers and underscores.']
    193 """
     193
     194
     195### PasswordResetForm
     196
     197>>> from django.contrib.auth.forms import PasswordResetForm
     198>>> data = {'email':'not valid'}
     199>>> form = PasswordResetForm(data)
     200>>> form.is_valid()
     201False
     202>>> form['email'].errors
     203[u'Enter a valid e-mail address.']
     204
     205# Test nonexistant email address
     206>>> data = {'email':'foo@bar.com'}
     207>>> form = PasswordResetForm(data)
     208>>> form.is_valid()
     209False
     210>>> form.errors
     211{'email': [u"That e-mail address doesn't have an associated user account. Are you sure you'
     212ve registered?"]}
     213
     214# Test cleaned_data bug fix
     215>>> user = User.objects.create_user("jsmith3", "jsmith3@example.com", "test123")
     216>>> data = {'email':'jsmith3@example.com'}
     217>>> form = PasswordResetForm(data)
     218>>> form.is_valid()
     219True
     220>>> form.cleaned_data['email']
     221u'jsmith@example.com'
     222
     223"""
     224 No newline at end of file
Back to Top