From fe7d894420a5cf3b1f2eec572b11a4e461e9917b Mon Sep 17 00:00:00 2001 From: Nicholas Staples Date: Mon, 6 Jun 2016 09:49:51 +0100 Subject: [PATCH] Replaced mmg from number and firetext from number with single from number. Fix merge mistake. Fix tests from merge. Update config to include correct staging and live names. --- README.md | 3 +-- app/clients/sms/firetext.py | 2 +- app/clients/sms/mmg.py | 2 +- config.py | 4 +--- config_live.py | 2 +- config_staging.py | 2 +- environment_test.sh | 4 +--- tests/app/conftest.py | 4 ++-- 8 files changed, 9 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 8f1f8cdf5..850ffa577 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,6 @@ export ADMIN_CLIENT_USER_NAME='dev-notify-admin' export AWS_REGION='eu-west-1' export DANGEROUS_SALT='dev-notify-salt' export FIRETEXT_API_KEY=[contact team member for api key] -export FIRETEXT_NUMBER="Firetext" export INVITATION_EMAIL_FROM='invites@notifications.service.gov.uk' export INVITATION_EXPIRATION_DAYS=2 export NOTIFY_EMAIL_DOMAIN='notify.works' @@ -41,11 +40,11 @@ export TWILIO_ACCOUNT_SID=[contact team member for account sid] export TWILIO_AUTH_TOKEN=[contact team member for auth token] export VERIFY_CODE_FROM_EMAIL_ADDRESS='no-reply@notify.works' export MMG_API_KEY=mmg=secret-key -export MMG_FROM_NUMBER="MMG export STATSD_ENABLED=True export STATSD_HOST="localhost" export STATSD_PORT=1000 export STATSD_PREFIX="stats-prefix" +export FROM_NUMBER='from_number' "> environment.sh ``` diff --git a/app/clients/sms/firetext.py b/app/clients/sms/firetext.py index 2dfba89f0..16bbcf047 100644 --- a/app/clients/sms/firetext.py +++ b/app/clients/sms/firetext.py @@ -60,7 +60,7 @@ class FiretextClient(SmsClient): super(SmsClient, self).__init__(*args, **kwargs) self.current_app = current_app self.api_key = current_app.config.get('FIRETEXT_API_KEY') - self.from_number = current_app.config.get('FIRETEXT_NUMBER') + self.from_number = current_app.config.get('FROM_NUMBER') self.name = 'firetext' self.statsd_client = statsd_client diff --git a/app/clients/sms/mmg.py b/app/clients/sms/mmg.py index 5d4698ba8..8118ec4fd 100644 --- a/app/clients/sms/mmg.py +++ b/app/clients/sms/mmg.py @@ -60,7 +60,7 @@ class MMGClient(SmsClient): super(SmsClient, self).__init__(*args, **kwargs) self.current_app = current_app self.api_key = current_app.config.get('MMG_API_KEY') - self.from_number = current_app.config.get('MMG_FROM_NUMBER') + self.from_number = current_app.config.get('FROM_NUMBER') self.name = 'mmg' self.statsd_client = statsd_client diff --git a/config.py b/config.py index 69b0e6694..c83213e41 100644 --- a/config.py +++ b/config.py @@ -18,7 +18,6 @@ class Config(object): NOTIFY_JOB_QUEUE = os.environ['NOTIFY_JOB_QUEUE'] # Notification Queue names are a combination of a prefix plus a name NOTIFICATION_QUEUE_PREFIX = os.environ['NOTIFICATION_QUEUE_PREFIX'] - MMG_FROM_NUMBER = os.environ['MMG_FROM_NUMBER'] SECRET_KEY = os.environ['SECRET_KEY'] SQLALCHEMY_COMMIT_ON_TEARDOWN = False SQLALCHEMY_DATABASE_URI = os.environ['SQLALCHEMY_DATABASE_URI'] @@ -86,13 +85,12 @@ class Config(object): ] TWILIO_ACCOUNT_SID = os.getenv('TWILIO_ACCOUNT_SID') TWILIO_AUTH_TOKEN = os.getenv('TWILIO_AUTH_TOKEN') - TWILIO_NUMBER = os.getenv('TWILIO_NUMBER') - FIRETEXT_NUMBER = os.getenv('FIRETEXT_NUMBER') FIRETEXT_API_KEY = os.getenv("FIRETEXT_API_KEY") LOADTESTING_NUMBER = os.getenv('LOADTESTING_NUMBER') LOADTESTING_API_KEY = os.getenv("LOADTESTING_API_KEY") CSV_UPLOAD_BUCKET_NAME = 'local-notifications-csv-upload' NOTIFICATIONS_ALERT = 5 # five mins + FROM_NUMBER = os.getenv('FROM_NUMBER') STATSD_ENABLED = False STATSD_HOST = "localhost" diff --git a/config_live.py b/config_live.py index 35e53470b..5a5d1c973 100644 --- a/config_live.py +++ b/config_live.py @@ -14,7 +14,6 @@ class Live(Config): VERIFY_CODE_FROM_EMAIL_ADDRESS = os.environ['LIVE_VERIFY_CODE_FROM_EMAIL_ADDRESS'] NOTIFY_EMAIL_DOMAIN = os.environ['LIVE_NOTIFY_EMAIL_DOMAIN'] FIRETEXT_API_KEY = os.getenv("LIVE_FIRETEXT_API_KEY") - FIRETEXT_NUMBER = os.getenv("LIVE_FIRETEXT_NUMBER") TWILIO_AUTH_TOKEN = os.getenv('LIVE_TWILIO_AUTH_TOKEN') MMG_API_KEY = os.environ['LIVE_MMG_API_KEY'] CSV_UPLOAD_BUCKET_NAME = 'live-notifications-csv-upload' @@ -22,6 +21,7 @@ class Live(Config): STATSD_HOST = os.getenv('LIVE_STATSD_HOST') STATSD_PORT = os.getenv('LIVE_STATSD_PORT') STATSD_PREFIX = os.getenv('LIVE_STATSD_PREFIX') + FROM_NUMBER = os.getenv('LIVE_FROM_NUMBER') BROKER_TRANSPORT_OPTIONS = { 'region': 'eu-west-1', diff --git a/config_staging.py b/config_staging.py index 8deeb1eba..a2b46539b 100644 --- a/config_staging.py +++ b/config_staging.py @@ -14,10 +14,10 @@ class Staging(Config): VERIFY_CODE_FROM_EMAIL_ADDRESS = os.environ['STAGING_VERIFY_CODE_FROM_EMAIL_ADDRESS'] NOTIFY_EMAIL_DOMAIN = os.environ['STAGING_NOTIFY_EMAIL_DOMAIN'] FIRETEXT_API_KEY = os.getenv("STAGING_FIRETEXT_API_KEY") - FIRETEXT_NUMBER = os.getenv("STAGING_FIRETEXT_NUMBER") TWILIO_AUTH_TOKEN = os.getenv('STAGING_TWILIO_AUTH_TOKEN') MMG_API_KEY = os.environ['STAGING_MMG_API_KEY'] CSV_UPLOAD_BUCKET_NAME = 'staging-notifications-csv-upload' + FROM_NUMBER = os.getenv('STAGING_FROM_NUMBER') BROKER_TRANSPORT_OPTIONS = { 'region': 'eu-west-1', diff --git a/environment_test.sh b/environment_test.sh index 7c99e5d87..c03892e9e 100644 --- a/environment_test.sh +++ b/environment_test.sh @@ -14,12 +14,9 @@ export SQLALCHEMY_DATABASE_URI='postgresql://localhost/test_notification_api' export VERIFY_CODE_FROM_EMAIL_ADDRESS='no-reply@notify.works' export TWILIO_ACCOUNT_SID="test" export TWILIO_AUTH_TOKEN="test" -export TWILIO_NUMBER="test" export FIRETEXT_API_KEY="Firetext" -export FIRETEXT_NUMBER="Firetext" export NOTIFY_EMAIL_DOMAIN="test.notify.com" export MMG_API_KEY='mmg-secret-key' -export MMG_FROM_NUMBER='test' export LOADTESTING_API_KEY="loadtesting" export LOADTESTING_NUMBER="loadtesting" export STATSD_ENABLED=True @@ -27,3 +24,4 @@ export STATSD_HOST="localhost" export STATSD_PORT=1000 export STATSD_PREFIX="stats-prefix" export API_HOST_NAME="http://localhost:6011" +export FROM_NUMBER='from_number' diff --git a/tests/app/conftest.py b/tests/app/conftest.py index 8dc6cae4b..28eeb2e19 100644 --- a/tests/app/conftest.py +++ b/tests/app/conftest.py @@ -547,7 +547,7 @@ def mock_firetext_client(mocker, statsd_client=None): statsd_client = statsd_client or mocker.Mock() current_app = mocker.Mock(config={ 'FIRETEXT_API_KEY': 'foo', - 'FIRETEXT_NUMBER': 'bar' + 'FROM_NUMBER': 'bar' }) client.init_app(current_app, statsd_client) return client @@ -559,7 +559,7 @@ def mock_mmg_client(mocker, statsd_client=None): statsd_client = statsd_client or mocker.Mock()() current_app = mocker.Mock(config={ 'MMG_API_KEY': 'foo', - 'MMG_FROM_NUMBER': 'bar' + 'FROM_NUMBER': 'bar' }) client.init_app(current_app, statsd_client) return client