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

Commit

Permalink
Start a test suite for grprbn*
Browse files Browse the repository at this point in the history
* get_ready_payout_routes_by_network
  • Loading branch information
chadwhitacre committed Aug 25, 2016
1 parent 365b9ae commit 73b26a9
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion tests/py/test_billing_exchanges.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@
capture_card_hold,
create_card_hold,
record_exchange,
record_exchange_result
record_exchange_result,
get_ready_payout_routes_by_network
)
from gratipay.billing.payday import Payday
from gratipay.exceptions import NegativeBalance, NotWhitelisted
from gratipay.models.exchange_route import ExchangeRoute
from gratipay.testing import Foobar, Harness, D,P
Expand Down Expand Up @@ -145,6 +147,30 @@ def test_capch_amount_under_minimum(self):
assert self.obama.get_credit_card_error() == ''


# grprbn - get_ready_payout_routes_by_network

@mock.patch.object(Payday, 'fetch_card_holds')
def run_payday(self, fch):
fch.return_value = {}
Payday.start().run()

def test_grprbn_that_its_empty_to_start_with(self):
assert get_ready_payout_routes_by_network(self.db, 'paypal') == []

def test_grprbn_includes_team_owners(self):
enterprise = self.make_team(is_approved=True)
self.obama.set_payment_instruction(enterprise, 100)
self.run_payday()
routes = get_ready_payout_routes_by_network(self.db, 'paypal')
assert [r.participant.username for r in routes] == ['picard']

def test_grprbn_includes_1_0_payouts(self):
alice = self.make_participant('alice', balance=24, status_of_1_0_payout='pending-payout')
ExchangeRoute.insert(alice, 'paypal', '[email protected]')
routes = get_ready_payout_routes_by_network(self.db, 'paypal')
assert [r.participant.username for r in routes] == ['alice']


class TestsWithoutBillingHarness(Harness):

def prep(self, amount):
Expand Down

0 comments on commit 73b26a9

Please sign in to comment.