Skip to content

Commit

Permalink
test: unit test shows staff member cannot add EnrollmentFlow with agency
Browse files Browse the repository at this point in the history
  • Loading branch information
angela-tran committed Jan 31, 2025
1 parent 7bc6687 commit 3aff591
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/pytest/core/admin/test_enrollment.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,3 +165,24 @@ def test_has_add_permission(
request = admin_user_request(user_type)

assert flow_admin_model.has_add_permission(request) == expected

@pytest.mark.parametrize("include_transit_agency", [True, False])
def test_EnrollmentFlowForm_staff_member(
self, admin_user_request, flow_admin_model, model_TransitAgency, include_transit_agency
):
request = admin_user_request()

# get the Form class that's used in the admin add view as the user would see it
form_class = flow_admin_model.get_form(request)

request.POST = dict(
system_name="testflow",
supported_enrollment_methods=[models.EnrollmentMethods.DIGITAL, models.EnrollmentMethods.IN_PERSON],
)

if include_transit_agency:
request.POST.update({"transit_agency": model_TransitAgency.id})

form = form_class(request.POST)
assert not form.errors
assert form.is_valid()

0 comments on commit 3aff591

Please sign in to comment.