Skip to content
This repository has been archived by the owner on Jan 25, 2018. It is now read-only.

Commit

Permalink
and actually reset (bug 826813)
Browse files Browse the repository at this point in the history
  • Loading branch information
Andy McKay committed Jan 7, 2013
1 parent 6337caf commit 0f6aa2e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/buyers/resources.py
Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions lib/buyers/tests/test_api.py
Expand Up @@ -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()
Expand Down

0 comments on commit 0f6aa2e

Please sign in to comment.