diff options
author | Justin Bronn <jbronn@gmail.com> | 2008-08-05 17:15:33 +0000 |
---|---|---|
committer | Justin Bronn <jbronn@gmail.com> | 2008-08-05 17:15:33 +0000 |
commit | aa239e3e5405933af6a29dac3cf587b59a099927 (patch) | |
tree | ea2cbd139c9a8cf84c09e0b2008bff70e05927ef /django/contrib/auth/tests/forms.py | |
parent | 45b73c9a4685809236f84046cc7ffd32a50db958 (diff) | |
download | django-attic/gis.tar.gz |
gis: Merged revisions 7981-8001,8003-8011,8013-8033,8035-8036,8038-8039,8041-8063,8065-8076,8078-8139,8141-8154,8156-8214 via svnmerge from trunk.archive/attic/gisattic/gis
git-svn-id: http://code.djangoproject.com/svn/django/branches/gis@8215 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/contrib/auth/tests/forms.py')
-rw-r--r-- | django/contrib/auth/tests/forms.py | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/django/contrib/auth/tests/forms.py b/django/contrib/auth/tests/forms.py index 1e1e0a95d4..01f4995bb7 100644 --- a/django/contrib/auth/tests/forms.py +++ b/django/contrib/auth/tests/forms.py @@ -2,7 +2,7 @@ FORM_TESTS = """ >>> from django.contrib.auth.models import User >>> from django.contrib.auth.forms import UserCreationForm, AuthenticationForm ->>> from django.contrib.auth.forms import PasswordChangeForm +>>> from django.contrib.auth.forms import PasswordChangeForm, SetPasswordForm The user already exists. @@ -95,6 +95,32 @@ True >>> form.non_field_errors() [] +SetPasswordForm: + +The two new passwords do not match. + +>>> data = { +... 'new_password1': 'abc123', +... 'new_password2': 'abc', +... } +>>> form = SetPasswordForm(user, data) +>>> form.is_valid() +False +>>> form["new_password2"].errors +[u"The two password fields didn't match."] + +The success case. + +>>> data = { +... 'new_password1': 'abc123', +... 'new_password2': 'abc123', +... } +>>> form = SetPasswordForm(user, data) +>>> form.is_valid() +True + +PasswordChangeForm: + The old password is incorrect. >>> data = { @@ -132,4 +158,9 @@ The success case. >>> form.is_valid() True +Regression test - check the order of fields: + +>>> PasswordChangeForm(user, {}).fields.keys() +['old_password', 'new_password1', 'new_password2'] + """ |