From cfd44c94f6f0ecbe7676c0220700f11b7de080fd Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Thu, 20 Jul 2017 15:49:12 +0100 Subject: [PATCH] Fix error message for missing cells in CSV file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This was causing a 500 because of a bug in utils. It only occurred when there was missing data for a cell in the recipient column. I’ve also added a test for missing data in a non-recipient column just in case. --- requirements.txt | 2 +- tests/app/main/views/test_send.py | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index c8c1e6997..30e873616 100644 --- a/requirements.txt +++ b/requirements.txt @@ -27,4 +27,4 @@ notifications-python-client>=3.1,<3.2 awscli>=1.11,<1.12 awscli-cwlogs>=1.4,<1.5 -git+https://github.com/alphagov/notifications-utils.git@17.5.1#egg=notifications-utils==17.5.1 +git+https://github.com/alphagov/notifications-utils.git@17.5.6#egg=notifications-utils==17.5.6 diff --git a/tests/app/main/views/test_send.py b/tests/app/main/views/test_send.py index 30c7eb244..7b665c30a 100644 --- a/tests/app/main/views/test_send.py +++ b/tests/app/main/views/test_send.py @@ -185,6 +185,32 @@ def test_upload_csvfile_with_errors_shows_check_page_with_errors( 'Skip to file contents' ) ), + ( + """ + phone number, name + +447700900986, example + , example + +447700900986, example + """, + ( + 'There is a problem with your data ' + 'You need to enter missing data in 1 row ' + 'Skip to file contents' + ) + ), + ( + """ + phone number, name + +447700900986, example + +447700900986, + +447700900986, example + """, + ( + 'There is a problem with your data ' + 'You need to enter missing data in 1 row ' + 'Skip to file contents' + ) + ), ]) def test_upload_csvfile_with_missing_columns_shows_error( logged_in_client,