This repository has been archived by the owner on Feb 8, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 308
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4517 from gratipay/close-loophole
Prevent claiming already-claimed packages
- Loading branch information
Showing
3 changed files
with
36 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -295,7 +295,7 @@ def test_package_verification_fails_if_email_not_listed(self): | |
assert response.code == 400 | ||
assert self.db.all('select package_id from claims order by package_id') == [] | ||
|
||
def test_package_verification_fails_package_id_is_garbage(self): | ||
def test_package_verification_fails_if_package_id_is_garbage(self): | ||
response = self.hit_email_spt( 'start-verification' | ||
, '[email protected]' | ||
, package_ids=['cheese monkey'] | ||
|
@@ -304,6 +304,26 @@ def test_package_verification_fails_package_id_is_garbage(self): | |
assert response.code == 400 | ||
assert self.db.all('select package_id from claims order by package_id') == [] | ||
|
||
def test_package_reverification_succeeds_if_package_is_already_claimed_by_self(self): | ||
foo = self.make_package() | ||
self.claim_package('alice', foo) | ||
response = self.hit_email_spt( 'start-verification' | ||
, '[email protected]' | ||
, package_ids=[foo.id] | ||
) | ||
assert response.code == 200 | ||
|
||
def test_package_verification_fails_if_package_is_already_claimed_by_other(self): | ||
self.make_participant('bob', claimed_time='now', email_address='[email protected]') | ||
foo = self.make_package(emails=['[email protected]', '[email protected]']) | ||
self.claim_package('bob', foo) | ||
response = self.hit_email_spt( 'start-verification' | ||
, '[email protected]' | ||
, package_ids=[foo.id] | ||
, should_fail=True | ||
) | ||
assert response.code == 400 | ||
|
||
|
||
class TestFunctions(Alice): | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters