Merge branch 'main' into stvnrlly-remove-broadcasts

This commit is contained in:
Steven Reilly
2022-10-25 10:17:49 -04:00
committed by GitHub
39 changed files with 417 additions and 427 deletions

View File

@@ -1,6 +1,3 @@
from celery import current_app
class ClientException(Exception):
'''
Base Exceptions for sending notifications that fail
@@ -38,7 +35,7 @@ class NotificationProviderClients(object):
return self.email_clients.get(name)
def get_client_by_name_and_type(self, name, notification_type):
assert notification_type in ['email', 'sms'] # nosec B101
assert notification_type in ['email', 'sms'] # nosec B101
if notification_type == 'email':
return self.get_email_client(name)

View File

@@ -25,4 +25,4 @@ class SmsClient(Client):
raise NotImplementedError("TODO Need to implement.")
def get_name(self):
raise NotImplementedError("TODO Need to implement.")
raise NotImplementedError("TODO Need to implement.")

View File

@@ -20,7 +20,7 @@ class AwsSnsClient(SmsClient):
self.current_app = current_app
self.statsd_client = statsd_client
self.long_code_regex = re.compile(r"^\+1\d{10}$")
@property
def name(self):
return 'sns'
@@ -86,4 +86,4 @@ class AwsSnsClient(SmsClient):
raise ValueError("No valid numbers found for SMS delivery")
def _send_with_dedicated_phone_number(self, sender):
return sender and re.match(self.long_code_regex, sender)
return sender and re.match(self.long_code_regex, sender)