Only show relevant permissions on the team members page

Since users of broadcast services will always have the view dashboard
permission and never have the API keys permission we can hide these. And
we should re-label the permissions to make sense in the context of
broadcasting.
This commit is contained in:
Chris Hill-Scott
2020-07-13 12:04:11 +01:00
parent 72c1b3d8a1
commit 94434b36e7
2 changed files with 33 additions and 2 deletions

View File

@@ -193,6 +193,35 @@ def test_should_show_caseworker_on_overview_page(
)
def test_should_show_overview_page_for_broadcast_service(
client_request,
mocker,
mock_get_invites_for_service,
mock_get_template_folders,
service_one,
active_user_view_permissions,
active_user_with_permissions,
):
service_one['permissions'].append('broadcast')
mocker.patch('app.models.user.Users.client_method', return_value=[
active_user_with_permissions,
active_user_view_permissions,
])
page = client_request.get('main.manage_users', service_id=SERVICE_ONE_ID)
assert normalize_spaces(page.select('.user-list-item')[0].text) == (
'Test User (you) '
'Can Prepare and approve broadcasts '
'Can Add and edit templates '
'Can Manage settings and team'
)
assert normalize_spaces(page.select('.user-list-item')[1].text) == (
'Test User With Permissions (you) '
'Cannot Prepare and approve broadcasts '
'Cannot Add and edit templates '
'Cannot Manage settings and team'
)
@pytest.mark.parametrize('endpoint, extra_args, service_has_email_auth, auth_options_hidden', [
(
'main.edit_user_permissions',