mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-01 07:35:34 -05:00
Move ID generation into link test method
Unlike the other IDs which are stored in the DB, this isn't relevant for the Celery task as it invokes a link test. Moving it into the proxy client will also enable us to generate a second ID in the next commits, where we start doing a link test for the failover lambda.
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
import uuid
|
||||
from datetime import datetime
|
||||
|
||||
from flask import current_app
|
||||
@@ -250,5 +249,4 @@ def send_broadcast_provider_message(self, broadcast_event_id, provider):
|
||||
|
||||
@notify_celery.task(name='trigger-link-test')
|
||||
def trigger_link_test(provider):
|
||||
identifier = str(uuid.uuid4())
|
||||
cbc_proxy_client.get_proxy(provider).send_link_test(identifier)
|
||||
cbc_proxy_client.get_proxy(provider).send_link_tests()
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import json
|
||||
import uuid
|
||||
from abc import ABC, abstractmethod
|
||||
|
||||
import boto3
|
||||
@@ -77,11 +78,11 @@ class CBCProxyClientBase(ABC):
|
||||
def __init__(self, lambda_client):
|
||||
self._lambda_client = lambda_client
|
||||
|
||||
def send_link_test(
|
||||
self,
|
||||
identifier,
|
||||
):
|
||||
pass
|
||||
def send_link_tests(self):
|
||||
self._send_link_test(self.lambda_name)
|
||||
self._send_link_test(self.failover_lambda_name)
|
||||
|
||||
def _send_link_test(self): pass
|
||||
|
||||
def create_and_send_broadcast(
|
||||
self, identifier, headline, description, areas, sent, expires, channel, message_number=None
|
||||
@@ -159,9 +160,9 @@ class CBCProxyOne2ManyClient(CBCProxyClientBase):
|
||||
LANGUAGE_ENGLISH = 'en-GB'
|
||||
LANGUAGE_WELSH = 'cy-GB'
|
||||
|
||||
def send_link_test(
|
||||
def _send_link_test(
|
||||
self,
|
||||
identifier,
|
||||
lambda_name,
|
||||
):
|
||||
"""
|
||||
link test - open up a connection to a specific provider, and send them an xml payload with a <msgType> of
|
||||
@@ -169,11 +170,11 @@ class CBCProxyOne2ManyClient(CBCProxyClientBase):
|
||||
"""
|
||||
payload = {
|
||||
'message_type': 'test',
|
||||
'identifier': identifier,
|
||||
'identifier': str(uuid.uuid4()),
|
||||
'message_format': 'cap'
|
||||
}
|
||||
|
||||
self._invoke_lambda(lambda_name=self.lambda_name, payload=payload)
|
||||
self._invoke_lambda(lambda_name=lambda_name, payload=payload)
|
||||
|
||||
def create_and_send_broadcast(
|
||||
self, identifier, headline, description, areas, sent, expires, channel, message_number=None
|
||||
@@ -234,9 +235,9 @@ class CBCProxyVodafone(CBCProxyClientBase):
|
||||
LANGUAGE_ENGLISH = 'English'
|
||||
LANGUAGE_WELSH = 'Welsh'
|
||||
|
||||
def send_link_test(
|
||||
def _send_link_test(
|
||||
self,
|
||||
identifier,
|
||||
lambda_name,
|
||||
):
|
||||
"""
|
||||
link test - open up a connection to a specific provider, and send them an xml payload with a <msgType> of
|
||||
@@ -249,12 +250,12 @@ class CBCProxyVodafone(CBCProxyClientBase):
|
||||
|
||||
payload = {
|
||||
'message_type': 'test',
|
||||
'identifier': identifier,
|
||||
'identifier': str(uuid.uuid4()),
|
||||
'message_number': formatted_seq_number,
|
||||
'message_format': 'ibag'
|
||||
}
|
||||
|
||||
self._invoke_lambda(lambda_name=self.lambda_name, payload=payload)
|
||||
self._invoke_lambda(lambda_name=lambda_name, payload=payload)
|
||||
|
||||
def create_and_send_broadcast(
|
||||
self, identifier, message_number, headline, description, areas, sent, expires, channel
|
||||
|
||||
Reference in New Issue
Block a user