mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-23 08:51:30 -05:00
client: cbc_proxy passes through sent/expires
A BroadcastEvent knows when an event was sent and should expire We pass through these values directly to the CBC Proxy, because BroadcastEvent knows how they should be formatted Signed-off-by: Toby Lorne <toby.lornewelch-richards@digital.cabinet-office.gov.uk>
This commit is contained in:
@@ -41,6 +41,8 @@ def test_create_broadcast_event_sends_data_correctly(mocker, sample_service):
|
||||
[-4.53, 55.72], [-3.88, 55.72], [-3.88, 55.96], [-4.53, 55.96],
|
||||
],
|
||||
}],
|
||||
sent=event.sent_at_as_cap_datetime_string,
|
||||
expires=event.transmitted_finishes_at_as_cap_datetime_string,
|
||||
)
|
||||
|
||||
|
||||
@@ -75,6 +77,8 @@ def test_update_broadcast_event_sends_references(mocker, sample_service):
|
||||
"polygon": [[50.12, 1.2], [50.13, 1.2], [50.14, 1.21]],
|
||||
}],
|
||||
references=[alert_event.reference],
|
||||
sent=update_event.sent_at_as_cap_datetime_string,
|
||||
expires=update_event.transmitted_finishes_at_as_cap_datetime_string,
|
||||
)
|
||||
|
||||
|
||||
@@ -110,6 +114,8 @@ def test_cancel_broadcast_event_sends_references(mocker, sample_service):
|
||||
"polygon": [[50.12, 1.2], [50.13, 1.2], [50.14, 1.21]],
|
||||
}],
|
||||
references=[alert_event.reference, update_event.reference],
|
||||
sent=cancel_event.sent_at_as_cap_datetime_string,
|
||||
expires=cancel_event.transmitted_finishes_at_as_cap_datetime_string,
|
||||
)
|
||||
|
||||
|
||||
@@ -150,4 +156,6 @@ def test_send_broadcast_event_errors(mocker, sample_service):
|
||||
[50.14, 1.21],
|
||||
],
|
||||
}],
|
||||
sent=event.sent_at_as_cap_datetime_string,
|
||||
expires=event.transmitted_finishes_at_as_cap_datetime_string,
|
||||
)
|
||||
|
||||
@@ -34,6 +34,9 @@ def test_cbc_proxy_create_and_send_invokes_function(mocker, cbc_proxy):
|
||||
headline = 'my-headline'
|
||||
description = 'my-description'
|
||||
|
||||
sent = 'a-passed-through-sent-value'
|
||||
expires = 'a-passed-through-expires-value'
|
||||
|
||||
# a single area which is a square including london
|
||||
areas = [{
|
||||
'description': 'london',
|
||||
@@ -61,6 +64,7 @@ def test_cbc_proxy_create_and_send_invokes_function(mocker, cbc_proxy):
|
||||
headline=headline,
|
||||
description=description,
|
||||
areas=areas,
|
||||
sent=sent, expires=expires,
|
||||
)
|
||||
|
||||
ld_client_mock.invoke.assert_called_once_with(
|
||||
@@ -78,6 +82,8 @@ def test_cbc_proxy_create_and_send_invokes_function(mocker, cbc_proxy):
|
||||
assert payload['headline'] == headline
|
||||
assert payload['description'] == description
|
||||
assert payload['areas'] == areas
|
||||
assert payload['sent'] == sent
|
||||
assert payload['expires'] == expires
|
||||
|
||||
|
||||
def test_cbc_proxy_create_and_send_handles_invoke_error(mocker, cbc_proxy):
|
||||
@@ -85,6 +91,9 @@ def test_cbc_proxy_create_and_send_handles_invoke_error(mocker, cbc_proxy):
|
||||
headline = 'my-headline'
|
||||
description = 'my-description'
|
||||
|
||||
sent = 'a-passed-through-sent-value'
|
||||
expires = 'a-passed-through-expires-value'
|
||||
|
||||
# a single area which is a square including london
|
||||
areas = [{
|
||||
'description': 'london',
|
||||
@@ -113,6 +122,7 @@ def test_cbc_proxy_create_and_send_handles_invoke_error(mocker, cbc_proxy):
|
||||
headline=headline,
|
||||
description=description,
|
||||
areas=areas,
|
||||
sent=sent, expires=expires,
|
||||
)
|
||||
|
||||
assert e.match('Could not invoke lambda')
|
||||
@@ -129,6 +139,9 @@ def test_cbc_proxy_create_and_send_handles_function_error(mocker, cbc_proxy):
|
||||
headline = 'my-headline'
|
||||
description = 'my-description'
|
||||
|
||||
sent = 'a-passed-through-sent-value'
|
||||
expires = 'a-passed-through-expires-value'
|
||||
|
||||
# a single area which is a square including london
|
||||
areas = [{
|
||||
'description': 'london',
|
||||
@@ -158,6 +171,7 @@ def test_cbc_proxy_create_and_send_handles_function_error(mocker, cbc_proxy):
|
||||
headline=headline,
|
||||
description=description,
|
||||
areas=areas,
|
||||
sent=sent, expires=expires,
|
||||
)
|
||||
|
||||
assert e.match('Function exited with unhandled exception')
|
||||
|
||||
Reference in New Issue
Block a user