mirror of
https://github.com/GSA/notifications-api.git
synced 2026-08-23 15:56:45 -04:00
Make send sms test use a template with a newline
This commit is contained in:
@@ -101,7 +101,7 @@ def test_should_send_personalised_template_to_correct_sms_provider_and_persist(
|
|||||||
|
|
||||||
mmg_client.send_sms.assert_called_once_with(
|
mmg_client.send_sms.assert_called_once_with(
|
||||||
to=format_phone_number(validate_phone_number("+447234123123")),
|
to=format_phone_number(validate_phone_number("+447234123123")),
|
||||||
content="Sample service: Hello Jo",
|
content="Sample service: Hello Jo\nYour thing is due soon",
|
||||||
reference=str(db_notification.id),
|
reference=str(db_notification.id),
|
||||||
sender=None
|
sender=None
|
||||||
)
|
)
|
||||||
@@ -110,7 +110,7 @@ def test_should_send_personalised_template_to_correct_sms_provider_and_persist(
|
|||||||
assert notification.status == 'sending'
|
assert notification.status == 'sending'
|
||||||
assert notification.sent_at <= datetime.utcnow()
|
assert notification.sent_at <= datetime.utcnow()
|
||||||
assert notification.sent_by == 'mmg'
|
assert notification.sent_by == 'mmg'
|
||||||
assert notification.content_char_count == 24
|
assert notification.content_char_count == len("Sample service: Hello Jo\nYour thing is due soon")
|
||||||
assert notification.personalisation == {"name": "Jo"}
|
assert notification.personalisation == {"name": "Jo"}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -185,7 +185,7 @@ def sample_template(notify_db,
|
|||||||
|
|
||||||
@pytest.fixture(scope='function')
|
@pytest.fixture(scope='function')
|
||||||
def sample_template_with_placeholders(notify_db, notify_db_session):
|
def sample_template_with_placeholders(notify_db, notify_db_session):
|
||||||
return sample_template(notify_db, notify_db_session, content="Hello ((name))")
|
return sample_template(notify_db, notify_db_session, content="Hello ((name))\nYour thing is due soon")
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope='function')
|
@pytest.fixture(scope='function')
|
||||||
|
|||||||
@@ -553,7 +553,7 @@ def test_get_notification_by_id_returns_merged_template_content(notify_db,
|
|||||||
|
|
||||||
notification = json.loads(response.get_data(as_text=True))['data']['notification']
|
notification = json.loads(response.get_data(as_text=True))['data']['notification']
|
||||||
assert response.status_code == 200
|
assert response.status_code == 200
|
||||||
assert notification['body'] == 'Hello world'
|
assert notification['body'] == 'Hello world\nYour thing is due soon'
|
||||||
assert 'subject' not in notification
|
assert 'subject' not in notification
|
||||||
|
|
||||||
|
|
||||||
@@ -610,8 +610,8 @@ def test_get_notifications_for_service_returns_merged_template_content(notify_ap
|
|||||||
|
|
||||||
resp = json.loads(response.get_data(as_text=True))
|
resp = json.loads(response.get_data(as_text=True))
|
||||||
assert len(resp['notifications']) == 2
|
assert len(resp['notifications']) == 2
|
||||||
assert resp['notifications'][0]['body'] == 'Hello merged with first'
|
assert resp['notifications'][0]['body'] == 'Hello merged with first\nYour thing is due soon'
|
||||||
assert resp['notifications'][1]['body'] == 'Hello merged with second'
|
assert resp['notifications'][1]['body'] == 'Hello merged with second\nYour thing is due soon'
|
||||||
|
|
||||||
|
|
||||||
def _create_auth_header_from_key(api_key):
|
def _create_auth_header_from_key(api_key):
|
||||||
|
|||||||
Reference in New Issue
Block a user