Refactor postcode validation to use utils

We don’t need to reformat the postcode here once template preview takes
care of it when rendering the PDF.

It’s better (and less code) to store what people give us, so we give
them back the same thing.
This commit is contained in:
Chris Hill-Scott
2020-04-03 13:13:57 +01:00
parent e2985161bb
commit 264fbed04e
6 changed files with 14 additions and 23 deletions

View File

@@ -139,7 +139,9 @@ def test_post_letter_notification_formats_postcode(
assert validate(resp_json, post_letter_response) == resp_json
notification = Notification.query.one()
assert notification.personalisation["postcode"] == "SW1 1AA"
# We store what the client gives us, and only reformat it when
# generating the PDF
assert notification.personalisation["postcode"] == ' Sw1 1aa '
def test_post_letter_notification_throws_error_for_bad_postcode(