Add government channel

We have been asked to support the government channel so that:
- it can be tested
- the option to use it is available for the most severe of emergencies,
  where the public’s choice to opt-out is outweighed by the widespread
  risk to life
This commit is contained in:
Chris Hill-Scott
2021-05-12 16:22:43 +01:00
parent ffd844b2a7
commit f640767f3d
6 changed files with 69 additions and 36 deletions
+1
View File
@@ -2351,6 +2351,7 @@ class ServiceBroadcastAccountTypeForm(StripWhitespaceForm):
("live-test-vodafone", "Test channel (Vodafone)"), ("live-test-vodafone", "Test channel (Vodafone)"),
("live-test", "Test channel (all networks)"), ("live-test", "Test channel (all networks)"),
("live-severe", "Live (all networks)"), ("live-severe", "Live (all networks)"),
("live-government", "Government channel (all networks)"),
], ],
validators=[DataRequired()] validators=[DataRequired()]
) )
@@ -434,6 +434,7 @@
{% if not current_service.broadcast_channel %} {% if not current_service.broadcast_channel %}
Off Off
{% else %} {% 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 == "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%} {% if not current_service.live%}Training {% endif%}
@@ -27,8 +27,8 @@
<span class="navigation-service-type navigation-service-type--live govuk-!-margin-left-0"> <span class="navigation-service-type navigation-service-type--live govuk-!-margin-left-0">
{% if form.account_type.broadcast_channel == 'severe' %} {% if form.account_type.broadcast_channel == 'severe' %}
Live Live
{% elif form.account_type.broadcast_channel == 'test' %} {% else %}
Test {{ form.account_type.broadcast_channel|title }}
{% endif %} {% endif %}
{% if form.account_type.provider_restriction != 'all' %} {% if form.account_type.provider_restriction != 'all' %}
({{ form.account_type.provider_restriction|format_mobile_network }}) ({{ form.account_type.provider_restriction|format_mobile_network }})
@@ -40,7 +40,10 @@
{% if form.account_type.broadcast_channel == 'test' %} {% if form.account_type.broadcast_channel == 'test' %}
who have switched on the test channel on their phones who have switched on the test channel on their phones
{% endif %} {% endif %}
will receive alerts sent from this service. will receive alerts sent from this service
{%- if form.account_type.broadcast_channel == 'government' -%}
, even if theyve opted out
{%- endif %}.
</p> </p>
{% endif %} {% endif %}
+8 -4
View File
@@ -22,11 +22,15 @@
{% elif current_service.has_permission('broadcast') %} {% elif current_service.has_permission('broadcast') %}
{% if current_service.trial_mode %} {% if current_service.trial_mode %}
<span class="navigation-service-type navigation-service-type--training">Training <span class="navigation-service-type navigation-service-type--training">Training
{% else %} {% elif current_service.broadcast_channel == 'severe' %}
<span class="navigation-service-type navigation-service-type--live">Live <span class="navigation-service-type navigation-service-type--live">Live
{% endif %} {% elif current_service.broadcast_channel == 'test' %}
{% if current_service.allowed_broadcast_provider != "all" %} <span class="navigation-service-type navigation-service-type--live">{{ current_service.broadcast_channel|title }}
({{ current_service.allowed_broadcast_provider }}) {% if current_service.allowed_broadcast_provider != "all" %}
({{ current_service.allowed_broadcast_provider }})
{% endif %}
{% else %}
<span class="navigation-service-type navigation-service-type--live">{{ current_service.broadcast_channel|title }}
{% endif %} {% endif %}
</span> </span>
{% endif %} {% endif %}
+46 -29
View File
@@ -286,37 +286,52 @@ def test_broadcast_tour_page_4_shows_service_name(
) )
@pytest.mark.parametrize('trial_mode, allowed_broadcast_provider, selector, expected_text, expected_tagged_text', ( @pytest.mark.parametrize(
'trial_mode, channel, allowed_broadcast_provider, selector, expected_text, expected_tagged_text',
( (
True, (
"all", True,
'.navigation-service-type.navigation-service-type--training', "all",
'service one Training Switch service', None,
'Training', '.navigation-service-type.navigation-service-type--training',
), 'service one Training Switch service',
( 'Training',
False, ),
"all", (
'.navigation-service-type.navigation-service-type--live', False,
'service one Live Switch service', 'severe',
'Live', "all",
), '.navigation-service-type.navigation-service-type--live',
'service one Live Switch service',
'Live',
),
( (
True, False,
'vodafone', 'test',
'.navigation-service-type.navigation-service-type--training', 'vodafone',
'service one Training (vodafone) Switch service', '.navigation-service-type.navigation-service-type--live',
'Training (vodafone)', 'service one Test (vodafone) Switch service',
), 'Test (vodafone)',
( ),
False, (
'vodafone', False,
'.navigation-service-type.navigation-service-type--live', 'test',
'service one Live (vodafone) Switch service', 'all',
'Live (vodafone)', '.navigation-service-type.navigation-service-type--live',
), 'service one Test Switch service',
)) 'Test',
),
(
False,
'government',
'all',
'.navigation-service-type.navigation-service-type--live',
'service one Government Switch service',
'Government',
),
)
)
def test_broadcast_service_shows_live_or_training( def test_broadcast_service_shows_live_or_training(
client_request, client_request,
service_one, service_one,
@@ -324,6 +339,7 @@ def test_broadcast_service_shows_live_or_training(
mock_get_service_templates_when_no_templates_exist, mock_get_service_templates_when_no_templates_exist,
trial_mode, trial_mode,
allowed_broadcast_provider, allowed_broadcast_provider,
channel,
selector, selector,
expected_text, expected_text,
expected_tagged_text, expected_tagged_text,
@@ -331,6 +347,7 @@ def test_broadcast_service_shows_live_or_training(
service_one['allowed_broadcast_provider'] = allowed_broadcast_provider service_one['allowed_broadcast_provider'] = allowed_broadcast_provider
service_one['permissions'] += ['broadcast'] service_one['permissions'] += ['broadcast']
service_one['restricted'] = trial_mode service_one['restricted'] = trial_mode
service_one['broadcast_channel'] = channel
page = client_request.get( page = client_request.get(
'.broadcast_dashboard', '.broadcast_dashboard',
service_id=SERVICE_ONE_ID, service_id=SERVICE_ONE_ID,
@@ -5435,6 +5435,7 @@ def test_get_service_set_broadcast_account_type(
"Test channel (Vodafone)", "Test channel (Vodafone)",
"Test channel (all networks)", "Test channel (all networks)",
"Live (all networks)", "Live (all networks)",
"Government channel (all networks)",
] ]
labels = page.find_all('label', class_="govuk-radios__label") labels = page.find_all('label', class_="govuk-radios__label")
assert len(labels) == len(expected_labels) assert len(labels) == len(expected_labels)
@@ -5599,6 +5600,11 @@ def test_post_service_set_broadcast_account_type_confirms(
'Members of the public will receive alerts sent from this ' 'Members of the public will receive alerts sent from this '
'service.', 'service.',
]), ]),
('live-government', [
'Government',
'Members of the public will receive alerts sent from this '
'service, even if theyve opted out.'
]),
] ]
) )
def test_post_service_set_broadcast_account_type_confirmation_page( def test_post_service_set_broadcast_account_type_confirmation_page(
@@ -5624,6 +5630,7 @@ def test_post_service_set_broadcast_account_type_confirmation_page(
("training-test", "training", "test", "all"), ("training-test", "training", "test", "all"),
("live-test-vodafone", "live", "test", "vodafone"), ("live-test-vodafone", "live", "test", "vodafone"),
("live-severe", "live", "severe", "all"), ("live-severe", "live", "severe", "all"),
("live-government", "live", "government", "all"),
] ]
) )
def test_post_service_set_broadcast_account_type_posts_data_to_api_and_redirects( def test_post_service_set_broadcast_account_type_posts_data_to_api_and_redirects(