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:
Ken Tsang
2018-01-22 10:18:11 +00:00
parent b1cbe9db86
commit 3355a29d01
2 changed files with 21 additions and 6 deletions

View File

@@ -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'