retrieve sms ip whitelist from credentials on paas

This commit is contained in:
venusbb
2017-07-10 17:03:43 +01:00
parent c0af82ebcb
commit 5089a4d53b
5 changed files with 16 additions and 7 deletions

View File

@@ -313,8 +313,8 @@ def __create_token(service_id):
def restrict_ip_sms_app():
app = flask.Flask(__name__)
app.config['TESTING'] = True
app.config['ALLOW_IP_INBOUND_SMS'] = ['134.213.243.188']
app.config['ALLOW_IP_INBOUND_SMS'] = ['111.111.111.111', '100.100.100.100']
# app.config['ALLOW_IP_INBOUND_SMS'] = os.environ['SMS_INBOUND_WHITELIST']
blueprint = flask.Blueprint('restrict_ip_sms_app', __name__)
@blueprint.route('/')
@@ -332,7 +332,7 @@ def test_allow_valid_ips(restrict_ip_sms_app):
response = restrict_ip_sms_app.get(
path='/',
headers=[
('X-Forwarded-For', '134.213.243.188, 222.222.222.222, 127.0.0.1'),
('X-Forwarded-For', '111.111.111.111, 222.222.222.222, 127.0.0.1'),
]
)
@@ -345,7 +345,7 @@ def test_reject_invalid_ips(restrict_ip_sms_app):
restrict_ip_sms_app.get(
path='/',
headers=[
('X-Forwarded-For', '222.222.222.222, 111.111.111.111, 127.0.0.1')
('X-Forwarded-For', '222.222.222.222, 333.333.333.333, 127.0.0.1')
]
)