Merge pull request #3787 from alphagov/platform-admin-service-settings

Show only relevant platform admin settings for broadcast service
This commit is contained in:
David McDonald
2021-02-08 14:31:00 +00:00
committed by GitHub
2 changed files with 51 additions and 1 deletions

View File

@@ -329,17 +329,18 @@
{% endif %}
{% endcall %}
{% if not current_service.has_permission('broadcast') %}
{% call row() %}
{{ text_field('Count in list of live services')}}
{{ text_field('Yes' if current_service.count_as_live else 'No') }}
{{ edit_field('Change', url_for('.service_switch_count_as_live', service_id=current_service.id), suffix='if service is counted in list of live services') }}
{% endcall %}
{% call row() %}
{{ text_field('Billing details')}}
{{ optional_text_field(current_service.billing_details, default="No billing details yet", wrap=True) }}
{{ edit_field('Change', url_for('.edit_service_billing_details', service_id=current_service.id), suffix='billing details for service') }}
{% endcall %}
{% endif %}
{% call row() %}
{{ text_field('Notes')}}
@@ -347,6 +348,7 @@
{{ edit_field('Change', url_for('.edit_service_notes', service_id=current_service.id), suffix='the notes for the service') }}
{% endcall %}
{% if not current_service.has_permission('broadcast') %}
{% call row() %}
{{ text_field('Organisation')}}
{% call field() %}
@@ -365,6 +367,7 @@
{% endcall %}
{{ edit_field('Change', url_for('.link_service_to_organisation', service_id=current_service.id), suffix='organisation for service') }}
{% endcall %}
{% call row() %}
{{ text_field('Rate limit')}}
{{ text_field('{:,} per minute'.format(current_service.rate_limit)) }}
@@ -407,6 +410,7 @@
{% endcall %}
{{ edit_field('Change', url_for('.data_retention', service_id=current_service.id), suffix='data retention') }}
{% endcall %}
{% endif %}
{% for permission in service_permissions %}
{% if not service_permissions[permission].requires or current_service.has_permission(service_permissions[permission].requires) %}

View File

@@ -149,6 +149,52 @@ def test_should_show_overview(
app.service_api_client.get_service.assert_called_with(SERVICE_ONE_ID)
def test_platform_admin_sees_only_relevant_settings_for_broadcast_service(
client,
mocker,
api_user_active,
no_reply_to_email_addresses,
no_letter_contact_blocks,
mock_get_organisation,
single_sms_sender,
mock_get_service_settings_page_common,
):
service_one = service_json(
SERVICE_ONE_ID,
users=[api_user_active['id']],
permissions=['broadcast'],
organisation_id=ORGANISATION_ID,
contact_link='contact_us@gov.uk',
)
mocker.patch('app.service_api_client.get_service', return_value={'data': service_one})
client.login(create_platform_admin_user(), mocker, service_one)
response = client.get(url_for(
'main.service_settings', service_id=SERVICE_ONE_ID
))
assert response.status_code == 200
page = BeautifulSoup(response.data.decode('utf-8'), 'html.parser')
assert page.find('h1').text == 'Settings'
rows = page.select('tr')
expected_rows = [
'Label Value Action',
'Service name Test Service Change service name',
'Sign-in method Text message code Change sign-in method',
'Label Value Action',
'Live Off Change service status',
'Notes No notes yet Change the notes for the service',
'Email authentication Off Change your settings for Email authentication',
'Send cell broadcasts On Change your settings for Send cell broadcasts',
]
assert len(rows) == len(expected_rows)
for index, row in enumerate(expected_rows):
assert row == " ".join(rows[index].text.split())
app.service_api_client.get_service.assert_called_with(SERVICE_ONE_ID)
def test_no_go_live_link_for_service_without_organisation(
client_request,
mocker,