mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-06-20 13:12:27 -04:00
Merge pull request #4085 from alphagov/fix-contact-list-validation-177535141
Fix not showing errors for invalid contact uploads
This commit is contained in:
@@ -40,8 +40,7 @@
|
||||
{{ file_upload(
|
||||
form.file,
|
||||
allowed_file_extensions=allowed_file_extensions,
|
||||
button_text='Upload your file again' if error else 'Choose file',
|
||||
show_errors=False
|
||||
button_text='Choose file',
|
||||
)}}
|
||||
</div>
|
||||
|
||||
|
||||
@@ -276,6 +276,22 @@ def test_upload_csv_file_shows_error_banner_for_too_many_rows(
|
||||
)
|
||||
|
||||
|
||||
def test_upload_csv_shows_error_with_invalid_extension(
|
||||
client_request,
|
||||
):
|
||||
|
||||
page = client_request.post(
|
||||
'main.upload_contact_list',
|
||||
service_id=SERVICE_ONE_ID,
|
||||
_data={'file': (BytesIO(''.encode('utf-8')), 'invalid.txt')},
|
||||
_follow_redirects=True,
|
||||
)
|
||||
|
||||
assert normalize_spaces(page.select_one('.file-upload-label .error-message').text) == (
|
||||
"invalid.txt is not a spreadsheet that Notify can read"
|
||||
)
|
||||
|
||||
|
||||
def test_upload_csv_file_sanitises_and_truncates_file_name_in_metadata(
|
||||
client_request,
|
||||
mocker,
|
||||
|
||||
Reference in New Issue
Block a user