-
Notifications
You must be signed in to change notification settings - Fork 1k
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
59 additions
and
2 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 |
---|---|---|
@@ -1,5 +1,7 @@ | ||
from galaxy.security import validate_user_input | ||
from galaxy.security.validate_user_input import ( | ||
extract_domain, | ||
is_email_banned, | ||
validate_email_domain_name, | ||
validate_email_str, | ||
validate_publicname_str, | ||
|
@@ -46,3 +48,17 @@ def test_validate_email_str(): | |
assert validate_email_str('"i-like-to-break-email-valid@tors"@foo.com') != "" | ||
too_long_email = "N" * 255 + "@foo.com" | ||
assert validate_email_str(too_long_email) != "" | ||
|
||
|
||
def test_is_email_banned(monkeypatch): | ||
mock_ban_list = ["[email protected]", "[email protected]", "[email protected]"] | ||
monkeypatch.setattr(validate_user_input, "_read_email_ban_list", lambda a: mock_ban_list) | ||
|
||
assert is_email_banned("[email protected]", "_") | ||
assert is_email_banned("[email protected]", "_") | ||
assert is_email_banned("[email protected]", "_") | ||
assert is_email_banned("[email protected]", "_") | ||
assert is_email_banned("[email protected]", "_") | ||
assert is_email_banned("[email protected]", "_") | ||
assert not is_email_banned("[email protected]", "_") | ||
assert not is_email_banned("[email protected]", "_") |