mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-21 07:51:13 -05:00
Change link test task to trigger both lambda
This modifies the previous "(_)send_link_test" method to trigger a link test for a specific lambda. We then call the method with both the primary and failover lambda in new orchestrator method. Since the _invoke_lambda function doesn't raise exceptions if it fails, there's no need to rescue anything in order to ensure the second link test / invocation runs as well. It doesn't testing for this, since it boils to an absence of code to raise any exception. Note that, like the other parent tests, we only check the new method works with a specific proxy client instance.
This commit is contained in:
@@ -249,4 +249,4 @@ def send_broadcast_provider_message(self, broadcast_event_id, provider):
|
||||
|
||||
@notify_celery.task(name='trigger-link-test')
|
||||
def trigger_link_test(provider):
|
||||
cbc_proxy_client.get_proxy(provider).send_link_tests()
|
||||
cbc_proxy_client.get_proxy(provider).send_link_test()
|
||||
|
||||
@@ -78,11 +78,14 @@ class CBCProxyClientBase(ABC):
|
||||
def __init__(self, lambda_client):
|
||||
self._lambda_client = lambda_client
|
||||
|
||||
def send_link_tests(self):
|
||||
def send_link_test(self):
|
||||
self._send_link_test(self.lambda_name)
|
||||
self._send_link_test(self.failover_lambda_name)
|
||||
|
||||
def _send_link_test(self): pass
|
||||
def _send_link_test(
|
||||
self,
|
||||
lambda_name,
|
||||
): pass
|
||||
|
||||
def create_and_send_broadcast(
|
||||
self, identifier, headline, description, areas, sent, expires, channel, message_number=None
|
||||
|
||||
@@ -82,9 +82,9 @@ def test_cbc_proxy_lambda_client_has_correct_keys(cbc_proxy_ee):
|
||||
assert secret == 'cbc-proxy-aws-secret-access-key'
|
||||
|
||||
|
||||
def test_cbc_proxy_send_link_tests(mocker, cbc_proxy_ee):
|
||||
def test_cbc_proxy_send_link_test(mocker, cbc_proxy_ee):
|
||||
mock_send_link_test = mocker.patch.object(cbc_proxy_ee, '_send_link_test')
|
||||
cbc_proxy_ee.send_link_tests()
|
||||
cbc_proxy_ee.send_link_test()
|
||||
|
||||
mock_send_link_test.assert_any_call(cbc_proxy_ee.lambda_name)
|
||||
mock_send_link_test.assert_any_call(cbc_proxy_ee.failover_lambda_name)
|
||||
|
||||
Reference in New Issue
Block a user