From 9e0c8167eed2b2fa53a19bc2db431bde3352d9b4 Mon Sep 17 00:00:00 2001 From: Pea Tyczynska Date: Wed, 27 Nov 2019 15:56:55 +0000 Subject: [PATCH] Content changes to error messages --- app/templates/views/check/row-errors.html | 4 ++-- app/utils.py | 10 ++++++---- tests/app/main/test_errors_for_csv.py | 8 ++++---- tests/app/main/views/test_send.py | 18 +++++++++--------- 4 files changed, 21 insertions(+), 19 deletions(-) diff --git a/app/templates/views/check/row-errors.html b/app/templates/views/check/row-errors.html index 4a2f5bf1d..6d76e0c91 100644 --- a/app/templates/views/check/row-errors.html +++ b/app/templates/views/check/row-errors.html @@ -25,10 +25,10 @@ {% call banner_wrapper(type='dangerous') %} {% if row_errors|length == 1 %}

- There is a problem with {{ original_file_name }} + There’s a problem with {{ original_file_name }}

- You need to {{ row_errors[0] }} + You need to {{ row_errors[0] }}.

{% else %}

diff --git a/app/utils.py b/app/utils.py index 84e457a9c..3bd002238 100644 --- a/app/utils.py +++ b/app/utils.py @@ -134,16 +134,18 @@ def get_errors_for_csv(recipients, template_type): if any(recipients.rows_with_message_too_long): number_of_rows_with_message_too_long = len(list(recipients.rows_with_message_too_long)) if 1 == number_of_rows_with_message_too_long: - errors.append("shorten your message in 1 row") + errors.append("shorten the message in 1 row") else: - errors.append("shorten your messages in {} rows".format(number_of_rows_with_message_too_long)) + errors.append("shorten the messages in {} rows".format(number_of_rows_with_message_too_long)) if any(recipients.rows_with_empty_message): number_of_rows_with_empty_message = len(list(recipients.rows_with_empty_message)) if 1 == number_of_rows_with_empty_message: - errors.append("add content to empty message in 1 row") + errors.append("check you have content for the empty message in 1 row") else: - errors.append("add content to empty messages in {} rows".format(number_of_rows_with_empty_message)) + errors.append("check you have content for the empty messages in {} rows".format( + number_of_rows_with_empty_message + )) return errors diff --git a/tests/app/main/test_errors_for_csv.py b/tests/app/main/test_errors_for_csv.py index f3b05ee9f..3e1fc3add 100644 --- a/tests/app/main/test_errors_for_csv.py +++ b/tests/app/main/test_errors_for_csv.py @@ -64,28 +64,28 @@ MockRecipients = namedtuple( {}, {}, {3}, [], 'sms', [ - 'shorten your message in 1 row' + 'shorten the message in 1 row' ] ), ( {}, {}, {3, 12}, [], 'sms', [ - 'shorten your messages in 2 rows' + 'shorten the messages in 2 rows' ] ), ( {}, {}, {}, {2}, 'sms', [ - 'add content to empty message in 1 row' + 'check you have content for the empty message in 1 row' ] ), ( {}, {}, {}, {2, 4, 8}, 'sms', [ - 'add content to empty messages in 3 rows' + 'check you have content for the empty messages in 3 rows' ] ), ] diff --git a/tests/app/main/views/test_send.py b/tests/app/main/views/test_send.py index 3f7a64172..2f72386ea 100644 --- a/tests/app/main/views/test_send.py +++ b/tests/app/main/views/test_send.py @@ -414,7 +414,7 @@ def test_upload_csv_file_with_errors_shows_check_page_with_errors( assert response.status_code == 200 content = response.get_data(as_text=True) - assert 'There is a problem with invalid.csv' in content + assert 'There’s a problem with invalid.csv' in content assert '+447700900986' in content assert 'Missing' in content assert 'Upload your file again' in content @@ -454,8 +454,8 @@ def test_upload_csv_file_with_empty_message_shows_check_page_with_errors( assert response.status_code == 200 content = response.get_data(as_text=True) - assert 'There is a problem with invalid.csv' in content - assert 'add content to empty message in 1 row' in content + assert 'There’s a problem with invalid.csv' in content + assert 'check you have content for the empty message in 1 row' in content @pytest.mark.parametrize('file_contents, expected_error,', [ @@ -528,8 +528,8 @@ def test_upload_csv_file_with_empty_message_shows_check_page_with_errors( +447700900986, example """, ( - 'There is a problem with invalid.csv ' - 'You need to enter missing data in 1 row ' + 'There’s a problem with invalid.csv ' + 'You need to enter missing data in 1 row. ' 'Skip to file contents' ) ), @@ -541,8 +541,8 @@ def test_upload_csv_file_with_empty_message_shows_check_page_with_errors( +447700900986, example """, ( - 'There is a problem with invalid.csv ' - 'You need to enter missing data in 1 row ' + 'There’s a problem with invalid.csv ' + 'You need to enter missing data in 1 row. ' 'Skip to file contents' ) ), @@ -2893,8 +2893,8 @@ def test_check_messages_shows_data_errors_before_trial_mode_errors_for_letters( ) assert normalize_spaces(page.select_one('.banner-dangerous').text) == ( - 'There is a problem with example.xlsx ' - 'You need to enter missing data in 2 rows ' + 'There’s a problem with example.xlsx ' + 'You need to enter missing data in 2 rows. ' 'Skip to file contents' ) assert not page.select('.table-field-index a')