Check for team members on request to go live page

One of the things that we want to check before a service goes live is
that they have at least two team members with the manage service
permission. Anyone who can make a request to go live has this
permission, so that means one additional user is needed. This is what we
can automatically communicate to the user.

Under the hood this makes use of the logic added in
https://github.com/alphagov/notifications-admin/pull/1891
This commit is contained in:
Chris Hill-Scott
2018-02-27 11:33:26 +00:00
parent 81cceb1c44
commit ca3fdfd907
4 changed files with 42 additions and 10 deletions

View File

@@ -455,17 +455,30 @@ def test_should_raise_duplicate_name_handled(
assert mock_verify_password.called
@pytest.mark.parametrize('count_of_users_with_manage_service, expected_checklist_item', [
(1, 'Not done: Another person in your team has the Manage service permission'),
(2, 'Done: Another person in your team has the Manage service permission'),
])
def test_should_show_request_to_go_live_checklist(
client_request,
mocker,
count_of_users_with_manage_service,
expected_checklist_item,
):
mock_count_users = mocker.patch(
'app.main.views.service_settings.user_api_client.get_count_of_users_with_permission',
return_value=count_of_users_with_manage_service
)
page = client_request.get(
'main.request_to_go_live', service_id=SERVICE_ONE_ID
)
assert page.h1.text == 'Request to go live'
assert normalize_spaces(page.select('main ul li')[0].text) == expected_checklist_item
assert page.select_one('main .button')['href'] == url_for(
'main.submit_request_to_go_live',
service_id=SERVICE_ONE_ID,
)
mock_count_users.assert_called_once_with(SERVICE_ONE_ID, 'manage_settings')
def test_should_show_request_to_go_live(