diff --git a/tests/unit/staff/views/test_users.py b/tests/unit/staff/views/test_users.py index 1860892d4..9ec7d970e 100644 --- a/tests/unit/staff/views/test_users.py +++ b/tests/unit/staff/views/test_users.py @@ -588,11 +588,18 @@ def test_userlist_filter_by_invalid_org(rf, staff_area_administrator): assert len(response.context_data["object_list"]) == 0 -def test_userlist_filter_by_role(rf, staff_area_administrator): - UserFactory(roles=[OutputPublisher]) - UserFactory(roles=[ProjectCollaborator]) - - request = rf.get("/?role=OutputPublisher") +@pytest.mark.parametrize( + "role", + [ + pytest.param(OutputPublisher, id="global"), + pytest.param(ProjectDeveloper, id="local"), + ], +) +def test_userlist_filter_by_role(rf, staff_area_administrator, role): + # Set up two users: one as the staff area administrator to request the view and + # be filtered out, the other to be included in the response after filtering. + UserFactory(roles=[role]) + request = rf.get(f"/?role={role.__name__}") request.user = staff_area_administrator response = UserList.as_view()(request)