diff --git a/app/main/views/send.py b/app/main/views/send.py index 98fde5e54..a44626776 100644 --- a/app/main/views/send.py +++ b/app/main/views/send.py @@ -18,7 +18,7 @@ from flask import ( from flask_login import login_required, current_user from utils.template import Template -from utils.recipients import RecipientCSV, first_column_heading +from utils.recipients import RecipientCSV, first_column_heading, validate_and_format_phone_number from app.main import main from app.main.forms import CsvUploadForm @@ -55,7 +55,9 @@ def get_example_csv_rows(template, number_of_rows=2): [ { 'email': current_user.email_address, - 'sms': current_user.mobile_number + 'sms': validate_and_format_phone_number( + current_user.mobile_number, human_readable=True + ) }[template.template_type] ] + [ "{} {}".format(header, i) for header in template.placeholders diff --git a/requirements.txt b/requirements.txt index cf5dfeed9..3b1b1088c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -14,4 +14,4 @@ Pygments==2.0.2 git+https://github.com/alphagov/notifications-python-client.git@0.3.1#egg=notifications-python-client==0.3.1 -git+https://github.com/alphagov/notifications-utils.git@3.2.1#egg=notifications-utils==3.2.1 +git+https://github.com/alphagov/notifications-utils.git@3.3.0#egg=notifications-utils==3.3.0 diff --git a/tests/app/main/views/test_send.py b/tests/app/main/views/test_send.py index ed84b9404..02c942920 100644 --- a/tests/app/main/views/test_send.py +++ b/tests/app/main/views/test_send.py @@ -60,7 +60,7 @@ def test_send_test_sms_message_to_self( mock_get_users_by_service ): - expected_data = {'data': 'phone number\r\n07700 900762\r\n', 'file_name': 'Test run'} + expected_data = {'data': 'phone number\r\n07700 900 762\r\n', 'file_name': 'Test run'} mocker.patch('app.main.views.send.s3download', return_value='phone number\r\n+4412341234') with app_.test_request_context(): @@ -139,7 +139,7 @@ def test_download_example_csv( follow_redirects=True ) assert response.status_code == 200 - assert response.get_data(as_text=True) == 'phone number\r\n07700 900762\r\n07700 900762\r\n' + assert response.get_data(as_text=True) == 'phone number\r\n07700 900 762\r\n07700 900 762\r\n' assert 'text/csv' in response.headers['Content-Type']