Allow setting provider for any channel

Previously we could only select a provider when using the test
channel, but this is also required for others channels when we
do tests on the production network with individual MNOs.

In order to reduce duplication and improve consistency, I've reused
the new broadcast_service_name_tag macro to show the setting.
This commit is contained in:
Ben Thorner
2021-05-20 13:27:22 +01:00
parent 5de1c4f6ca
commit c5196fbf07
7 changed files with 163 additions and 96 deletions

View File

@@ -2407,24 +2407,29 @@ class ServiceBroadcastChannelForm(StripWhitespaceForm):
class ServiceBroadcastNetworkForm(StripWhitespaceForm):
def __init__(self, broadcast_channel, *args, **kwargs):
super().__init__(*args, **kwargs)
self.broadcast_channel = broadcast_channel
self.network_variant.choices = [
(f'live-{broadcast_channel}', 'All networks'),
('', 'A single network'),
]
self.network.choices = [
(f'live-{broadcast_channel}-ee', 'EE'),
(f'live-{broadcast_channel}-o2', 'O2'),
(f'live-{broadcast_channel}-vodafone', 'Vodafone'),
(f'live-{broadcast_channel}-three', 'Three'),
]
network_variant = ServiceBroadcastAccountTypeField(
'Choose a mobile network',
thing='a mobile network',
choices=[
('live-test', 'All networks'),
('', 'A single network'),
]
)
network = OptionalServiceBroadcastAccountTypeField(
'Choose a mobile network',
thing='a mobile network',
choices=[
('live-test-ee', 'EE'),
('live-test-o2', 'O2'),
('live-test-vodafone', 'Vodafone'),
('live-test-three', 'Three'),
],
)
def validate_network(self, field):
@@ -2439,14 +2444,16 @@ class ServiceBroadcastAccountTypeForm(StripWhitespaceForm):
'Change cell broadcast service type',
thing='which type of account this cell broadcast service is',
choices=[
("training-test", "Training mode"),
("live-test-ee", "Test channel (EE)"),
("live-test-o2", "Test channel (O2)"),
("live-test-three", "Test channel (Three)"),
("live-test-vodafone", "Test channel (Vodafone)"),
("live-test", "Test channel (all networks)"),
("live-severe", "Live (all networks)"),
("live-government", "Government channel (all networks)"),
("training-test", "")
] +
[
(f"live-{broadcast_channel}", "")
for broadcast_channel in ["test", "severe", "government"]
] +
[
(f"live-{broadcast_channel}-{provider}", "")
for broadcast_channel in ["test", "severe", "government"]
for provider in ["ee", "o2", "three", "vodafone"]
],
validators=[DataRequired()]
)