Fix mixed-up error messages

The too many pages error was being returned when the file couldn’t be
read. This commit corrects the error message, and adds a test to make
sure this case is covered.
This commit is contained in:
Chris Hill-Scott
2020-01-20 15:54:07 +00:00
parent 1fc0f58541
commit 34f209a08b
2 changed files with 15 additions and 2 deletions

View File

@@ -610,8 +610,8 @@ LETTER_VALIDATION_MESSAGES = {
'<br>Save a new copy of your file and try again.'
),
'summary': (
'Letters must be 10 pages or less. <br>'
'This letter is {page_count} pages long.'
'Validation failed because Notify cannot read this PDF.<br>'
'Save a new copy of your file and try again.'
),
},
'address-is-empty': {

View File

@@ -469,6 +469,19 @@ def test_get_letter_validation_error_for_unknown_error():
'Letters must be 10 pages or less.'
),
),
(
'unable-to-read-the-file',
[2],
'Theres a problem with your file',
(
'Notify cannot read this PDF.'
'Save a new copy of your file and try again.'
),
(
'Validation failed because Notify cannot read this PDF.'
'Save a new copy of your file and try again.'
),
),
])
def test_get_letter_validation_error_for_known_errors(
client_request,