mirror of
https://github.com/GSA/notifications-api.git
synced 2026-08-20 14:29:25 -04:00
Merge branch 'master' into remove-initial-update-sms-sender
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import pytest
|
||||
|
||||
from freezegun import freeze_time
|
||||
from sqlalchemy.exc import IntegrityError
|
||||
|
||||
from app import encryption
|
||||
from app.models import (
|
||||
@@ -201,8 +202,8 @@ def test_notification_subject_fills_in_placeholders_for_email(sample_email_templ
|
||||
|
||||
|
||||
def test_notification_subject_fills_in_placeholders_for_letter(sample_letter_template):
|
||||
sample_letter_template.subject = '((name))'
|
||||
noti = create_notification(sample_letter_template, personalisation={'name': 'hello'})
|
||||
noti.template.subject = '((name))'
|
||||
assert noti.subject == 'hello'
|
||||
|
||||
|
||||
@@ -238,6 +239,24 @@ def test_letter_notification_serializes_with_subject(client, sample_letter_templ
|
||||
assert res['subject'] == 'Template subject'
|
||||
|
||||
|
||||
def test_notification_references_template_history(client, sample_template):
|
||||
noti = create_notification(sample_template)
|
||||
sample_template.version = 3
|
||||
sample_template.content = 'New template content'
|
||||
|
||||
res = noti.serialize()
|
||||
assert res['template']['version'] == 1
|
||||
|
||||
assert res['body'] == noti.template.content
|
||||
assert noti.template.content != sample_template.content
|
||||
|
||||
|
||||
def test_notification_requires_a_valid_template_version(client, sample_template):
|
||||
sample_template.version = 2
|
||||
with pytest.raises(IntegrityError):
|
||||
create_notification(sample_template)
|
||||
|
||||
|
||||
def test_inbound_number_serializes_with_service(client, notify_db_session):
|
||||
service = create_service()
|
||||
inbound_number = create_inbound_number(number='1', service_id=service.id)
|
||||
|
||||
Reference in New Issue
Block a user