-
Notifications
You must be signed in to change notification settings - Fork 18
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
46 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
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 |
---|---|---|
@@ -0,0 +1,46 @@ | ||
from collections import OrderedDict | ||
|
||
import pytest | ||
|
||
from dmutils.forms.errors import govuk_errors | ||
|
||
|
||
@pytest.mark.parametrize("dm_errors,expected_output", ( | ||
({}, OrderedDict()), | ||
( | ||
OrderedDict(( | ||
("haddock", { | ||
"input_name": "haddock", | ||
"question": "What was that, Joe?", | ||
"message": "Too numerous to be enumerated", | ||
},), | ||
("pollock", {},), | ||
("flounder", { | ||
"input_name": "flounder", | ||
"question": "Anything strange or wonderful, Joe?", | ||
"roach": "halibut", | ||
},), | ||
)), | ||
OrderedDict(( | ||
("haddock", { | ||
"input_name": "haddock", | ||
"question": "What was that, Joe?", | ||
"message": "Too numerous to be enumerated", | ||
"text": "Too numerous to be enumerated", | ||
"href": "#input-haddock", | ||
"errorMessage": {"text": "Too numerous to be enumerated"}, | ||
},), | ||
("pollock", {},), | ||
("flounder", { | ||
"input_name": "flounder", | ||
"question": "Anything strange or wonderful, Joe?", | ||
"roach": "halibut", | ||
"text": "Anything strange or wonderful, Joe?", | ||
"href": "#input-flounder", | ||
"errorMessage": {"text": "Anything strange or wonderful, Joe?"}, | ||
},), | ||
)), | ||
), | ||
)) | ||
def test_govuk_errors(dm_errors, expected_output): | ||
assert govuk_errors(dm_errors) == expected_output |