Permalink
Browse files

and actually reset (bug 826813)

  • Loading branch information...
1 parent 6337caf commit 0f6aa2eab11b453fa8d91e59684dbefc940ee6d2 @andymckay andymckay committed Jan 7, 2013
Showing with 11 additions and 0 deletions.
  1. +2 −0 lib/buyers/resources.py
  2. +9 −0 lib/buyers/tests/test_api.py
View
@@ -109,6 +109,8 @@ def obj_create(self, bundle, request=None, **kwargs):
if locked:
log_cef('Locked out account: %s' % buyer.uuid,
request, severity=1)
+ if bundle.obj.valid and buyer.pin_failures:
+ buyer.clear_lockout()
else:
bundle.obj.valid = False
return bundle
@@ -282,6 +282,15 @@ def test_good_pin_but_locked_out(self, log_cef):
assert log_cef.called
eq_(res.status_code, 403)
+ def test_good_reset_failures(self):
+ self.buyer.pin_failures = 1
+ self.buyer.save()
+
+ res = self.client.post(self.list_url, data={'uuid': self.uuid,
+ 'pin': self.pin})
+ eq_(res.status_code, 201)
+ eq_(self.buyer.reget().pin_failures, 0)
+
def test_good_uuid_and_good_pin_and_bad_confirmed(self):
self.buyer.pin_confirmed = False
self.buyer.save()

0 comments on commit 0f6aa2e

Please sign in to comment.