Merge pull request #3350 from alphagov/normalised_to_update

Bug fix: update normalised_to, not just `to` after letter sanitise
This commit is contained in:
David McDonald
2021-10-27 12:12:06 +01:00
committed by GitHub
2 changed files with 2 additions and 0 deletions

View File

@@ -479,6 +479,7 @@ def update_letter_pdf_status(reference, status, billable_units, recipient_addres
update_dict.update({'postage': postage, 'international': True})
if recipient_address:
update_dict['to'] = recipient_address
update_dict['normalised_to'] = ''.join(recipient_address.split()).lower()
return dao_update_notifications_by_reference(
references=[reference],
update_dict=update_dict)[0]

View File

@@ -843,6 +843,7 @@ def test_process_sanitised_letter_with_valid_letter(
assert sample_letter_notification.status == expected_status
assert sample_letter_notification.billable_units == 1
assert sample_letter_notification.to == 'A. User\nThe house on the corner'
assert sample_letter_notification.normalised_to == 'a.userthehouseonthecorner'
assert not [x for x in scan_bucket.objects.all()]
assert not [x for x in template_preview_bucket.objects.all()]