Skip to content

Commit

Permalink
Add opportunity date tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pxwxnvermx committed Nov 25, 2024
1 parent 28fe591 commit e171f22
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions commcare_connect/form_receiver/tests/test_receiver_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -604,13 +604,20 @@ def test_receiver_visit_review_status(


@pytest.mark.parametrize(
"paymentunit_options, visit_status",
"opportunity, paymentunit_options, visit_status",
[
({"start_date": now().date()}, VisitValidationStatus.approved),
({"start_date": now() + datetime.timedelta(days=2)}, VisitValidationStatus.trial),
({"end_date": now().date()}, VisitValidationStatus.approved),
({"end_date": now() - datetime.timedelta(days=2)}, VisitValidationStatus.over_limit),
({}, {"start_date": now().date()}, VisitValidationStatus.approved),
({}, {"start_date": now() + datetime.timedelta(days=2)}, VisitValidationStatus.trial),
({}, {"end_date": now().date()}, VisitValidationStatus.approved),
({}, {"end_date": now() - datetime.timedelta(days=2)}, VisitValidationStatus.over_limit),
({"opp_options": {"start_date": now().date()}}, {}, VisitValidationStatus.approved),
({"opp_options": {"start_date": now() + datetime.timedelta(days=2)}}, {}, VisitValidationStatus.trial),
({"opp_options": {"end_date": now().date()}}, {}, VisitValidationStatus.approved),
# NOTE: this test case fails as opportunities with past end_date are marked
# as inactive, and are not processed in the form processor
# ({"opp_options": {"end_date": now() - datetime.timedelta(days=2)}}, {}, VisitValidationStatus.over_limit),
],
indirect=["opportunity"],
)
def test_receiver_visit_payment_unit_dates(
mobile_user_with_connect_link: User, api_client: APIClient, opportunity: Opportunity, visit_status
Expand Down

0 comments on commit e171f22

Please sign in to comment.