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", "Test channel (all networks)"),
("live-severe", "Live (all networks)"),
("live-government", "Government channel (all networks)"),
],
validators=[DataRequired()]
)
@@ -434,6 +434,7 @@
{% if not current_service.broadcast_channel %}
Off
{% 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 not current_service.live%}Training {% endif%}
@@ -27,8 +27,8 @@
<span class="navigation-service-type navigation-service-type--live govuk-!-margin-left-0">
{% if form.account_type.broadcast_channel == 'severe' %}
Live
{% elif form.account_type.broadcast_channel == 'test' %}
Test
{% else %}
{{ form.account_type.broadcast_channel|title }}
{% endif %}
{% if form.account_type.provider_restriction != 'all' %}
({{ form.account_type.provider_restriction|format_mobile_network }})
@@ -40,7 +40,10 @@
{% if form.account_type.broadcast_channel == 'test' %}
who have switched on the test channel on their phones
{% 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>
{% endif %}
+8 -4
View File
@@ -22,11 +22,15 @@
{% elif current_service.has_permission('broadcast') %}
{% if current_service.trial_mode %}
<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
{% endif %}
{% if current_service.allowed_broadcast_provider != "all" %}
({{ current_service.allowed_broadcast_provider }})
{% elif current_service.broadcast_channel == 'test' %}
<span class="navigation-service-type navigation-service-type--live">{{ current_service.broadcast_channel|title }}
{% 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 %}
</span>
{% 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",
'.navigation-service-type.navigation-service-type--training',
'service one Training Switch service',
'Training',
),
(
False,
"all",
'.navigation-service-type.navigation-service-type--live',
'service one Live Switch service',
'Live',
),
(
True,
"all",
None,
'.navigation-service-type.navigation-service-type--training',
'service one Training Switch service',
'Training',
),
(
False,
'severe',
"all",
'.navigation-service-type.navigation-service-type--live',
'service one Live Switch service',
'Live',
),
(
True,
'vodafone',
'.navigation-service-type.navigation-service-type--training',
'service one Training (vodafone) Switch service',
'Training (vodafone)',
),
(
False,
'vodafone',
'.navigation-service-type.navigation-service-type--live',
'service one Live (vodafone) Switch service',
'Live (vodafone)',
),
))
(
False,
'test',
'vodafone',
'.navigation-service-type.navigation-service-type--live',
'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',
'all',
'.navigation-service-type.navigation-service-type--live',
'service one Government Switch service',
'Government',
),
)
)
def test_broadcast_service_shows_live_or_training(
client_request,
service_one,
@@ -324,6 +339,7 @@ def test_broadcast_service_shows_live_or_training(
mock_get_service_templates_when_no_templates_exist,
trial_mode,
allowed_broadcast_provider,
channel,
selector,
expected_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['permissions'] += ['broadcast']
service_one['restricted'] = trial_mode
service_one['broadcast_channel'] = channel
page = client_request.get(
'.broadcast_dashboard',
service_id=SERVICE_ONE_ID,
@@ -5435,6 +5435,7 @@ def test_get_service_set_broadcast_account_type(
"Test channel (Vodafone)",
"Test channel (all networks)",
"Live (all networks)",
"Government channel (all networks)",
]
labels = page.find_all('label', class_="govuk-radios__label")
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 '
'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(
@@ -5624,6 +5630,7 @@ def test_post_service_set_broadcast_account_type_confirmation_page(
("training-test", "training", "test", "all"),
("live-test-vodafone", "live", "test", "vodafone"),
("live-severe", "live", "severe", "all"),
("live-government", "live", "government", "all"),
]
)
def test_post_service_set_broadcast_account_type_posts_data_to_api_and_redirects(