aboutsummaryrefslogtreecommitdiff
path: root/tests/test_init.py
diff options
context:
space:
mode:
authorDennis Fink2026-11-17 21:23:57 +0100
committerDennis Fink2026-11-17 21:23:57 +0100
commitacd1f42847786963fc4aaeed884c3091700c9e35 (patch)
tree5a126bdfd96e69c985137bb2a3db8d9066ecd12d /tests/test_init.py
parentc4c17e3e046a627a7d2353c734bc69f05d4fc3b1 (diff)
downloadwebmentions-ssg-acd1f42847786963fc4aaeed884c3091700c9e35.tar.gz
webmentions-ssg-acd1f42847786963fc4aaeed884c3091700c9e35.zip
feat(core): add user account page
Add an authenticated user page showing the current username and remote address, including guidance for validating reverse-proxy hop configuration. Allow users to change their own password through a CSRF-protected WTForms form while preserving the active session and invalidating other existing sessions.
Diffstat (limited to 'tests/test_init.py')
-rw-r--r--tests/test_init.py30
1 files changed, 23 insertions, 7 deletions
diff --git a/tests/test_init.py b/tests/test_init.py
index cff42f9..8f2bbb7 100644
--- a/tests/test_init.py
+++ b/tests/test_init.py
@@ -56,7 +56,9 @@ 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"
+ assert (
+ connection.exec_driver_sql("PRAGMA journal_mode").scalar() == "memory"
+ )
def test_file_sqlite_enables_wal_and_foreign_keys(tmp_path: Path) -> None:
@@ -69,12 +71,16 @@ def test_file_sqlite_enables_wal_and_foreign_keys(tmp_path: Path) -> None:
try:
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() == "wal"
+ assert (
+ connection.exec_driver_sql("PRAGMA journal_mode").scalar() == "wal"
+ )
# Foreign-key enforcement must also apply to fresh pooled connections.
db.engine.dispose()
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() == "wal"
+ assert (
+ connection.exec_driver_sql("PRAGMA journal_mode").scalar() == "wal"
+ )
finally:
db.engine.dispose()
@@ -89,7 +95,9 @@ def test_sqlite_settings_apply_to_sqlite_binds(tmp_path: Path) -> None:
try:
with db.engines["archive"].connect() as connection:
assert connection.exec_driver_sql("PRAGMA foreign_keys").scalar() == 1
- assert connection.exec_driver_sql("PRAGMA journal_mode").scalar() == "wal"
+ assert (
+ connection.exec_driver_sql("PRAGMA journal_mode").scalar() == "wal"
+ )
finally:
db.engines["archive"].dispose()
db.engine.dispose()
@@ -161,9 +169,15 @@ def test_in_memory_sqlite_skips_file_only_pragmas(tmp_path: Path) -> None:
with app.app_context():
try:
with db.engine.connect() as connection:
- assert connection.exec_driver_sql("PRAGMA journal_mode").scalar() == "memory"
+ assert (
+ connection.exec_driver_sql("PRAGMA journal_mode").scalar()
+ == "memory"
+ )
assert connection.exec_driver_sql("PRAGMA cache_size").scalar() == -4096
- assert connection.exec_driver_sql("PRAGMA wal_autocheckpoint").scalar() == 1000
+ assert (
+ connection.exec_driver_sql("PRAGMA wal_autocheckpoint").scalar()
+ == 1000
+ )
finally:
db.engine.dispose()
@@ -178,7 +192,9 @@ def test_sqlite_pragma_settings_also_apply_to_binds(tmp_path: Path) -> None:
with app.app_context():
try:
with db.engines["archive"].connect() as connection:
- assert connection.exec_driver_sql("PRAGMA busy_timeout").scalar() == 1234
+ assert (
+ connection.exec_driver_sql("PRAGMA busy_timeout").scalar() == 1234
+ )
assert connection.exec_driver_sql("PRAGMA cache_size").scalar() == -2048
finally:
db.engines["archive"].dispose()