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.
First pass at get_packages_for_claiming
- Loading branch information
1 parent
fc36e0c
commit cff3a47
Showing
2 changed files
with
72 additions
and
0 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 |
---|---|---|
|
@@ -190,3 +190,38 @@ def test_ordering(self): | |
, ('email', UNLINKED) | ||
, ('bmail', OTHER) | ||
] | ||
|
||
|
||
class GetPackagesForClaiming(Harness): | ||
|
||
def test_gets_packages_for_claiming(self): | ||
foo = self.make_package() | ||
alice = self.make_participant('alice', email_address='[email protected]') | ||
assert alice.get_packages_for_claiming(NPM) == [(foo, None)] | ||
|
||
def test_excludes_packages_for_half_verified_emails(self): | ||
foo = self.make_package() | ||
alice = self.make_participant('alice', email_address='[email protected]') | ||
self.make_package(name='bar', emails=['[email protected]']) | ||
alice.start_email_verification('[email protected]') | ||
assert alice.get_packages_for_claiming(NPM) == [(foo, None)] | ||
|
||
def test_includes_packages_for_verified_but_non_primary_emails(self): | ||
foo = self.make_package() | ||
alice = self.make_participant('alice', email_address='[email protected]') | ||
bar = self.make_package(name='bar', emails=['[email protected]']) | ||
self.add_and_verify_email(alice, '[email protected]') | ||
assert alice.get_packages_for_claiming(NPM) == [(foo, None), (bar, None)] | ||
|
||
def test_includes_packages_already_claimed_by_self(self): | ||
foo = self.make_package() | ||
alice = self.make_participant('alice', email_address='[email protected]') | ||
foo.get_or_create_linked_team(self.db, alice) | ||
assert alice.get_packages_for_claiming(NPM) == [(foo, alice)] | ||
|
||
def test_includes_packages_already_claimed_by_other(self): | ||
foo = self.make_package(emails=['[email protected]', '[email protected]']) | ||
alice = self.make_participant('alice', email_address='[email protected]') | ||
foo.get_or_create_linked_team(self.db, alice) | ||
bob = self.make_participant('bob', email_address='[email protected]') | ||
assert bob.get_packages_for_claiming(NPM) == [(foo, alice)] |