mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-20 23:41:17 -05:00
Make language attributes abstract properties
This will make it impossible to create a new client without at least having to define these properties. Which should get someone thinking about language support…
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import json
|
||||
from abc import ABC, abstractmethod
|
||||
|
||||
import boto3
|
||||
from flask import current_app
|
||||
@@ -49,11 +50,18 @@ class CBCProxyClient:
|
||||
return proxy_classes[provider](self._lambda_client)
|
||||
|
||||
|
||||
class CBCProxyClientBase:
|
||||
class CBCProxyClientBase(ABC):
|
||||
lambda_name = None
|
||||
|
||||
LANGUAGE_ENGLISH = 'en-GB'
|
||||
LANGUAGE_WELSH = 'cy-GB'
|
||||
@property
|
||||
@abstractmethod
|
||||
def LANGUAGE_ENGLISH(self):
|
||||
pass
|
||||
|
||||
@property
|
||||
@abstractmethod
|
||||
def LANGUAGE_WELSH(self):
|
||||
pass
|
||||
|
||||
def __init__(self, lambda_client):
|
||||
self._lambda_client = lambda_client
|
||||
@@ -128,6 +136,9 @@ class CBCProxyCanary(CBCProxyClientBase):
|
||||
"""
|
||||
lambda_name = 'canary'
|
||||
|
||||
LANGUAGE_ENGLISH = None
|
||||
LANGUAGE_WELSH = None
|
||||
|
||||
def send_canary(
|
||||
self,
|
||||
identifier,
|
||||
@@ -138,6 +149,9 @@ class CBCProxyCanary(CBCProxyClientBase):
|
||||
class CBCProxyEE(CBCProxyClientBase):
|
||||
lambda_name = 'bt-ee-1-proxy'
|
||||
|
||||
LANGUAGE_ENGLISH = 'en-GB'
|
||||
LANGUAGE_WELSH = 'cy-GB'
|
||||
|
||||
def send_link_test(
|
||||
self,
|
||||
identifier,
|
||||
|
||||
Reference in New Issue
Block a user