Only mandate mandatory address columns

If you miss ‘postcode’ from your file then you get told that you need
‘address_line_1’, ‘address_line_2’, ‘address_line_3’, etc.

This is incorrect – the only required address columns are lines 1 and 2,
plus the postcode. So this commit corrects the error message to be
factually accurate.

We had a user report this to Fajer as a bug.
This commit is contained in:
Chris Hill-Scott
2017-10-03 14:08:25 +01:00
parent ccd24f516d
commit 4154dbba1f
3 changed files with 35 additions and 1 deletions

View File

@@ -1663,6 +1663,38 @@ def test_check_messages_shows_data_errors_before_trial_mode_errors_for_letters(
)
def test_check_messages_column_error_doesnt_show_optional_columns(
mocker,
client_request,
mock_get_service_letter_template,
mock_has_permissions,
mock_get_users_by_service,
mock_get_detailed_service_for_today,
):
mocker.patch('app.main.views.send.s3download', return_value='\n'.join(
['address_line_1,address_line_2,foo'] +
['First Lastname,1 Example Road,SW1 1AA']
))
with client_request.session_transaction() as session:
session['upload_data'] = {'template_id': '', 'original_file_name': ''}
page = client_request.get(
'main.check_messages',
service_id=SERVICE_ONE_ID,
template_type='letter',
upload_id=uuid.uuid4(),
_test_page_title=False,
)
assert normalize_spaces(page.select_one('.banner-dangerous').text) == (
'Your file needs columns called address line 1, address line 2 and postcode '
'Right now it has columns called address_line_1, address_line_2 and foo. '
'Skip to file contents'
)
def test_generate_test_letter_doesnt_block_in_trial_mode(
client_request,
mocker,