mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-03 18:01:08 -05:00
Change MMG username to look at env variable
This commit is contained in:
@@ -44,7 +44,7 @@ def mmg_post(client, data, auth=True, password='testkey'):
|
||||
]
|
||||
|
||||
if auth:
|
||||
auth_value = base64.b64encode("notify:{}".format(password).encode('utf-8')).decode('utf-8')
|
||||
auth_value = base64.b64encode("username:{}".format(password).encode('utf-8')).decode('utf-8')
|
||||
headers.append(('Authorization', 'Basic ' + auth_value))
|
||||
|
||||
return client.post(
|
||||
@@ -438,7 +438,15 @@ def test_mmg_inbound_sms_auth(notify_db_session, notify_api, client, mocker, aut
|
||||
service_name='b', inbound_number='07111111111', service_permissions=[EMAIL_TYPE, SMS_TYPE, INBOUND_SMS_TYPE]
|
||||
)
|
||||
|
||||
data = "source=07999999999&destination=07111111111&message=this is a message&time=2017-01-01 12:00:00"
|
||||
data = {
|
||||
"ID": "1234",
|
||||
"MSISDN": "07111111111",
|
||||
"Message": "Some message to notify",
|
||||
"Trigger": "Trigger?",
|
||||
"Number": "testing",
|
||||
"Channel": "SMS",
|
||||
"DateRecieved": "2012-06-27 12:33:00"
|
||||
}
|
||||
|
||||
with set_config(notify_api, 'MMG_INBOUND_SMS_AUTH', keys):
|
||||
response = mmg_post(client, data, auth=bool(auth), password=auth)
|
||||
|
||||
@@ -19,6 +19,7 @@ def notify_config():
|
||||
'allow_ip_inbound_sms': ['111.111.111.111', '100.100.100.100'],
|
||||
'firetext_inbound_sms_auth': ['testkey'],
|
||||
'mmg_inbound_sms_auth': ['testkey'],
|
||||
'mmg_inbound_sms_username': ['username'],
|
||||
'route_secret_key_1': "key_1",
|
||||
'route_secret_key_2': ""
|
||||
}
|
||||
@@ -240,6 +241,13 @@ def test_mmg_inbound_sms_auth_config():
|
||||
assert os.environ['MMG_INBOUND_SMS_AUTH'] == json.dumps(['testkey'])
|
||||
|
||||
|
||||
@pytest.mark.usefixtures('os_environ', 'cloudfoundry_environ')
|
||||
def test_mmg_inbound_sms_username_config():
|
||||
extract_cloudfoundry_config()
|
||||
|
||||
assert os.environ['MMG_INBOUND_SMS_USERNAME'] == json.dumps(['username'])
|
||||
|
||||
|
||||
@pytest.mark.usefixtures('os_environ', 'cloudfoundry_environ')
|
||||
def test_performance_platform_config():
|
||||
extract_cloudfoundry_config()
|
||||
|
||||
Reference in New Issue
Block a user