Skip to content

Commit

Permalink
Fix tests for opportunity stats
Browse files Browse the repository at this point in the history
  • Loading branch information
pxwxnvermx committed Dec 12, 2024
1 parent 87c9cad commit 23d7092
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions commcare_connect/opportunity/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,10 @@ def test_opportunity_stats(opportunity: Opportunity, user: User):
ocl1 = OpportunityClaimLimitFactory(opportunity_claim=claim, payment_unit=payment_unit1)
ocl2 = OpportunityClaimLimitFactory(opportunity_claim=claim, payment_unit=payment_unit2)

assert opportunity.claimed_budget == (ocl1.max_visits * payment_unit1.amount) + (
ocl2.max_visits * payment_unit2.amount
)
assert opportunity.remaining_budget == opportunity.total_budget - opportunity.claimed_budget - (
opportunity.allotted_visits * org_pay
assert opportunity.claimed_budget == (ocl1.max_visits * (payment_unit1.amount + org_pay)) + (
ocl2.max_visits * (payment_unit2.amount + org_pay)
)
assert opportunity.remaining_budget == opportunity.total_budget - opportunity.claimed_budget


@pytest.mark.django_db
Expand Down

0 comments on commit 23d7092

Please sign in to comment.