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 ids in payment_instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
chadwhitacre committed Jun 16, 2016
1 parent 1833bf7 commit 4976993
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 17 deletions.
6 changes: 3 additions & 3 deletions tests/py/test_billing_payday.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ def test_payday_moves_money_cumulative_above_min_charge(self, fch):
UPDATE payment_instructions ppi
SET due = '5.00'
WHERE ppi.participant = 'obama'
AND ppi.team = 'TheEnterprise'
WHERE ppi.participant_id = %s
AND ppi.team_id = %s
""")
""", (self.obama.id, Enterprise.id))

assert self.obama.get_due(Enterprise) == D('5.00')

Expand Down
20 changes: 12 additions & 8 deletions tests/py/test_close.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,11 @@ def test_close_page_shows_a_message_to_owners_of_three_teams(self):
def test_cpi_clears_payment_instructions(self):
alice = self.make_participant('alice', claimed_time='now', last_bill_result='')
alice.set_payment_instruction(self.make_team(), D('1.00'))
npayment_instructions = lambda: self.db.one("SELECT count(*) "
"FROM current_payment_instructions "
"WHERE participant='alice' AND amount > 0")
npayment_instructions = lambda: self.db.one( "SELECT count(*) "
"FROM current_payment_instructions "
"WHERE participant_id=%s AND amount > 0"
, (alice.id,)
)
assert npayment_instructions() == 1
with self.db.get_cursor() as cursor:
alice.clear_payment_instructions(cursor)
Expand All @@ -98,7 +100,7 @@ def test_cpi_doesnt_duplicate_zero_payment_instructions(self):
alice.set_payment_instruction(A, D('1.00'))
alice.set_payment_instruction(A, D('0.00'))
npayment_instructions = lambda: self.db.one("SELECT count(*) FROM payment_instructions "
"WHERE participant='alice'")
"WHERE participant_id=%s", (alice.id,))
assert npayment_instructions() == 2
with self.db.get_cursor() as cursor:
alice.clear_payment_instructions(cursor)
Expand All @@ -107,7 +109,7 @@ def test_cpi_doesnt_duplicate_zero_payment_instructions(self):
def test_cpi_doesnt_zero_when_theres_no_payment_instruction(self):
alice = self.make_participant('alice')
npayment_instructions = lambda: self.db.one("SELECT count(*) FROM payment_instructions "
"WHERE participant='alice'")
"WHERE participant_id=%s", (alice.id,))
assert npayment_instructions() == 0
with self.db.get_cursor() as cursor:
alice.clear_payment_instructions(cursor)
Expand All @@ -120,9 +122,11 @@ def test_cpi_clears_multiple_payment_instructions(self):
alice.set_payment_instruction(self.make_team('C'), D('1.00'))
alice.set_payment_instruction(self.make_team('D'), D('1.00'))
alice.set_payment_instruction(self.make_team('E'), D('1.00'))
npayment_instructions = lambda: self.db.one("SELECT count(*) "
"FROM current_payment_instructions "
"WHERE participant='alice' AND amount > 0")
npayment_instructions = lambda: self.db.one( "SELECT count(*) "
"FROM current_payment_instructions "
"WHERE participant_id=%s AND amount > 0"
, (alice.id,)
)
assert npayment_instructions() == 5
with self.db.get_cursor() as cursor:
alice.clear_payment_instructions(cursor)
Expand Down
8 changes: 4 additions & 4 deletions tests/py/test_participant.py
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ def test_giving_only_includes_funded_payment_instructions(self):
assert carl.giving == Decimal('0.00')

funded_tip = self.db.one("SELECT * FROM payment_instructions WHERE is_funded ORDER BY id")
assert funded_tip.participant == alice.username
assert funded_tip.participant_id == alice.id

def test_giving_only_includes_the_latest_payment_instruction(self):
alice = self.make_participant('alice', claimed_time='now', last_bill_result='')
Expand Down Expand Up @@ -620,10 +620,10 @@ def test_dues_are_cancelled_along_with_payment_instruction(self):
UPDATE payment_instructions ppi
SET due = '5.00'
WHERE ppi.participant = 'alice'
AND ppi.team = %s
WHERE ppi.participant_id = %s
AND ppi.team_id = %s
""", (team.slug, ))
""", (alice.id, team.id, ))

assert alice.get_due(team) == Decimal('5.00')

Expand Down
2 changes: 1 addition & 1 deletion tests/py/test_teams.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ def test_receiving_only_includes_funded_payment_instructions(self):

funded_payment_instruction = self.db.one("SELECT * FROM payment_instructions "
"WHERE is_funded ORDER BY id")
assert funded_payment_instruction.participant == alice.username
assert funded_payment_instruction.participant_id == alice.id

def test_receiving_only_includes_latest_payment_instructions(self):
alice = self.make_participant('alice', claimed_time='now', last_bill_result='')
Expand Down
2 changes: 1 addition & 1 deletion tests/py/test_tip_migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def test_mt_migrates_tips_to_payment_instructions(self):
assert self.new_team.migrate_tips() == 2

payment_instructions = self.db.all("SELECT * FROM payment_instructions "
"ORDER BY participant ASC")
"ORDER BY participant_id ASC")
assert len(payment_instructions) == 2
assert payment_instructions[0].participant == 'alice'
assert payment_instructions[0].participant_id == self.alice.id
Expand Down

0 comments on commit 4976993

Please sign in to comment.