mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-05-01 06:30:56 -04:00
Validate CSVs fully
This commit extends the existing function to validate each row’s phone number to also validate that all the required data is present. It does this using the checking that the `Template` class can do when given a template and a `dict` of values.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
from app.main.utils import (
|
||||
from app.utils import (
|
||||
validate_phone_number,
|
||||
InvalidPhoneError
|
||||
)
|
||||
|
||||
@@ -63,10 +63,10 @@ def test_upload_csvfile_with_invalid_phone_shows_check_page_with_errors(app_,
|
||||
follow_redirects=True)
|
||||
assert response.status_code == 200
|
||||
content = response.get_data(as_text=True)
|
||||
assert 'The following numbers are invalid' in content
|
||||
assert 'Your CSV file contained missing or invalid data' in content
|
||||
assert '+44 123' in content
|
||||
assert '+44 456' in content
|
||||
assert 'Go back and resolve errors' in content
|
||||
assert 'Choose a CSV file' in content
|
||||
|
||||
|
||||
@moto.mock_s3
|
||||
|
||||
Reference in New Issue
Block a user