-
-
Notifications
You must be signed in to change notification settings - Fork 2
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
Emerson Delatorre
committed
Feb 13, 2024
1 parent
1fc040f
commit 79c8f19
Showing
1 changed file
with
7 additions
and
5 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 |
---|---|---|
@@ -1,20 +1,22 @@ | ||
from flunt.validations.contract import Contract | ||
|
||
message = "Custom message here" | ||
|
||
|
||
def test_should_be_valid_when_correct_email(entityMock): | ||
contract = ( | ||
Contract() | ||
.requires(entityMock.email_valid, "Email") | ||
.is_email(entityMock.email_valid, "email", "any message") | ||
.requires(entityMock.email_valid, "Email", message) | ||
.is_email(entityMock.email_valid, "email", message) | ||
) | ||
assert contract.is_valid() | ||
assert contract.is_valid | ||
assert len(contract.get_notifications()) == 0 | ||
|
||
|
||
def test_should_return_a_once_notification_when_email_is_invalid(entityMock): | ||
contract = ( | ||
Contract() | ||
.requires(entityMock.email_invalid, "Email") | ||
.is_email(entityMock.email_invalid, "email", "any message") | ||
.requires(entityMock.email_invalid, "Email", message) | ||
.is_email(entityMock.email_invalid, "email", message) | ||
) | ||
assert len(contract.get_notifications()) == 1 |