mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-04-11 12:51:05 -04:00
Content changes to error messages
This commit is contained in:
@@ -25,10 +25,10 @@
|
||||
{% call banner_wrapper(type='dangerous') %}
|
||||
{% if row_errors|length == 1 %}
|
||||
<h1 class='banner-title' data-module="track-error" data-error-type="Bad rows" data-error-label="{{ upload_id }}">
|
||||
There is a problem with {{ original_file_name }}
|
||||
There’s a problem with {{ original_file_name }}
|
||||
</h1>
|
||||
<p>
|
||||
You need to {{ row_errors[0] }}
|
||||
You need to {{ row_errors[0] }}.
|
||||
</p>
|
||||
{% else %}
|
||||
<h1 class='banner-title' data-module="track-error" data-error-type="Bad rows" data-error-label="{{ upload_id }}">
|
||||
|
||||
10
app/utils.py
10
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
|
||||
|
||||
|
||||
@@ -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'
|
||||
]
|
||||
),
|
||||
]
|
||||
|
||||
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user