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

Commit

Permalink
Failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
rohitpaulk committed Nov 9, 2014
1 parent ad3b553 commit 5a78c15
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions tests/py/test_billing_payday.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,32 @@ def test_transfer_tips(self):
assert Participant.from_id(self.janet.id).balance == D('0.51')
assert Participant.from_id(self.homer.id).balance == 0

def test_transfer_tips_whole_graph(self):
alice = self.make_participant('alice', claimed_time='now', balance=0,
last_bill_result='')
alice.set_tip_to(self.homer, D('50'))
self.homer.set_tip_to(self.janet, D('20'))
self.janet.set_tip_to(self.david, D('5'))

payday = Payday.start()
with self.db.get_cursor() as cursor:
payday.prepare(cursor, payday.ts_start)
cursor.run("""UPDATE payday_participants
SET card_hold_ok = true
WHERE id = %s
""", (alice.id,))
payday.transfer_tips(cursor)
cursor.run("""UPDATE payday_participants
SET new_balance = 0
WHERE id = %s
""", (alice.id,))
payday.update_balances(cursor)
alice = Participant.from_id(alice.id)
assert Participant.from_id(alice.id).balance == D('0')
assert Participant.from_id(self.homer.id).balance == D('30')
assert Participant.from_id(self.janet.id).balance == D('15')
assert Participant.from_id(self.david.id).balance == D('5')

def test_transfer_takes(self):
a_team = self.make_participant('a_team', claimed_time='now', number='plural', balance=20)
alice = self.make_participant('alice', claimed_time='now')
Expand Down

0 comments on commit 5a78c15

Please sign in to comment.