From 50365118030478490cb8d73e289e4ed5eac33ece Mon Sep 17 00:00:00 2001 From: Pea Tyczynska Date: Thu, 2 Apr 2020 11:23:17 +0100 Subject: [PATCH 1/3] Handle postcode validation --- app/utils.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/app/utils.py b/app/utils.py index 0fae647f0..ba75cbd38 100644 --- a/app/utils.py +++ b/app/utils.py @@ -649,6 +649,23 @@ LETTER_VALIDATION_MESSAGES = { 'letter specification' '.' ), + }, + 'not-a-real-uk-postcode': { + 'title': 'Postcode in the address block is not a real UK postcode', + 'detail': ( + 'You need to give us a real UK postcode.
' + 'Files must meet our ' + '' + 'letter specification' + '.' + ), + 'summary': ( + 'Validation failed because the postcode is not a real UK postcode.
' + 'Files must meet our ' + '' + 'letter specification' + '.' + ), } } From 0a7fa1f79981f8fd16b79b8885501408d4f901d9 Mon Sep 17 00:00:00 2001 From: Pea Tyczynska Date: Thu, 2 Apr 2020 11:45:57 +0100 Subject: [PATCH 2/3] Update content for postcode valdiation handling for precompiled --- app/utils.py | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/app/utils.py b/app/utils.py index ba75cbd38..ee185f718 100644 --- a/app/utils.py +++ b/app/utils.py @@ -651,20 +651,12 @@ LETTER_VALIDATION_MESSAGES = { ), }, 'not-a-real-uk-postcode': { - 'title': 'Postcode in the address block is not a real UK postcode', + 'title': 'There’s a problem with the address on this letter', 'detail': ( - 'You need to give us a real UK postcode.
' - 'Files must meet our ' - '' - 'letter specification' - '.' + 'The last line of the address must be a real UK postcode.' ), 'summary': ( - 'Validation failed because the postcode is not a real UK postcode.
' - 'Files must meet our ' - '' - 'letter specification' - '.' + 'Validation failed because the last line of the address is not a real UK postcode.' ), } } From 86ab0a6a0fd55a00bc7012b05bd352dee1ccf660 Mon Sep 17 00:00:00 2001 From: Pea Tyczynska Date: Thu, 2 Apr 2020 13:39:40 +0100 Subject: [PATCH 3/3] Add missing test cases for precompiled validation messages --- app/utils.py | 2 +- tests/app/test_utils.py | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/app/utils.py b/app/utils.py index ee185f718..8c1d737af 100644 --- a/app/utils.py +++ b/app/utils.py @@ -651,7 +651,7 @@ LETTER_VALIDATION_MESSAGES = { ), }, 'not-a-real-uk-postcode': { - 'title': 'There’s a problem with the address on this letter', + 'title': 'There’s a problem with the address for this letter', 'detail': ( 'The last line of the address must be a real UK postcode.' ), diff --git a/tests/app/test_utils.py b/tests/app/test_utils.py index fd0b991f3..58c1a3079 100644 --- a/tests/app/test_utils.py +++ b/tests/app/test_utils.py @@ -483,6 +483,30 @@ def test_get_letter_validation_error_for_unknown_error(): 'Save a new copy of your file and try again.' ), ), + ( + 'address-is-empty', + None, + 'The address block is empty', + ( + 'You need to add a recipient address.' + 'Files must meet our letter specification.' + ), + ( + 'Validation failed because the address block is empty.' + 'Files must meet our letter specification.' + ), + ), + ( + 'not-a-real-uk-postcode', + None, + 'There’s a problem with the address for this letter', + ( + 'The last line of the address must be a real UK postcode.' + ), + ( + 'Validation failed because the last line of the address is not a real UK postcode.' + ), + ), ]) def test_get_letter_validation_error_for_known_errors( client_request,