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 309
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 #4127 from gratipay/mixin-test-coverage
Update tests for new mixins.
- Loading branch information
Showing
6 changed files
with
140 additions
and
46 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
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
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 |
---|---|---|
|
@@ -3,9 +3,10 @@ | |
from pytest import raises | ||
from gratipay.models.team.mixins.takes import NotAllowed, PENNY, ZERO | ||
from gratipay.testing import Harness, D,P,T | ||
from gratipay.testing.billing import PaydayMixin | ||
|
||
|
||
class TeamTakesHarness(Harness): | ||
class TeamTakesHarness(Harness, PaydayMixin): | ||
# Factored out to share with membership tests ... | ||
|
||
def setUp(self): | ||
|
@@ -122,6 +123,75 @@ def test_stf_doesnt_let_anyone_set_a_take_who_is_not_already_on_the_team_even_to | |
assert actual == 'can only set take if already a member of the team' | ||
|
||
|
||
def test_stf_vets_participant_for_suspiciousness(self): | ||
mallory = self.make_participant('mallory', is_suspicious=True) | ||
actual = self.err(mallory, 0, self.picard) | ||
assert actual == 'user must not be flagged as suspicious' | ||
|
||
def test_stf_vets_participant_for_email(self): | ||
mallory = self.make_participant('mallory') | ||
actual = self.err(mallory, 0, self.picard) | ||
assert actual == 'user must have added at least one email address' | ||
|
||
def test_stf_vets_participant_for_verified_identity(self): | ||
mallory = self.make_participant('mallory', email_address='[email protected]') | ||
actual = self.err(mallory, 0, self.picard) | ||
assert actual == 'user must have a verified identity' | ||
|
||
def test_stf_vets_participant_for_claimed(self): | ||
mallory = self.make_participant('mallory', email_address='[email protected]', verified_in='TT') | ||
actual = self.err(mallory, 0, self.picard) | ||
assert actual == 'user must have claimed the account' | ||
|
||
|
||
def test_stf_vets_recorder_for_suspiciousness(self): | ||
mallory = self.make_participant('mallory', is_suspicious=True) | ||
actual = self.err(self.crusher, 0, mallory) | ||
assert actual == 'user must not be flagged as suspicious' | ||
|
||
def test_stf_vets_recorder_for_email(self): | ||
mallory = self.make_participant('mallory') | ||
actual = self.err(self.crusher, 0, mallory) | ||
assert actual == 'user must have added at least one email address' | ||
|
||
def test_stf_vets_recorder_for_verified_identity(self): | ||
mallory = self.make_participant('mallory', email_address='[email protected]') | ||
actual = self.err(self.crusher, 0, mallory) | ||
assert actual == 'user must have a verified identity' | ||
|
||
def test_stf_vets_recorder_for_claimed(self): | ||
mallory = self.make_participant('mallory', email_address='[email protected]', verified_in='TT') | ||
actual = self.err(self.crusher, 0, mallory) | ||
assert actual == 'user must have claimed the account' | ||
|
||
|
||
# gtlwf - get_take_last_week_for | ||
|
||
def test_gtlwf_gets_take_last_week_for_someone(self): | ||
self.enterprise.set_take_for(self.crusher, PENNY*1, self.picard) | ||
self.enterprise.set_take_for(self.crusher, PENNY*24, self.crusher) | ||
self.run_payday() | ||
self.enterprise.set_take_for(self.crusher, PENNY*48, self.crusher) | ||
assert self.enterprise.get_take_for(self.crusher) == PENNY*48 # sanity check | ||
assert self.enterprise.get_take_last_week_for(self.crusher) == PENNY*24 | ||
|
||
def test_gtlwf_returns_zero_when_they_werent_taking(self): | ||
self.run_payday() | ||
self.enterprise.set_take_for(self.crusher, PENNY*1, self.picard) | ||
assert self.enterprise.get_take_for(self.crusher) == PENNY*1 # sanity check | ||
assert self.enterprise.get_take_last_week_for(self.crusher) == ZERO | ||
|
||
def test_gtlwf_ignores_a_currently_running_payday(self): | ||
self.enterprise.set_take_for(self.crusher, PENNY*1, self.picard) | ||
self.enterprise.set_take_for(self.crusher, PENNY*24, self.crusher) | ||
self.run_payday() | ||
self.enterprise.set_take_for(self.crusher, PENNY*48, self.crusher) | ||
self.start_payday() | ||
self.enterprise.set_take_for(self.crusher, PENNY*96, self.crusher) | ||
assert self.enterprise.get_take_for(self.crusher) == PENNY*96 # sanity check | ||
assert self.enterprise.get_take_last_week_for(self.crusher) == PENNY*24 | ||
|
||
|
||
# ut - update_taking | ||
|
||
def test_ut_updates_taking(self): | ||
|