mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-23 07:46:23 -04:00
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:
@@ -162,7 +162,14 @@ def service_name_change_confirm(service_id):
|
|||||||
@login_required
|
@login_required
|
||||||
@user_has_permissions('manage_settings', admin_override=True)
|
@user_has_permissions('manage_settings', admin_override=True)
|
||||||
def request_to_go_live(service_id):
|
def request_to_go_live(service_id):
|
||||||
return render_template('views/service-settings/request-to-go-live.html')
|
return render_template(
|
||||||
|
'views/service-settings/request-to-go-live.html',
|
||||||
|
has_team_members=(
|
||||||
|
user_api_client.get_count_of_users_with_permission(
|
||||||
|
service_id, 'manage_settings'
|
||||||
|
) > 1
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@main.route("/services/<service_id>/service-settings/submit-request-to-go-live", methods=['GET', 'POST'])
|
@main.route("/services/<service_id>/service-settings/submit-request-to-go-live", methods=['GET', 'POST'])
|
||||||
|
|||||||
@@ -1,15 +1,20 @@
|
|||||||
{% macro tick_cross(yes, label) %}
|
{% macro tick_cross(yes, label, truthy_hint='Can', falsey_hint='Can’t') %}
|
||||||
<li>
|
<li>
|
||||||
{% if yes %}
|
{% if yes %}
|
||||||
<span class="tick-cross-tick">
|
<span class="tick-cross-tick">
|
||||||
<span class="visually-hidden">Can</span>
|
<span class="visually-hidden">{{ truthy_hint }}</span>
|
||||||
{{ label}}
|
{{ label}}
|
||||||
</span>
|
</span>
|
||||||
{% else %}
|
{% else %}
|
||||||
<span class="tick-cross-cross">
|
<span class="tick-cross-cross">
|
||||||
<span class="visually-hidden">Can’t</span>
|
<span class="visually-hidden">{{ falsey_hint }}</span>
|
||||||
{{ label}}
|
{{ label}}
|
||||||
</span>
|
</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</li>
|
</li>
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|
||||||
|
|
||||||
|
{% macro tick_cross_done_not_done(yes, label) %}
|
||||||
|
{{ tick_cross(yes, label, truthy_hint='Done: ', falsey_hint='Not done: ') }}
|
||||||
|
{% endmacro %}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
{% from "components/radios.html" import radios %}
|
{% from "components/radios.html" import radios %}
|
||||||
{% from "components/page-footer.html" import page_footer %}
|
{% from "components/page-footer.html" import page_footer %}
|
||||||
{% from "components/banner.html" import banner_wrapper %}
|
{% from "components/banner.html" import banner_wrapper %}
|
||||||
|
{% from "components/tick-cross.html" import tick_cross_done_not_done %}
|
||||||
|
|
||||||
{% block service_page_title %}
|
{% block service_page_title %}
|
||||||
Request to go live
|
Request to go live
|
||||||
@@ -14,21 +15,27 @@
|
|||||||
<div class="column-five-sixths">
|
<div class="column-five-sixths">
|
||||||
<h1 class="heading-large">Request to go live</h1>
|
<h1 class="heading-large">Request to go live</h1>
|
||||||
<p>
|
<p>
|
||||||
Before you request to go live, make sure you’ve:
|
Before you request to go live, make sure that:
|
||||||
|
</p>
|
||||||
|
<ul class='bottom-gutter'>
|
||||||
|
{{ tick_cross_done_not_done(
|
||||||
|
has_team_members,
|
||||||
|
'Another person in your team has the ‘Manage service’ permission',
|
||||||
|
) }}
|
||||||
|
</ul>
|
||||||
|
<p>
|
||||||
|
You also need to:
|
||||||
</p>
|
</p>
|
||||||
<ul class="list list-bullet bottom-gutter">
|
<ul class="list list-bullet bottom-gutter">
|
||||||
<li>
|
<li>
|
||||||
read our <a href="{{ url_for('.terms') }}">terms of use</a>
|
read our <a href="{{ url_for('.terms') }}">terms of use</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
added <a href="{{ url_for('main.manage_users', service_id=current_service.id) }}">team members</a> to your account
|
specify your reply to email address or text message sender in your
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
specified your reply to email address or text message sender in your
|
|
||||||
<a href="{{ url_for('main.service_settings', service_id=current_service.id) }}">settings</a> page
|
<a href="{{ url_for('main.service_settings', service_id=current_service.id) }}">settings</a> page
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
added the templates you want to start with, making sure they follow the GOV.UK Service Manual standards for
|
add the templates you want to start with, making sure they follow the GOV.UK Service Manual standards for
|
||||||
<a href="https://www.gov.uk/service-manual/design/sending-emails-and-text-messages">writing text messages and emails</a>
|
<a href="https://www.gov.uk/service-manual/design/sending-emails-and-text-messages">writing text messages and emails</a>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||
@@ -455,17 +455,30 @@ def test_should_raise_duplicate_name_handled(
|
|||||||
assert mock_verify_password.called
|
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(
|
def test_should_show_request_to_go_live_checklist(
|
||||||
client_request,
|
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(
|
page = client_request.get(
|
||||||
'main.request_to_go_live', service_id=SERVICE_ONE_ID
|
'main.request_to_go_live', service_id=SERVICE_ONE_ID
|
||||||
)
|
)
|
||||||
assert page.h1.text == 'Request to go live'
|
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(
|
assert page.select_one('main .button')['href'] == url_for(
|
||||||
'main.submit_request_to_go_live',
|
'main.submit_request_to_go_live',
|
||||||
service_id=SERVICE_ONE_ID,
|
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(
|
def test_should_show_request_to_go_live(
|
||||||
|
|||||||
Reference in New Issue
Block a user