mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-03 01:41:05 -05:00
Merge pull request #1004 from alphagov/firetext-inbound-sms
Firetext inbound sms
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
from flask import Blueprint
|
from flask import Blueprint
|
||||||
from flask import current_app
|
from flask import current_app, jsonify
|
||||||
from flask import request
|
from flask import request
|
||||||
|
|
||||||
from app.errors import register_errors
|
from app.errors import register_errors
|
||||||
@@ -15,3 +15,13 @@ def receive_mmg_sms():
|
|||||||
current_app.logger.info("Recieve notification form data: {}".format(post_data))
|
current_app.logger.info("Recieve notification form data: {}".format(post_data))
|
||||||
|
|
||||||
return "RECEIVED"
|
return "RECEIVED"
|
||||||
|
|
||||||
|
|
||||||
|
@receive_notifications_blueprint.route('/notifications/sms/receive/firetext', methods=['POST'])
|
||||||
|
def receive_firetext_sms():
|
||||||
|
post_data = request.form
|
||||||
|
current_app.logger.info("Received Firetext notification form data: {}".format(post_data))
|
||||||
|
|
||||||
|
return jsonify({
|
||||||
|
"status": "ok"
|
||||||
|
}), 200
|
||||||
|
|||||||
@@ -16,3 +16,17 @@ def test_receive_notification_returns_received_to_mmg(client):
|
|||||||
|
|
||||||
assert response.status_code == 200
|
assert response.status_code == 200
|
||||||
assert response.get_data(as_text=True) == 'RECEIVED'
|
assert response.get_data(as_text=True) == 'RECEIVED'
|
||||||
|
|
||||||
|
|
||||||
|
def test_receive_notification_returns_received_to_firetext(client):
|
||||||
|
data = "source=07999999999&destination=07111111111&message=this is a message&time=2017-01-01 12:00:00"
|
||||||
|
|
||||||
|
response = client.post(
|
||||||
|
path='/notifications/sms/receive/firetext',
|
||||||
|
data=data,
|
||||||
|
headers=[('Content-Type', 'application/x-www-form-urlencoded')])
|
||||||
|
|
||||||
|
assert response.status_code == 200
|
||||||
|
result = json.loads(response.get_data(as_text=True))
|
||||||
|
|
||||||
|
assert result['status'] == 'ok'
|
||||||
|
|||||||
Reference in New Issue
Block a user