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:
Toby Lorne
2020-10-28 11:26:38 +00:00
parent 2c29b45c9c
commit dd012d6831
5 changed files with 42 additions and 3 deletions

View File

@@ -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')