Skip to content

Commit

Permalink
test: add coverage for function that checks for existing enrollment
Browse files Browse the repository at this point in the history
  • Loading branch information
angela-tran committed Mar 28, 2024
1 parent bfd8238 commit 43414ac
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tests/pytest/enrollment/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
TEMPLATE_REENROLLMENT_ERROR,
TEMPLATE_SUCCESS,
TEMPLATE_RETRY,
_get_group_funding_source,
_calculate_expiry,
_is_expired,
_is_within_reenrollment_window,
Expand Down Expand Up @@ -186,6 +187,30 @@ def test_index_eligible_post_valid_form_failure(mocker, client, card_tokenize_fo
client.post(path, card_tokenize_form_data)


@pytest.mark.django_db
@pytest.mark.usefixtures("model_EligibilityType")
def test_get_group_funding_sources_funding_source_not_enrolled_yet(mocker, mocked_funding_source):
mock_client = mocker.Mock()
mock_client.get_concession_group_linked_funding_sources.return_value = []

matching_group_funding_source = _get_group_funding_source(mock_client, "group123", mocked_funding_source.id)

assert matching_group_funding_source is None


@pytest.mark.django_db
@pytest.mark.usefixtures("model_EligibilityType")
def test_get_group_funding_sources_funding_source_already_enrolled(
mocker, mocked_funding_source, mocked_group_funding_source_no_expiration
):
mock_client = mocker.Mock()
mock_client.get_concession_group_linked_funding_sources.return_value = [mocked_group_funding_source_no_expiration]

matching_group_funding_source = _get_group_funding_source(mock_client, "group123", mocked_funding_source.id)

assert matching_group_funding_source == mocked_group_funding_source_no_expiration


@pytest.mark.django_db
@pytest.mark.usefixtures("mocked_session_agency", "mocked_session_verifier", "mocked_session_eligibility")
def test_index_eligible_post_valid_form_customer_already_enrolled(
Expand Down

0 comments on commit 43414ac

Please sign in to comment.