mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-18 16:12:32 -05:00
Extend test cases for every MNO
Seems to be no harm in extending these for every mobile network just to give us slightly better coverage
This commit is contained in:
@@ -107,6 +107,8 @@ def test_send_broadcast_event_does_nothing_if_cbc_proxy_disabled(mocker, notify_
|
||||
@freeze_time('2020-08-01 12:00')
|
||||
@pytest.mark.parametrize('provider,provider_capitalised', [
|
||||
['ee', 'EE'],
|
||||
['three', 'Three'],
|
||||
['o2', 'O2'],
|
||||
['vodafone', 'Vodafone'],
|
||||
])
|
||||
def test_send_broadcast_provider_message_sends_data_correctly(
|
||||
@@ -158,8 +160,14 @@ def test_send_broadcast_provider_message_sends_data_correctly(
|
||||
|
||||
|
||||
@freeze_time('2020-08-01 12:00')
|
||||
@pytest.mark.parametrize('provider,provider_capitalised', [
|
||||
['ee', 'EE'],
|
||||
['three', 'Three'],
|
||||
['o2', 'O2'],
|
||||
['vodafone', 'Vodafone'],
|
||||
])
|
||||
def test_send_broadcast_provider_message_sends_data_correctly_when_broadcast_message_has_no_template(
|
||||
mocker, sample_service,
|
||||
mocker, sample_service, provider, provider_capitalised
|
||||
):
|
||||
broadcast_message = create_broadcast_message(
|
||||
service=sample_service,
|
||||
@@ -177,12 +185,12 @@ def test_send_broadcast_provider_message_sends_data_correctly_when_broadcast_mes
|
||||
event = create_broadcast_event(broadcast_message)
|
||||
|
||||
mock_create_broadcast = mocker.patch(
|
||||
f'app.clients.cbc_proxy.CBCProxyEE.create_and_send_broadcast',
|
||||
f'app.clients.cbc_proxy.CBCProxy{provider_capitalised}.create_and_send_broadcast',
|
||||
)
|
||||
|
||||
send_broadcast_provider_message(provider='ee', broadcast_event_id=str(event.id))
|
||||
send_broadcast_provider_message(provider=provider, broadcast_event_id=str(event.id))
|
||||
|
||||
broadcast_provider_message = event.get_provider_message('ee')
|
||||
broadcast_provider_message = event.get_provider_message(provider)
|
||||
|
||||
mock_create_broadcast.assert_called_once_with(
|
||||
identifier=str(broadcast_provider_message.id),
|
||||
@@ -198,6 +206,8 @@ def test_send_broadcast_provider_message_sends_data_correctly_when_broadcast_mes
|
||||
|
||||
@pytest.mark.parametrize('provider,provider_capitalised', [
|
||||
['ee', 'EE'],
|
||||
['three', 'Three'],
|
||||
['o2', 'O2'],
|
||||
['vodafone', 'Vodafone'],
|
||||
])
|
||||
def test_send_broadcast_provider_message_sends_update_with_references(
|
||||
@@ -248,6 +258,8 @@ def test_send_broadcast_provider_message_sends_update_with_references(
|
||||
|
||||
@pytest.mark.parametrize('provider,provider_capitalised', [
|
||||
['ee', 'EE'],
|
||||
['three', 'Three'],
|
||||
['o2', 'O2'],
|
||||
['vodafone', 'Vodafone'],
|
||||
])
|
||||
def test_send_broadcast_provider_message_sends_cancel_with_references(
|
||||
@@ -293,7 +305,13 @@ def test_send_broadcast_provider_message_sends_cancel_with_references(
|
||||
)
|
||||
|
||||
|
||||
def test_send_broadcast_provider_message_errors(mocker, sample_service):
|
||||
@pytest.mark.parametrize("provider,provider_capitalised", [
|
||||
['ee', 'EE'],
|
||||
['three', 'Three'],
|
||||
['o2', 'O2'],
|
||||
['vodafone', 'Vodafone'],
|
||||
])
|
||||
def test_send_broadcast_provider_message_errors(mocker, sample_service, provider, provider_capitalised):
|
||||
template = create_template(sample_service, BROADCAST_TYPE)
|
||||
|
||||
broadcast_message = create_broadcast_message(
|
||||
@@ -310,12 +328,12 @@ def test_send_broadcast_provider_message_errors(mocker, sample_service):
|
||||
event = create_broadcast_event(broadcast_message)
|
||||
|
||||
mock_create_broadcast = mocker.patch(
|
||||
'app.clients.cbc_proxy.CBCProxyEE.create_and_send_broadcast',
|
||||
f'app.clients.cbc_proxy.CBCProxy{provider_capitalised}.create_and_send_broadcast',
|
||||
side_effect=Exception('oh no'),
|
||||
)
|
||||
|
||||
with pytest.raises(Exception) as ex:
|
||||
send_broadcast_provider_message(provider='ee', broadcast_event_id=str(event.id))
|
||||
send_broadcast_provider_message(provider=provider, broadcast_event_id=str(event.id))
|
||||
|
||||
assert ex.match('oh no')
|
||||
|
||||
@@ -338,8 +356,10 @@ def test_send_broadcast_provider_message_errors(mocker, sample_service):
|
||||
|
||||
|
||||
@pytest.mark.parametrize("provider,provider_capitalised", [
|
||||
["ee", "EE"],
|
||||
["vodafone", "Vodafone"]
|
||||
['ee', 'EE'],
|
||||
['three', 'Three'],
|
||||
['o2', 'O2'],
|
||||
['vodafone', 'Vodafone'],
|
||||
])
|
||||
def test_trigger_link_tests_invokes_cbc_proxy_client(
|
||||
mocker, provider, provider_capitalised
|
||||
|
||||
Reference in New Issue
Block a user