- Implemented persist_notification and send_notification_to_queue in the process_notifications module

- Not sure I want to create a new classmethod on Notifications to create from v2 request. Will take another look at that.
This commit is contained in:
Rebecca Law
2016-10-27 17:34:54 +01:00
parent c2eecdae36
commit 6e4bad135a
6 changed files with 158 additions and 24 deletions

View File

@@ -3,9 +3,10 @@ from flask import json
from tests import create_authorization_header
def test_post_sms_notification_returns_201(notify_api, sample_template):
def test_post_sms_notification_returns_201(notify_api, sample_template, mocker):
with notify_api.test_request_context():
with notify_api.test_client() as client:
mocked = mocker.patch('app.celery.provider_tasks.deliver_sms.apply_async')
data = {
'phone_number': '+447700900855',
'template_id': str(sample_template.id)
@@ -18,6 +19,12 @@ def test_post_sms_notification_returns_201(notify_api, sample_template):
headers=[('Content-Type', 'application/json'), auth_header])
assert response.status_code == 201
resp_json = json.loads(response.get_data(as_text=True))
assert resp_json['id'] is not None
assert resp_json['reference'] is None
assert resp_json['template']['id'] == str(sample_template.id)
assert resp_json['template']['version'] == sample_template.version
assert mocked.called
def test_post_sms_notification_returns_404_when_template_is_wrong_type(notify_api, sample_email_template):