aboutsummaryrefslogtreecommitdiff
path: root/tests/test_init.py
diff options
context:
space:
mode:
authorDennis Fink2026-11-18 19:18:18 +0100
committerDennis Fink2026-11-18 19:18:18 +0100
commitbeb0131b089293512c2dab2243b9b2ff314e2387 (patch)
tree2690eaa17c689a77bccdc1268e971a96ec0e368f /tests/test_init.py
parente3e195ea07fd57288d32c842689ebed7fba636f0 (diff)
downloadwebmentions-ssg-beb0131b089293512c2dab2243b9b2ff314e2387.tar.gz
webmentions-ssg-beb0131b089293512c2dab2243b9b2ff314e2387.zip
feat(core): show relative timestamps
Add reusable UTC template filters backed by `humanize` so timestamps render as relative ages while preserving machine-readable `<time datetime>` values. Keep exact UTC timestamps available in tooltips across dashboard, received, sent, detail, and public status views.
Diffstat (limited to 'tests/test_init.py')
-rw-r--r--tests/test_init.py13
1 files changed, 7 insertions, 6 deletions
diff --git a/tests/test_init.py b/tests/test_init.py
index 8f2bbb7..0966b19 100644
--- a/tests/test_init.py
+++ b/tests/test_init.py
@@ -14,12 +14,16 @@ from sqlalchemy import create_engine
from webmentions_ssg import VERSION, create_app, db, huey
from webmentions_ssg.config import TestingConfig
from webmentions_ssg.net import is_http_url
+from webmentions_ssg.template_filters import relative_time, utc_isoformat, utc_timestamp
def test_create_app_registers_blueprint_and_extensions(app: Flask) -> None:
assert "webmentions" in app.blueprints
assert app.extensions["huey"] is huey
assert app.jinja_env.filters["is_http_url"] is is_http_url
+ assert app.jinja_env.filters["relative_time"] is relative_time
+ assert app.jinja_env.filters["utc_isoformat"] is utc_isoformat
+ assert app.jinja_env.filters["utc_timestamp"] is utc_timestamp
def test_create_app_exposes_version_in_templates(app: Flask) -> None:
@@ -53,12 +57,9 @@ assert webmentions_bp.name == 'webmentions'
def test_in_memory_sqlite_enforces_foreign_keys_without_wal(app: Flask) -> None:
- with app.app_context():
- with db.engine.connect() as connection:
- assert connection.exec_driver_sql("PRAGMA foreign_keys").scalar() == 1
- assert (
- connection.exec_driver_sql("PRAGMA journal_mode").scalar() == "memory"
- )
+ with app.app_context(), db.engine.connect() as connection:
+ assert connection.exec_driver_sql("PRAGMA foreign_keys").scalar() == 1
+ assert connection.exec_driver_sql("PRAGMA journal_mode").scalar() == "memory"
def test_file_sqlite_enables_wal_and_foreign_keys(tmp_path: Path) -> None: