Merge lp:~canonical-isd-hackers/canonical-identity-provider/bug_579920 into lp:canonical-identity-provider/release

Proposed by David Owen
Status: Superseded
Proposed branch: lp:~canonical-isd-hackers/canonical-identity-provider/bug_579920
Merge into: lp:canonical-identity-provider/release
Diff against target: 41 lines (+21/-0)
2 files modified
identityprovider/forms.py (+1/-0)
identityprovider/tests/test_forms.py (+20/-0)
To merge this branch: bzr merge lp:~canonical-isd-hackers/canonical-identity-provider/bug_579920
Reviewer Review Type Date Requested Status
Danny Tamez (community) Approve
Review via email: mp+25718@code.launchpad.net

This proposal has been superseded by a proposal from 2010-05-22.

Commit message

If the first password field has errors, errors regarding the second password field are suppressed (whether or not it matches the first field).

Includes unit tests.

To post a comment you must log in.
Revision history for this message
Danny Tamez (zematynnad) wrote :

First bug fix is looking good David. Please add a test and I'll approve. Also,even once approved please do not merge into trunk until we're out of code freeze.

review: Needs Fixing
Revision history for this message
David Owen (dsowen) wrote :

On 05/20/2010 02:25 PM, Danny Tamez wrote:
> Review: Needs Fixing
>
> First bug fix is looking good David. Please add a test and I'll
> approve. Also,even once approved please do not merge into trunk until
> we're out of code freeze.

Okay, I might schedule that for after I wrap up my current bug (if not
sooner).

Thanks,
David

Revision history for this message
Danny Tamez (zematynnad) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'identityprovider/forms.py'
2--- identityprovider/forms.py 2010-04-21 15:29:24 +0000
3+++ identityprovider/forms.py 2010-05-22 02:46:19 +0000
4@@ -231,6 +231,7 @@
5 newpasswordconfirm = cleaned_data.get('newpasswordconfirm')
6 if newpassword or newpasswordconfirm:
7 if (newpassword != newpasswordconfirm and
8+ not self['newpassword'].errors and
9 not self['newpasswordconfirm'].errors):
10 raise forms.ValidationError(_("Didn't match"))
11 return cleaned_data
12
13=== modified file 'identityprovider/tests/test_forms.py'
14--- identityprovider/tests/test_forms.py 2010-04-21 15:29:24 +0000
15+++ identityprovider/tests/test_forms.py 2010-05-22 02:46:19 +0000
16@@ -47,6 +47,26 @@
17 self.assertFalse(form.is_valid())
18 self.assertFalse('displayname' in form.errors)
19
20+ def test_newpassword_mismatch_validation(self):
21+ account = Account.objects.get(openid_identifier='name12_oid')
22+ form = EditAccountForm(account=account,
23+ data={'newpassword': 'tooweak',
24+ 'newpasswordconfirm' : 'other'})
25+ self.assertFalse(form.is_valid())
26+ self.assertEqual(1, len(form.errors['newpassword']))
27+ self.assertFalse('newpasswordconfirm' in form.errors)
28+ self.assertEqual(0, len(form.non_field_errors()))
29+
30+ def test_newpassword_validation(self):
31+ account = Account.objects.get(openid_identifier='name12_oid')
32+ form = EditAccountForm(account=account,
33+ data={'newpassword': 'tooweak',
34+ 'newpasswordconfirm' : 'tooweak'})
35+ self.assertFalse(form.is_valid())
36+ self.assertEqual(1, len(form.errors['newpassword']))
37+ self.assertFalse('newpasswordconfirm' in form.errors)
38+ self.assertEqual(0, len(form.non_field_errors()))
39+
40
41 class WebServiceCreateAccountFormTest(SQLCachedTestCase):
42