mirror of
https://github.com/GSA/notifications-api.git
synced 2026-08-11 09:27:56 -04:00
make sure template serialises letter subjects
This commit is contained in:
@@ -464,7 +464,7 @@ class Template(db.Model):
|
||||
"created_by": self.created_by.email_address,
|
||||
"version": self.version,
|
||||
"body": self.content,
|
||||
"subject": self.subject if self.template_type == EMAIL_TYPE else None
|
||||
"subject": self.subject if self.template_type != SMS_TYPE else None
|
||||
}
|
||||
|
||||
return serialized
|
||||
|
||||
@@ -203,3 +203,18 @@ def test_letter_notification_serializes_with_address(client, sample_letter_notif
|
||||
assert res['line_5'] is None
|
||||
assert res['line_6'] is None
|
||||
assert res['postcode'] == 'SW1 1AA'
|
||||
|
||||
|
||||
def test_sms_notification_serializes_without_subject(client, sample_template):
|
||||
res = sample_template.serialize()
|
||||
assert res['subject'] is None
|
||||
|
||||
|
||||
def test_email_notification_serializes_with_subject(client, sample_email_template):
|
||||
res = sample_email_template.serialize()
|
||||
assert res['subject'] == 'Email Subject'
|
||||
|
||||
|
||||
def test_letter_notification_serializes_with_subject(client, sample_letter_template):
|
||||
res = sample_letter_template.serialize()
|
||||
assert res['subject'] == 'Template Subject'
|
||||
|
||||
Reference in New Issue
Block a user