aboutsummaryrefslogtreecommitdiff
path: root/tests/test_auth.py
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--tests/test_auth.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/tests/test_auth.py b/tests/test_auth.py
index 008382a..c302e8f 100644
--- a/tests/test_auth.py
+++ b/tests/test_auth.py
@@ -8,10 +8,16 @@ import pytest
from flask import Flask
from webmentions_ssg import db
-from webmentions_ssg.auth import AUTH, is_safe_next_url, load_user
+from webmentions_ssg.auth import AUTH, is_safe_next_url, load_user, validate_password
from webmentions_ssg.models import User
+@pytest.mark.parametrize("character", ["\x00", "\x1f", "\x7f", "\x80", "\x9f"])
+def test_validate_password_rejects_unicode_controls(character: str) -> None:
+ with pytest.raises(ValueError, match="control characters"):
+ validate_password(f"valid passphrase{character}")
+
+
def test_user_loader_is_registered(app: Flask) -> None:
assert AUTH._user_callback is load_user