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:
Chris Hill-Scott
2016-02-17 15:49:07 +00:00
parent efb2140bbb
commit 45cacd82d3
11 changed files with 98 additions and 113 deletions

View File

@@ -1,4 +1,4 @@
from app.main.utils import (
from app.utils import (
validate_phone_number,
InvalidPhoneError
)

View File

@@ -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