mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-02 09:26:08 -05:00
- 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:
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user