mirror of
https://github.com/GSA/notifications-api.git
synced 2026-09-08 04:38:24 -04:00
clients: cbc_proxy handles lambda invoke response
Signed-off-by: Toby Lorne <toby.lornewelch-richards@digital.cabinet-office.gov.uk>
This commit is contained in:
@@ -52,12 +52,17 @@ class CBCProxyClient:
|
|||||||
'description': description,
|
'description': description,
|
||||||
}), encoding='utf8')
|
}), encoding='utf8')
|
||||||
|
|
||||||
self._ld_client.invoke(
|
result = self._ld_client.invoke(
|
||||||
FunctionName='bt-ee-1-proxy',
|
FunctionName='bt-ee-1-proxy',
|
||||||
InvocationType='RequestResponse',
|
InvocationType='RequestResponse',
|
||||||
Payload=payload_bytes,
|
Payload=payload_bytes,
|
||||||
)
|
)
|
||||||
pass
|
|
||||||
|
if result['StatusCode'] > 299:
|
||||||
|
raise Exception('Could not invoke lambda')
|
||||||
|
|
||||||
|
if 'FunctionError' in result:
|
||||||
|
raise Exception('Function exited with unhandled exception')
|
||||||
|
|
||||||
# We have not implementated updating a broadcast
|
# We have not implementated updating a broadcast
|
||||||
def update_and_send_broadcast(
|
def update_and_send_broadcast(
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ def test_cbc_proxy_ld_client_has_correct_keys(cbc_proxy):
|
|||||||
assert secret == 'cbc-proxy-aws-secret-access-key'
|
assert secret == 'cbc-proxy-aws-secret-access-key'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def test_cbc_proxy_create_and_send_invokes_function(mocker, cbc_proxy):
|
def test_cbc_proxy_create_and_send_invokes_function(mocker, cbc_proxy):
|
||||||
identifier = 'my-identifier'
|
identifier = 'my-identifier'
|
||||||
headline = 'my-headline'
|
headline = 'my-headline'
|
||||||
@@ -40,6 +41,10 @@ def test_cbc_proxy_create_and_send_invokes_function(mocker, cbc_proxy):
|
|||||||
create=True,
|
create=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
ld_client_mock.invoke.return_value = {
|
||||||
|
'StatusCode': 200,
|
||||||
|
}
|
||||||
|
|
||||||
cbc_proxy.create_and_send_broadcast(
|
cbc_proxy.create_and_send_broadcast(
|
||||||
identifier=identifier,
|
identifier=identifier,
|
||||||
headline=headline,
|
headline=headline,
|
||||||
|
|||||||
Reference in New Issue
Block a user