mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-01 23:55:58 -05:00
Allow CBC proxy client to take channel
This moves the hardcoding to test channels one step up to where we call `create_and_send_broadcast` We can then after this, start to differ whether we give it the 'test' or 'severe' channel based on the services channel setting.
This commit is contained in:
@@ -153,6 +153,7 @@ def test_send_broadcast_provider_message_sends_data_correctly(
|
||||
}],
|
||||
sent=event.sent_at_as_cap_datetime_string,
|
||||
expires=event.transmitted_finishes_at_as_cap_datetime_string,
|
||||
channel="test",
|
||||
)
|
||||
|
||||
|
||||
@@ -191,6 +192,7 @@ def test_send_broadcast_provider_message_sends_data_correctly_when_broadcast_mes
|
||||
areas=mocker.ANY,
|
||||
sent=mocker.ANY,
|
||||
expires=mocker.ANY,
|
||||
channel="test"
|
||||
)
|
||||
|
||||
|
||||
@@ -240,6 +242,7 @@ def test_send_broadcast_provider_message_sends_update_with_references(
|
||||
],
|
||||
sent=update_event.sent_at_as_cap_datetime_string,
|
||||
expires=update_event.transmitted_finishes_at_as_cap_datetime_string,
|
||||
channel="test"
|
||||
)
|
||||
|
||||
|
||||
@@ -330,6 +333,7 @@ def test_send_broadcast_provider_message_errors(mocker, sample_service):
|
||||
}],
|
||||
sent=event.sent_at_as_cap_datetime_string,
|
||||
expires=event.transmitted_finishes_at_as_cap_datetime_string,
|
||||
channel="test"
|
||||
)
|
||||
|
||||
|
||||
|
||||
@@ -110,7 +110,9 @@ def test_cbc_proxy_one_2_many_create_and_send_invokes_function(
|
||||
headline=headline,
|
||||
description=description,
|
||||
areas=EXAMPLE_AREAS,
|
||||
sent=sent, expires=expires,
|
||||
sent=sent,
|
||||
expires=expires,
|
||||
channel="severe",
|
||||
)
|
||||
|
||||
ld_client_mock.invoke.assert_called_once_with(
|
||||
@@ -133,7 +135,7 @@ def test_cbc_proxy_one_2_many_create_and_send_invokes_function(
|
||||
assert payload['sent'] == sent
|
||||
assert payload['expires'] == expires
|
||||
assert payload['language'] == expected_language
|
||||
assert payload['channel'] == 'test'
|
||||
assert payload['channel'] == 'severe'
|
||||
|
||||
|
||||
@pytest.mark.parametrize('cbc', ['ee', 'three', 'o2'])
|
||||
@@ -227,7 +229,9 @@ def test_cbc_proxy_vodafone_create_and_send_invokes_function(
|
||||
headline=headline,
|
||||
description=description,
|
||||
areas=EXAMPLE_AREAS,
|
||||
sent=sent, expires=expires,
|
||||
sent=sent,
|
||||
expires=expires,
|
||||
channel="test",
|
||||
)
|
||||
|
||||
ld_client_mock.invoke.assert_called_once_with(
|
||||
@@ -348,6 +352,7 @@ def test_cbc_proxy_will_failover_to_second_lambda_if_function_error(
|
||||
areas=EXAMPLE_AREAS,
|
||||
sent='a-passed-through-sent-value',
|
||||
expires='a-passed-through-expires-value',
|
||||
channel="severe",
|
||||
)
|
||||
|
||||
assert ld_client_mock.invoke.call_args_list == [
|
||||
@@ -395,6 +400,7 @@ def test_cbc_proxy_will_failover_to_second_lambda_if_invoke_error(
|
||||
areas=EXAMPLE_AREAS,
|
||||
sent='a-passed-through-sent-value',
|
||||
expires='a-passed-through-expires-value',
|
||||
channel="test",
|
||||
)
|
||||
|
||||
assert ld_client_mock.invoke.call_args_list == [
|
||||
@@ -436,6 +442,7 @@ def test_cbc_proxy_create_and_send_tries_failover_lambda_on_invoke_error_and_rai
|
||||
areas=EXAMPLE_AREAS,
|
||||
sent='a-passed-through-sent-value',
|
||||
expires='a-passed-through-expires-value',
|
||||
channel="test",
|
||||
)
|
||||
|
||||
assert e.match(f'Lambda failed for both {cbc}-1-proxy and {cbc}-2-proxy')
|
||||
@@ -484,6 +491,7 @@ def test_cbc_proxy_create_and_send_tries_failover_lambda_on_function_error_and_r
|
||||
areas=EXAMPLE_AREAS,
|
||||
sent='a-passed-through-sent-value',
|
||||
expires='a-passed-through-expires-value',
|
||||
channel="severe",
|
||||
)
|
||||
|
||||
assert e.match(f'Lambda failed for both {cbc}-1-proxy and {cbc}-2-proxy')
|
||||
|
||||
Reference in New Issue
Block a user