From 34f209a08ba5e8b2c394d86bc538fc9d936a0648 Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Mon, 20 Jan 2020 15:54:07 +0000 Subject: [PATCH] Fix mixed-up error messages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- app/utils.py | 4 ++-- tests/app/test_utils.py | 13 +++++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/app/utils.py b/app/utils.py index 56d711117..3f8a3b599 100644 --- a/app/utils.py +++ b/app/utils.py @@ -610,8 +610,8 @@ LETTER_VALIDATION_MESSAGES = { '
Save a new copy of your file and try again.' ), 'summary': ( - 'Letters must be 10 pages or less.
' - 'This letter is {page_count} pages long.' + 'Validation failed because Notify cannot read this PDF.
' + 'Save a new copy of your file and try again.' ), }, 'address-is-empty': { diff --git a/tests/app/test_utils.py b/tests/app/test_utils.py index ee177e6b3..a8dc0755b 100644 --- a/tests/app/test_utils.py +++ b/tests/app/test_utils.py @@ -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], + 'There’s 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,