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

Commit

Permalink
Add test for interaction between process_takes and process_remainder
Browse files Browse the repository at this point in the history
  • Loading branch information
rohitpaulk committed Aug 31, 2016
1 parent 84f4b31 commit d971d40
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions tests/py/test_billing_payday.py
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ def test_process_remainder(self):
assert cursor.one("select balance from payday_teams where slug='TheEnterprise'") == 0
payday.update_balances(cursor)

assert P('alice').balance == D('0.49')
assert P('alice').balance == D('0.49') # Alice had $1 and gave away $0.51
assert P('picard').balance == D('0.51')

payment = self.db.one("SELECT * FROM payments WHERE direction='to-participant'")
Expand Down Expand Up @@ -531,7 +531,6 @@ def run_through_takes(self):
self.payday.process_takes(cursor, self.payday.ts_start)
self.payday.update_balances(cursor)


# pt - process_takes

def test_pt_processes_takes(self):
Expand Down Expand Up @@ -610,6 +609,19 @@ def test_pt_is_NOT_happy_to_deal_the_owner_in(self):
assert P('bruiser').balance == D('250.00')
assert P('picard').balance == D(' 50.00')

def test_process_remainder_only_processes_pt_leftovers(self):
self.make_member('alice', 100)
self.start_payday()
with self.db.get_cursor() as cursor:
self.payday.prepare(cursor)
cursor.run("UPDATE payday_teams SET balance=500")
self.payday.process_takes(cursor, self.payday.ts_start)
self.payday.process_remainder(cursor)
self.payday.update_balances(cursor)

assert P('alice').balance == D('100')
assert P('picard').balance == D('400') # Owner receives whatever is left


class TestNotifyParticipants(EmailHarness):

Expand Down

0 comments on commit d971d40

Please sign in to comment.