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

Commit

Permalink
Failing tests for pachinko bugs during #2362
Browse files Browse the repository at this point in the history
  • Loading branch information
chadwhitacre committed May 15, 2014
1 parent b1fa64e commit 1d6cf8e
Showing 1 changed file with 50 additions and 1 deletion.
51 changes: 50 additions & 1 deletion tests/py/test_billing_payday.py
Original file line number Diff line number Diff line change
Expand Up @@ -838,11 +838,60 @@ def test_get_participants_gets_participants(self):
assert actual == expected

def test_pachinko_pachinkos(self):
a_team = self.make_participant('a_team', claimed_time='now', number='plural', balance=20, pending=0)
a_team = self.make_participant('a_team', claimed_time='now', number='plural', balance=20, \
pending=0)
a_team.add_member(self.make_participant('alice', claimed_time='now', balance=0, pending=0))
a_team.add_member(self.make_participant('bob', claimed_time='now', balance=0, pending=0))

ts_start = self.payday.start()

participants = self.payday.genparticipants(ts_start, ts_start)
self.payday.pachinko(ts_start, participants)

assert Participant.from_username('alice').pending == D('0.01')
assert Participant.from_username('bob').pending == D('0.01')

def test_pachinko_sees_current_take(self):
a_team = self.make_participant('a_team', claimed_time='now', number='plural', balance=20, \
pending=0)
alice = self.make_participant('alice', claimed_time='now', balance=0, pending=0)
a_team.add_member(alice)
a_team.set_take_for(alice, D('1.00'), alice)

ts_start = self.payday.start()

participants = self.payday.genparticipants(ts_start, ts_start)
self.payday.pachinko(ts_start, participants)

assert Participant.from_username('alice').pending == D('1.00')

def test_pachinko_ignores_take_set_after_payday_starts(self):
a_team = self.make_participant('a_team', claimed_time='now', number='plural', balance=20, \
pending=0)
alice = self.make_participant('alice', claimed_time='now', balance=0, pending=0)
a_team.add_member(alice)
a_team.set_take_for(alice, D('0.33'), alice)

ts_start = self.payday.start()
a_team.set_take_for(alice, D('1.00'), alice)

participants = self.payday.genparticipants(ts_start, ts_start)
self.payday.pachinko(ts_start, participants)

assert Participant.from_username('alice').pending == D('0.33')

def test_pachinko_ignores_take_thats_already_been_processed(self):
a_team = self.make_participant('a_team', claimed_time='now', number='plural', balance=20, \
pending=0)
alice = self.make_participant('alice', claimed_time='now', balance=0, pending=0)
a_team.add_member(alice)
a_team.set_take_for(alice, D('0.33'), alice)

ts_start = self.payday.start()
a_team.set_take_for(alice, D('1.00'), alice)

for i in range(4):
participants = self.payday.genparticipants(ts_start, ts_start)
self.payday.pachinko(ts_start, participants)

assert Participant.from_username('alice').pending == D('0.33')

0 comments on commit 1d6cf8e

Please sign in to comment.