Merge pull request #3397 from alphagov/postcode-validation

Handle postcode validation for precompiled letters
This commit is contained in:
Pea M. Tyczynska
2020-04-02 14:12:39 +01:00
committed by GitHub
2 changed files with 33 additions and 0 deletions

View File

@@ -649,6 +649,15 @@ LETTER_VALIDATION_MESSAGES = {
'letter specification'
'</a>.'
),
},
'not-a-real-uk-postcode': {
'title': 'Theres a problem with the address for this letter',
'detail': (
'The last line of the address must be a real UK postcode.'
),
'summary': (
'Validation failed because the last line of the address is not a real UK postcode.'
),
}
}

View File

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