-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
45 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -109,14 +109,14 @@ def _index_rows(rows): | |
), | ||
( | ||
""" | ||
address courriel,name | ||
adresse courriel,name | ||
[email protected],test1 | ||
[email protected], test2 | ||
""", | ||
"email", | ||
[ | ||
[("address courriel", "[email protected]"), ("name", "test1")], | ||
[("address courriel", "[email protected]"), ("name", "test2")], | ||
[("email address", "[email protected]"), ("name", "test1")], | ||
[("email address", "[email protected]"), ("name", "test2")], | ||
], | ||
"fr", | ||
), | ||
|
@@ -129,9 +129,9 @@ def _index_rows(rows): | |
""", | ||
"sms", | ||
[ | ||
[("numéro de téléphone", "07900900001"), ("list", ["cat", "rat", "gnat"])], | ||
[("numéro de téléphone", "07900900002"), ("list", ["dog", "hog", "frog"])], | ||
[("numéro de téléphone", "07900900003"), ("list", ["elephant", None, None])], | ||
[("phone number", "07900900001"), ("list", ["cat", "rat", "gnat"])], | ||
[("phone number", "07900900002"), ("list", ["dog", "hog", "frog"])], | ||
[("phone number", "07900900003"), ("list", ["elephant", None, None])], | ||
], | ||
"fr", | ||
), | ||
|
@@ -144,9 +144,9 @@ def _index_rows(rows): | |
""", | ||
"sms", | ||
[ | ||
[("numéro de téléphone", "07900900001"), ("list", ["cat", "rat", "gnat"])], | ||
[("numéro de téléphone", "07900900002"), ("list", ["dog", "hog", "frog"])], | ||
[("numéro de téléphone", "07900900003"), ("list", ["elephant", None, None])], | ||
[("phone number", "07900900001"), ("list", ["cat", "rat", "gnat"])], | ||
[("phone number", "07900900002"), ("list", ["dog", "hog", "frog"])], | ||
[("phone number", "07900900003"), ("list", ["elephant", None, None])], | ||
], | ||
"en", | ||
), | ||
|
@@ -192,6 +192,36 @@ def test_get_rows_does_no_error_checking_of_rows_or_cells(mocker): | |
assert cell_recipient_error_mock.called is False | ||
|
||
|
||
def test_get_rows_does_no_error_checking_of_rows_or_cells_fr(mocker): | ||
has_error_mock = mocker.patch.object(Row, "has_error") | ||
has_bad_recipient_mock = mocker.patch.object(Row, "has_bad_recipient") | ||
has_missing_data_mock = mocker.patch.object(Row, "has_missing_data") | ||
cell_recipient_error_mock = mocker.patch.object(Cell, "recipient_error") | ||
|
||
recipients = RecipientCSV( | ||
""" | ||
adresse courriel, name | ||
[email protected], | ||
[email protected], My Name | ||
[email protected], | ||
""", | ||
template_type="email", | ||
placeholders=["name"], | ||
max_errors_shown=3, | ||
) | ||
|
||
rows = recipients.get_rows() | ||
for i in range(3): | ||
assert next(rows).recipient == "[email protected]" | ||
|
||
assert has_error_mock.called is False | ||
assert has_bad_recipient_mock.called is False | ||
assert has_missing_data_mock.called is False | ||
assert cell_recipient_error_mock.called is False | ||
|
||
|
||
def test_get_rows_only_iterates_over_file_once(mocker): | ||
row_mock = mocker.patch("notifications_utils.recipients.Row") | ||
|
||
|