diff options
| author | Dennis Fink | 2026-11-22 11:11:23 +0100 |
|---|---|---|
| committer | Dennis Fink | 2026-11-22 11:11:23 +0100 |
| commit | 779d10051556242ba1e70b70f6c6e8f1158e861d (patch) | |
| tree | 284d8228491f0a7ee9422a2100149adebad5aaa7 /tests/test_config.py | |
| parent | ef90dc381322122ecfb9af039cf790de92807514 (diff) | |
| download | webmentions-ssg-779d10051556242ba1e70b70f6c6e8f1158e861d.tar.gz webmentions-ssg-779d10051556242ba1e70b70f6c6e8f1158e861d.zip | |
Render plain-text digests with source, target, per-Webmention detail
links, and a filtered dashboard link while preserving singular and
plural wording.
Freeze the notified rows before sending so mentions arriving during
delivery are left for the next digest.
BREAKING CHANGE: enabling `DIGEST_EMAIL` now requires `SERVER_NAME` so
background workers can generate absolute administration URLs.
Diffstat (limited to 'tests/test_config.py')
| -rw-r--r-- | tests/test_config.py | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/test_config.py b/tests/test_config.py index 43c29ab..fedd7ce 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -39,6 +39,39 @@ def test_session_cookie_defaults( assert config_class.SESSION_COOKIE_SAMESITE == "Lax" +def test_testing_config_preserves_default_request_host() -> None: + app = create_app(TestingConfig) + assert app.config["SERVER_NAME"] is None + assert app.config["PREFERRED_URL_SCHEME"] == "http" + + +def test_digest_requires_server_name_at_app_startup() -> None: + class MissingServerNameConfig(TestingConfig): + DIGEST_EMAIL = "owner@example.com" + SERVER_NAME = None + + with pytest.raises(RuntimeError, match="Configure SERVER_NAME"): + create_app(MissingServerNameConfig) + + +def test_digest_rejects_blank_server_name() -> None: + class BlankServerNameConfig(TestingConfig): + DIGEST_EMAIL = "owner@example.com" + SERVER_NAME = " " + + with pytest.raises(RuntimeError, match="Configure SERVER_NAME"): + create_app(BlankServerNameConfig) + + +def test_server_name_optional_when_digest_disabled() -> None: + class NoDigestConfig(TestingConfig): + DIGEST_EMAIL = None + SERVER_NAME = None + + app = create_app(NoDigestConfig) + assert app.config["SERVER_NAME"] is None + + def test_source_allowlist_mode_requires_boolean_configuration(tmp_path: Path) -> None: class BadSourceModeConfig(TestingConfig): LOG_FILE = str(tmp_path / "mode-test.log") |
