-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #44 from cfpb/features/33_add_validation_id
Task 33, adding validation id
- Loading branch information
Showing
4 changed files
with
228 additions
and
18 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import pytest | ||
|
||
from validator.checks import SBLCheck | ||
|
||
|
||
class TestSBLCheck: | ||
def test_no_id_check(self): | ||
with pytest.raises(Exception) as exc: | ||
SBLCheck(lambda: True, warning=True, name="Just a Warning") | ||
|
||
assert "Each check must be assigned a `name` and an `id`." in str(exc.value) | ||
assert exc.type == ValueError | ||
|
||
def test_no_name_check(self): | ||
with pytest.raises(Exception) as exc: | ||
SBLCheck(lambda: True, id="00000", warning=True) | ||
|
||
assert "Each check must be assigned a `name` and an `id`." in str(exc.value) | ||
assert exc.type == ValueError | ||
|
||
def test_name_and_id_check(self): | ||
raised = False | ||
try: | ||
SBLCheck(lambda: True, id="00000", warning=True, name="Just a Warning") | ||
except ValueError: | ||
raised = True | ||
assert raised is False |
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
Oops, something went wrong.