mirror of
https://github.com/GSA/notifications-api.git
synced 2026-01-31 23:26:23 -05:00
Ensure letter personalisation is serialized correctly
The personalisation for letters can take different formats depending on how the letter was generated, for example it can contain either address_line_1 or addressline1. This change ensures that it is always serialized in the same way.
This commit is contained in:
@@ -294,3 +294,16 @@ def test_service_get_default_contact_letter(sample_service):
|
||||
def test_service_get_default_sms_sender(notify_db_session):
|
||||
service = create_service()
|
||||
assert service.get_default_sms_sender() == 'testing'
|
||||
|
||||
|
||||
def test_letter_notification_serializes_correctly(client, sample_letter_notification):
|
||||
sample_letter_notification.personalisation = {
|
||||
'addressline1': 'test',
|
||||
'addressline2': 'London',
|
||||
'postcode': 'N1',
|
||||
}
|
||||
|
||||
json = sample_letter_notification.serialize()
|
||||
assert json['line_1'] == 'test'
|
||||
assert json['line_2'] == 'London'
|
||||
assert json['postcode'] == 'N1'
|
||||
|
||||
Reference in New Issue
Block a user