diff --git a/app/main/forms.py b/app/main/forms.py index f2cf33f04..327873385 100644 --- a/app/main/forms.py +++ b/app/main/forms.py @@ -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()] ) diff --git a/app/templates/views/service-settings.html b/app/templates/views/service-settings.html index e28f0a168..ea1e3b3dd 100644 --- a/app/templates/views/service-settings.html +++ b/app/templates/views/service-settings.html @@ -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%} 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 986ff5afc..79fc1bd40 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 @@ -27,8 +27,8 @@ {% 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 they’ve opted out + {%- endif %}.

{% endif %} diff --git a/app/templates/withnav_template.html b/app/templates/withnav_template.html index 296f2a029..34f7fefae 100644 --- a/app/templates/withnav_template.html +++ b/app/templates/withnav_template.html @@ -22,11 +22,15 @@ {% elif current_service.has_permission('broadcast') %} {% if current_service.trial_mode %} Training - {% else %} + {% elif current_service.broadcast_channel == 'severe' %} Live - {% endif %} - {% if current_service.allowed_broadcast_provider != "all" %} - ({{ current_service.allowed_broadcast_provider }}) + {% elif current_service.broadcast_channel == 'test' %} + {{ current_service.broadcast_channel|title }} + {% if current_service.allowed_broadcast_provider != "all" %} + ({{ current_service.allowed_broadcast_provider }}) + {% endif %} + {% else %} + {{ current_service.broadcast_channel|title }} {% endif %} {% endif %} diff --git a/tests/app/main/views/test_broadcast.py b/tests/app/main/views/test_broadcast.py index 83709ce98..4b4c3af9f 100644 --- a/tests/app/main/views/test_broadcast.py +++ b/tests/app/main/views/test_broadcast.py @@ -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, diff --git a/tests/app/main/views/test_service_settings.py b/tests/app/main/views/test_service_settings.py index 94fbbe129..1bca91636 100644 --- a/tests/app/main/views/test_service_settings.py +++ b/tests/app/main/views/test_service_settings.py @@ -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 they’ve 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(