diff --git a/app/utils.py b/app/utils.py index 930dc800d..84e457a9c 100644 --- a/app/utils.py +++ b/app/utils.py @@ -136,14 +136,14 @@ def get_errors_for_csv(recipients, template_type): if 1 == number_of_rows_with_message_too_long: errors.append("shorten your message in 1 row") else: - errors.append("shorten your message in {} rows".format(number_of_rows_with_missing_data)) + errors.append("shorten your 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") else: - errors.append("add content to empty messages {} rows".format(number_of_rows_with_empty_message)) + errors.append("add content to 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 67e6f6103..f3b05ee9f 100644 --- a/tests/app/main/test_errors_for_csv.py +++ b/tests/app/main/test_errors_for_csv.py @@ -67,6 +67,13 @@ MockRecipients = namedtuple( 'shorten your message in 1 row' ] ), + ( + {}, {}, {3, 12}, [], + 'sms', + [ + 'shorten your messages in 2 rows' + ] + ), ( {}, {}, {}, {2}, 'sms', @@ -74,6 +81,13 @@ MockRecipients = namedtuple( 'add content to empty message in 1 row' ] ), + ( + {}, {}, {}, {2, 4, 8}, + 'sms', + [ + 'add content to empty messages in 3 rows' + ] + ), ] ) def test_get_errors_for_csv( @@ -82,6 +96,8 @@ def test_get_errors_for_csv( expected_errors ): assert get_errors_for_csv( - MockRecipients(rows_with_bad_recipients, rows_with_missing_data, rows_with_message_too_long, rows_with_empty_message), + MockRecipients( + rows_with_bad_recipients, rows_with_missing_data, rows_with_message_too_long, rows_with_empty_message + ), template_type ) == expected_errors