mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-23 07:46:23 -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(
|
{{ file_upload(
|
||||||
form.file,
|
form.file,
|
||||||
allowed_file_extensions=allowed_file_extensions,
|
allowed_file_extensions=allowed_file_extensions,
|
||||||
button_text='Upload your file again' if error else 'Choose file',
|
button_text='Choose file',
|
||||||
show_errors=False
|
|
||||||
)}}
|
)}}
|
||||||
</div>
|
</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(
|
def test_upload_csv_file_sanitises_and_truncates_file_name_in_metadata(
|
||||||
client_request,
|
client_request,
|
||||||
mocker,
|
mocker,
|
||||||
|
|||||||
Reference in New Issue
Block a user