Simplify provider selection with '-all' suffix

Previously we had to cope with two forms of the hyphenated string
we use to represent a pending change in broadcast account type.
Using "all" to mean "all providers" matches the behaviour in the
API [1], and means we can remove some complexity.

"training-test-all" isn't ideal, since the provider is irrelevant
for a training mode service. However, this isn't much worse than
the previous "training-test", noting that the channel also has no
relevance. We'll iterate this in later commits.

[1]: 8e1a144f87/migrations/versions/0352_broadcast_provider_types.py (L14)
This commit is contained in:
Ben Thorner
2021-06-07 16:01:59 +01:00
parent e3cc16c936
commit e848643361
2 changed files with 35 additions and 42 deletions

View File

@@ -5537,28 +5537,28 @@ def test_service_set_broadcast_channel_has_no_radio_selected_for_non_broadcast_s
"test",
"all",
"Training mode",
"training-test",
"training-test-all",
),
(
"live",
"test",
"vodafone",
"Test channel",
"live-test",
"live-test-all",
),
(
"live",
"severe",
"all",
"Live channel",
"live-severe",
"live-severe-all",
),
(
"live",
"government",
"all",
"Government channel",
"live-government",
"live-government-all",
),
]
)
@@ -5601,22 +5601,22 @@ def test_service_set_broadcast_channel_has_radio_selected_for_broadcast_service(
'account_type,expected_redirect_endpoint,extra_args',
[
(
'training-test',
'training-test-all',
'.service_confirm_broadcast_account_type',
{'account_type': 'training-test'},
{'account_type': 'training-test-all'},
),
(
'live-test',
'live-test-all',
'.service_set_broadcast_network',
{'broadcast_channel': 'test'},
),
(
'live-severe',
'live-severe-all',
'.service_set_broadcast_network',
{'broadcast_channel': 'severe'},
),
(
'live-government',
'live-government-all',
'.service_set_broadcast_network',
{'broadcast_channel': 'government'},
),
@@ -5660,7 +5660,7 @@ def test_service_set_broadcast_channel_redirects(
"severe",
"all",
[
("All networks", "live-severe"),
("All networks", "live-severe-all"),
],
),
(
@@ -5668,7 +5668,7 @@ def test_service_set_broadcast_channel_redirects(
"government",
"all",
[
("All networks", "live-government"),
("All networks", "live-government-all"),
],
),
(
@@ -5676,7 +5676,7 @@ def test_service_set_broadcast_channel_redirects(
"test",
"all",
[
("All networks", "live-test"),
("All networks", "live-test-all"),
],
),
(
@@ -5772,9 +5772,9 @@ def test_service_set_broadcast_network_has_radio_selected(
@pytest.mark.parametrize(
'broadcast_channel, provider, choice_type',
(
('severe', '', 'network_variant'),
('government', '', 'network_variant'),
('test', '', 'network_variant'),
('severe', 'all', 'network_variant'),
('government', 'all', 'network_variant'),
('test', 'all', 'network_variant'),
('test', 'o2', 'network'),
('test', 'ee', 'network'),
('test', 'three', 'network'),
@@ -5790,11 +5790,11 @@ def test_service_set_broadcast_network(
provider,
choice_type,
):
expected_result = f'live-{broadcast_channel}-{provider}'
if choice_type == 'network_variant':
expected_result = f'live-{broadcast_channel}'
data = {'network_variant': expected_result}
else:
expected_result = f'live-{broadcast_channel}-{provider}'
data = {'network_variant': '', 'network': expected_result}
client_request.login(platform_admin_user)
@@ -5844,7 +5844,7 @@ def test_service_set_broadcast_network_makes_you_choose(
@pytest.mark.parametrize(
'value, expected_paragraphs',
[
('training-test', [
('training-test-all', [
'Training',
'No phones will receive alerts sent from this service.',
]),
@@ -5872,13 +5872,13 @@ def test_service_set_broadcast_network_makes_you_choose(
'channel on their phones will receive alerts sent from '
'this service.',
]),
('live-test', [
('live-test-all', [
'Test',
'Members of the public who have switched on the test '
'channel on their phones will receive alerts sent from '
'this service.',
]),
('live-severe', [
('live-severe-all', [
'Live',
'Members of the public will receive alerts sent from this '
'service.',
@@ -5888,7 +5888,7 @@ def test_service_set_broadcast_network_makes_you_choose(
'Members of the public will receive alerts sent from this '
'service.',
]),
('live-government', [
('live-government-all', [
'Government',
'Members of the public will receive alerts sent from this '
'service, even if theyve opted out.'
@@ -5920,10 +5920,10 @@ def test_service_confirm_broadcast_account_type_confirmation_page(
@pytest.mark.parametrize(
'value,service_mode,broadcast_channel,allowed_broadcast_provider',
[
("training-test", "training", "test", "all"),
("training-test-all", "training", "test", "all"),
("live-test-vodafone", "live", "test", "vodafone"),
("live-severe", "live", "severe", "all"),
("live-government", "live", "government", "all"),
("live-severe-all", "live", "severe", "all"),
("live-government-all", "live", "government", "all"),
]
)
def test_service_confirm_broadcast_account_type_posts_data_to_api_and_redirects(
@@ -5963,9 +5963,8 @@ def test_service_confirm_broadcast_account_type_posts_data_to_api_and_redirects(
@pytest.mark.parametrize('account_type', (
'foo-severe',
'training-foo',
'live-foo',
'foo-test-ee',
'live-foo-all',
'live-government-foo'
))
def test_service_confirm_broadcast_account_type_errors_for_unknown_type(