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.
modify test to avoid test fixtures and cover both email simplates
- Loading branch information
Showing
1 changed file
with
17 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ | |
from gratipay.models.participant import Participant | ||
from gratipay.testing import Foobar, Harness | ||
from gratipay.testing.balanced import BalancedHarness | ||
from gratipay.testing.emails import EmailHarness | ||
|
||
|
||
class TestPayday(BalancedHarness): | ||
|
@@ -529,16 +530,22 @@ def test_payout_ach_error(self, ach_credit): | |
assert payday['nach_failing'] == 1 | ||
|
||
|
||
class TestNotifyParticipants(BalancedHarness): | ||
class TestNotifyParticipants(EmailHarness): | ||
|
||
@mock.patch.object(Payday, 'fetch_card_holds') | ||
def test_it_notifies_participants(self, fch): | ||
self.janet.set_tip_to(self.homer, D('10.00')) | ||
fch.return_value = {} | ||
Payday.start().run() | ||
def test_it_notifies_participants(self): | ||
kalel = self.make_participant('kalel', claimed_time='now', is_suspicious=False, | ||
email_address='[email protected]', notify_charge=3) | ||
lily = self.make_participant('lily', claimed_time='now', is_suspicious=False) | ||
kalel.set_tip_to(lily, 10) | ||
|
||
for status in ('failed', 'succeeded'): | ||
payday = Payday.start() | ||
self.make_exchange('balanced-cc', 10, 0, kalel, status) | ||
payday.end() | ||
payday.notify_participants() | ||
|
||
exchanges = self.db.one('SELECT * FROM exchanges') | ||
assert exchanges['amount'] == D('10.00') | ||
emails = self.db.one('SELECT * FROM email_queue') | ||
assert emails.spt_name == 'charge_'+status | ||
|
||
emails = self.db.one('SELECT * FROM email_queue') | ||
assert emails['spt_name'] == 'charge_succeeded' | ||
Participant.dequeue_emails() | ||
assert self.get_last_email()['to'][0]['email'] == '[email protected]' |