- {{ govukBackLink({
- "text": "Back",
- "href": url_for('.service_set_broadcast_channel', service_id=current_service.id)
- }) }}
+ {{ page_header(
+ 'Choose a mobile network',
+ back_link=url_for('.service_set_broadcast_channel', service_id=current_service.id)
+ ) }}
{% call form_wrapper() %}
- {{ form.network(param_extensions={
- 'fieldset': {
- 'legend': {
- 'isPageHeading': True,
- 'classes': 'govuk-fieldset__legend--l'
- }
- }
- }) }}
+ {% call select_wrapper(form.network_variant, hide_legend=True) %}
+ {% for option in form.network_variant %}
+ {{ radio(option, data_target='single-network' if option.data == "" else None) }}
+ {% endfor %}
+ {% endcall %}
+ {% call conditional_radio_panel('single-network') %}
+ {{ form.network(
+ param_extensions={'fieldset': {'legend': {'classes': 'govuk-visually-hidden'}}}
+ ) }}
+ {% endcall %}
{{ page_footer('Continue') }}
{% endcall %}
diff --git a/tests/app/main/views/test_service_settings.py b/tests/app/main/views/test_service_settings.py
index 1fd9d5f34..d4297c74d 100644
--- a/tests/app/main/views/test_service_settings.py
+++ b/tests/app/main/views/test_service_settings.py
@@ -5575,42 +5575,69 @@ def test_get_service_set_broadcast_channel_redirects(
@pytest.mark.parametrize(
- 'service_mode,broadcast_channel,allowed_broadcast_provider,expected_text,expected_value',
+ 'service_mode,broadcast_channel,allowed_broadcast_provider,expected_selected',
[
(
"training",
"test",
"all",
- "All networks",
- "live-test",
+ [],
+ ),
+ (
+ "live",
+ "severe",
+ "all",
+ [],
+ ),
+ (
+ "live",
+ "government",
+ "all",
+ [],
+ ),
+ (
+ "live",
+ "test",
+ "all",
+ [
+ ("All networks", "live-test"),
+ ],
),
(
"live",
"test",
"ee",
- "EE only",
- "live-test-ee",
+ [
+ ("A single network", ""),
+ ("EE", "live-test-ee"),
+ ],
),
(
"live",
"test",
"o2",
- "O2 only",
- "live-test-o2",
+ [
+ ("A single network", ""),
+ ("O2", "live-test-o2"),
+ ],
),
(
"live",
"test",
"three",
- "Three only",
- "live-test-three",
+ [
+ ("A single network", ""),
+ ("Three", "live-test-three"),
+ ],
),
(
"live",
"test",
"vodafone",
- "Vodafone only",
- "live-test-vodafone",
+ [
+ ("A single network", ""),
+ ("Vodafone", "live-test-vodafone"),
+ ],
),
]
)
@@ -5621,14 +5648,13 @@ def test_get_service_set_broadcast_network_has_radio_selected(
service_mode,
broadcast_channel,
allowed_broadcast_provider,
- expected_text,
- expected_value
+ expected_selected,
):
client_request.login(platform_admin_user)
service_one = service_json(
SERVICE_ONE_ID,
permissions=['broadcast'],
- restricted=False,
+ restricted=False if service_mode == 'live' else True,
broadcast_channel=broadcast_channel,
allowed_broadcast_provider=allowed_broadcast_provider,
)
@@ -5638,49 +5664,87 @@ def test_get_service_set_broadcast_network_has_radio_selected(
'main.service_set_broadcast_network',
service_id=SERVICE_ONE_ID,
)
- selected_radios = page.select('input[checked]')
- assert len(selected_radios) == 1
- selected_radio = selected_radios[0]
- assert selected_radio.get('value') == expected_value
- selected_label = selected_radio.find_next_sibling('label')
- assert normalize_spaces(selected_label.text) == expected_text
+ assert [
+ (
+ normalize_spaces(radio.find_next_sibling('label').text),
+ radio['value'],
+ )
+ for radio in page.select('input[checked]')
+ ] == expected_selected
@pytest.mark.parametrize(
- 'value',
+ 'data, expected_result',
(
- 'live-test-ee',
- 'live-test-o2',
- 'live-test-three',
- 'live-test-vodafone',
- 'live-test',
- pytest.param('foo', marks=pytest.mark.xfail),
+ (
+ {'network_variant': 'live-test'},
+ 'live-test'
+ ),
+ (
+ {'network_variant': '', 'network': 'live-test-ee'},
+ 'live-test-ee'
+ ),
+ (
+ {'network_variant': '', 'network': 'live-test-o2'},
+ 'live-test-o2'
+ ),
+ (
+ {'network_variant': '', 'network': 'live-test-three'},
+ 'live-test-three'
+ ),
+ (
+ {'network_variant': '', 'network': 'live-test-vodafone'},
+ 'live-test-vodafone'
+ ),
),
)
-def test_post_service_set_broadcast_account_type_confirms(
+def test_post_service_set_broadcast_network(
client_request,
platform_admin_user,
- mocker,
- value,
+ data,
+ expected_result,
):
client_request.login(platform_admin_user)
client_request.post(
'main.service_set_broadcast_network',
service_id=SERVICE_ONE_ID,
- _data={
- 'network': value,
- },
+ _data=data,
_expected_status=302,
_expected_redirect=url_for(
'main.service_confirm_broadcast_account_type',
service_id=SERVICE_ONE_ID,
- account_type=value,
+ account_type=expected_result,
_external=True,
)
)
+@pytest.mark.parametrize(
+ 'data',
+ (
+ {},
+ {'network_variant': ''}, # Missing choice of MNO
+ ),
+)
+def test_post_service_set_broadcast_network_makes_you_choose(
+ client_request,
+ platform_admin_user,
+ mocker,
+ data,
+):
+ client_request.login(platform_admin_user)
+ page = client_request.post(
+ 'main.service_set_broadcast_network',
+ service_id=SERVICE_ONE_ID,
+ _data=data,
+ _expected_status=200,
+ )
+ assert normalize_spaces(
+ page.select_one('.govuk-error-message').text
+ ) == 'Error: Select a mobile network'
+
+
@pytest.mark.parametrize(
'value, expected_paragraphs',
[
@@ -5794,7 +5858,7 @@ def test_post_service_set_broadcast_account_type_posts_data_to_api_and_redirects
@pytest.mark.parametrize('endpoint, expected_error', (
('main.service_set_broadcast_channel', 'Error: Select mode or channel'),
- ('main.service_set_broadcast_network', 'Error: Select mobile network'),
+ ('main.service_set_broadcast_network', 'Error: Select a mobile network'),
))
def test_post_service_set_broadcast_account_type_shows_errors_if_no_radio_selected(
platform_admin_client,
From d38f44ec6961d435dddbe9ac6dcb3e7cf347a26d Mon Sep 17 00:00:00 2001
From: Chris Hill-Scott
Date: Wed, 12 May 2021 11:33:09 +0100
Subject: [PATCH 6/7] =?UTF-8?q?Be=20explicit=20that=20=E2=80=98test?=
=?UTF-8?q?=E2=80=99=20goes=20out=20on=20real=20networks?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Adding ‘all networks’ whenever we mention the using the test channel
without a restriction to a single network should help reinforce that
this sends real alerts.
---
app/templates/views/service-settings.html | 2 +-
...ervice-confirm-broadcast-account-type.html | 3 ++
app/templates/withnav_template.html | 4 ++-
tests/app/main/views/test_broadcast.py | 29 ++++++++++++-------
tests/app/main/views/test_service_settings.py | 4 +--
5 files changed, 27 insertions(+), 15 deletions(-)
diff --git a/app/templates/views/service-settings.html b/app/templates/views/service-settings.html
index ac2560348..567003446 100644
--- a/app/templates/views/service-settings.html
+++ b/app/templates/views/service-settings.html
@@ -436,7 +436,7 @@
{% else %}
{% if current_service.live and current_service.broadcast_channel == "government" %}Government{% endif %}
{% if current_service.live and current_service.broadcast_channel == "severe" %}Live{% endif %}
- {% if current_service.live and current_service.broadcast_channel == "test" %}Test {% if current_service.allowed_broadcast_provider != "all" %}({{ current_service.allowed_broadcast_provider|format_mobile_network }}){% else %}(All networks){% endif %}{%endif%}
+ {% if current_service.live and current_service.broadcast_channel == "test" %}Test {% if current_service.allowed_broadcast_provider != "all" %}({{ current_service.allowed_broadcast_provider|format_mobile_network }}){% else %}(all networks){% endif %}{%endif%}
{% if not current_service.live%}Training {% endif%}
{% endif %}
{% endcall %}
diff --git a/app/templates/views/service-settings/service-confirm-broadcast-account-type.html b/app/templates/views/service-settings/service-confirm-broadcast-account-type.html
index 98fb1a52c..e36045331 100644
--- a/app/templates/views/service-settings/service-confirm-broadcast-account-type.html
+++ b/app/templates/views/service-settings/service-confirm-broadcast-account-type.html
@@ -33,6 +33,9 @@
{% if form.account_type.provider_restriction != 'all' %}
({{ form.account_type.provider_restriction|format_mobile_network }})
{% endif %}
+ {% if form.account_type.broadcast_channel == 'test' and form.account_type.provider_restriction == 'all'%}
+ (all networks)
+ {% endif %}
diff --git a/app/templates/withnav_template.html b/app/templates/withnav_template.html
index 34f7fefae..9e142d5f7 100644
--- a/app/templates/withnav_template.html
+++ b/app/templates/withnav_template.html
@@ -26,7 +26,9 @@
Live
{% elif current_service.broadcast_channel == 'test' %}
{{ current_service.broadcast_channel|title }}
- {% if current_service.allowed_broadcast_provider != "all" %}
+ {% if current_service.allowed_broadcast_provider == "all" %}
+ (all networks)
+ {% else %}
({{ current_service.allowed_broadcast_provider }})
{% endif %}
{% else %}
diff --git a/tests/app/main/views/test_broadcast.py b/tests/app/main/views/test_broadcast.py
index 4b4c3af9f..63ad7f956 100644
--- a/tests/app/main/views/test_broadcast.py
+++ b/tests/app/main/views/test_broadcast.py
@@ -291,8 +291,16 @@ def test_broadcast_tour_page_4_shows_service_name(
(
(
True,
- "all",
None,
+ 'all',
+ '.navigation-service-type.navigation-service-type--training',
+ 'service one Training Switch service',
+ 'Training',
+ ),
+ (
+ True,
+ 'test',
+ 'all',
'.navigation-service-type.navigation-service-type--training',
'service one Training Switch service',
'Training',
@@ -300,12 +308,19 @@ def test_broadcast_tour_page_4_shows_service_name(
(
False,
'severe',
- "all",
+ 'all',
'.navigation-service-type.navigation-service-type--live',
'service one Live Switch service',
'Live',
),
-
+ (
+ False,
+ 'test',
+ 'all',
+ '.navigation-service-type.navigation-service-type--live',
+ 'service one Test (all networks) Switch service',
+ 'Test (all networks)',
+ ),
(
False,
'test',
@@ -314,14 +329,6 @@ def test_broadcast_tour_page_4_shows_service_name(
'service one Test (vodafone) Switch service',
'Test (vodafone)',
),
- (
- False,
- 'test',
- 'all',
- '.navigation-service-type.navigation-service-type--live',
- 'service one Test Switch service',
- 'Test',
- ),
(
False,
'government',
diff --git a/tests/app/main/views/test_service_settings.py b/tests/app/main/views/test_service_settings.py
index d4297c74d..6d2f3f2de 100644
--- a/tests/app/main/views/test_service_settings.py
+++ b/tests/app/main/views/test_service_settings.py
@@ -203,7 +203,7 @@ def test_platform_admin_sees_only_relevant_settings_for_broadcast_service(
(True, "training", "test", "all", "Training"),
(True, "live", "test", "ee", "Test (EE)"),
(True, "live", "test", "three", "Test (Three)"),
- (True, "live", "test", "all", "Test (All networks)"),
+ (True, "live", "test", "all", "Test (all networks)"),
(True, "live", "severe", "all", "Live"),
]
)
@@ -5777,7 +5777,7 @@ def test_post_service_set_broadcast_network_makes_you_choose(
'this service.',
]),
('live-test', [
- 'Test',
+ 'Test (all networks)',
'Members of the public who have switched on the test '
'channel on their phones will receive alerts sent from '
'this service.',
From ad0b7537def1c60d22d6c5a06eee31d6bea47040 Mon Sep 17 00:00:00 2001
From: Chris Hill-Scott
Date: Wed, 12 May 2021 11:50:30 +0100
Subject: [PATCH 7/7] Make the government channel visually distinct
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
It’s really serious, so this sets it apart from the other live channels.
---
.../stylesheets/components/navigation.scss | 6 +++++
...ervice-confirm-broadcast-account-type.html | 27 ++++++++++---------
app/templates/withnav_template.html | 4 +--
tests/app/main/views/test_broadcast.py | 2 +-
4 files changed, 23 insertions(+), 16 deletions(-)
diff --git a/app/assets/stylesheets/components/navigation.scss b/app/assets/stylesheets/components/navigation.scss
index e98bad1dc..1bcf79d19 100644
--- a/app/assets/stylesheets/components/navigation.scss
+++ b/app/assets/stylesheets/components/navigation.scss
@@ -47,6 +47,12 @@
box-shadow: 0 -3px 0 0 #F6D7D2;
}
+ &--government {
+ background: #942514;
+ color: #F6D7D2;
+ box-shadow: 0 -3px 0 0 #942514;
+ }
+
}
&-service-switch,
diff --git a/app/templates/views/service-settings/service-confirm-broadcast-account-type.html b/app/templates/views/service-settings/service-confirm-broadcast-account-type.html
index e36045331..229f55856 100644
--- a/app/templates/views/service-settings/service-confirm-broadcast-account-type.html
+++ b/app/templates/views/service-settings/service-confirm-broadcast-account-type.html
@@ -24,19 +24,20 @@
{% else %}
-
- {% if form.account_type.broadcast_channel == 'severe' %}
- Live
- {% else %}
- {{ form.account_type.broadcast_channel|title }}
- {% endif %}
- {% if form.account_type.provider_restriction != 'all' %}
- ({{ form.account_type.provider_restriction|format_mobile_network }})
- {% endif %}
- {% if form.account_type.broadcast_channel == 'test' and form.account_type.provider_restriction == 'all'%}
- (all networks)
- {% endif %}
-
+ {% if form.account_type.broadcast_channel == 'severe' %}
+ Live
+ {% elif form.account_type.broadcast_channel == 'government' %}
+ Government
+ {% else %}
+ {{ form.account_type.broadcast_channel|title }}
+ {% endif %}
+ {% if form.account_type.provider_restriction != 'all' %}
+ ({{ form.account_type.provider_restriction|format_mobile_network }})
+ {% endif %}
+ {% if form.account_type.broadcast_channel == 'test' and form.account_type.provider_restriction == 'all'%}
+ (all networks)
+ {% endif %}
+
Members of the public
diff --git a/app/templates/withnav_template.html b/app/templates/withnav_template.html
index 9e142d5f7..f13c62b43 100644
--- a/app/templates/withnav_template.html
+++ b/app/templates/withnav_template.html
@@ -31,8 +31,8 @@
{% else %}
({{ current_service.allowed_broadcast_provider }})
{% endif %}
- {% else %}
- {{ current_service.broadcast_channel|title }}
+ {% elif current_service.broadcast_channel == 'government' %}
+ Government
{% endif %}
{% endif %}
diff --git a/tests/app/main/views/test_broadcast.py b/tests/app/main/views/test_broadcast.py
index 63ad7f956..804505afb 100644
--- a/tests/app/main/views/test_broadcast.py
+++ b/tests/app/main/views/test_broadcast.py
@@ -333,7 +333,7 @@ def test_broadcast_tour_page_4_shows_service_name(
False,
'government',
'all',
- '.navigation-service-type.navigation-service-type--live',
+ '.navigation-service-type.navigation-service-type--government',
'service one Government Switch service',
'Government',
),