Enable Inbound sms IP blocking

This commit is contained in:
venusbb
2017-09-26 10:59:09 +01:00
parent c36ced5b56
commit 6a7013fa7a
5 changed files with 117 additions and 182 deletions

View File

@@ -338,7 +338,7 @@ def test_allow_valid_ips(restrict_ip_sms_app):
assert response.status_code == 200
@pytest.mark.xfail(reason='Currently not blocking invalid IPs', strict=True)
# @pytest.mark.xfail(reason='Currently not blocking invalid IPs', strict=True)
def test_reject_invalid_ips(restrict_ip_sms_app):
with pytest.raises(AuthError) as exc_info:
restrict_ip_sms_app.get(
@@ -351,17 +351,17 @@ def test_reject_invalid_ips(restrict_ip_sms_app):
assert exc_info.value.short_message == 'Unknown source IP address from the SMS provider'
@pytest.mark.xfail(reason='Currently not blocking invalid senders', strict=True)
# @pytest.mark.xfail(reason='Currently not blocking invalid senders', strict=True)
def test_illegitimate_ips(restrict_ip_sms_app):
with pytest.raises(AuthError) as exc_info:
restrict_ip_sms_app.get(
path='/',
headers=[
('X-Forwarded-For', '111.111.111.111, 999.999.999.999, 333.333.333.333, 127.0.0.1')
('X-Forwarded-For', '111.111.111.111, 123.123.123.123, 333.333.333.333, 127.0.0.1')
]
)
assert exc_info.value.short_message == 'Unknown IP route not from known SMS provider'
assert exc_info.value.short_message == 'Unknown source IP address from the SMS provider'
def test_allow_valid_ips_bits(restrict_ip_sms_app):