aboutsummaryrefslogtreecommitdiff
path: root/tests/test_cli.py
diff options
context:
space:
mode:
authorDennis Fink2026-11-17 14:44:00 +0100
committerDennis Fink2026-11-17 14:44:00 +0100
commit227092b57acc886469e16bcc4c0d3256e86d3d1e (patch)
treec1de8d5f8f3a37562e482f84e8017213c08a05d6 /tests/test_cli.py
parentf98b0e446b41325c494bd97900b7bbf730a7d67e (diff)
downloadwebmentions-ssg-227092b57acc886469e16bcc4c0d3256e86d3d1e.tar.gz
webmentions-ssg-227092b57acc886469e16bcc4c0d3256e86d3d1e.zip
feat(receiver): add source domain access rules
Add persistent source block and allow lists with authenticated management, single-row and bulk blocking actions, and optional fail-closed allowlist mode. Reject disallowed sources before enqueueing and recheck policy in verification workers, while sharing canonical hostname normalization across receiver, sender, and configuration paths.
Diffstat (limited to '')
-rw-r--r--tests/test_cli.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/test_cli.py b/tests/test_cli.py
index c98b2fc..f5535d2 100644
--- a/tests/test_cli.py
+++ b/tests/test_cli.py
@@ -243,6 +243,20 @@ def test_upgrade_applies_pending_migrations_and_preserves_data(
assert "sent_webmentions" in inspect(connection).get_table_names()
+@pytest.mark.parametrize("existing_head", ("3e8c87a96b2d", "9a4e0c8211d6"))
+def test_upgrade_merges_existing_migration_branches(
+ database_app: Flask, existing_head: str
+) -> None:
+ """Existing installations on either branch can upgrade to a single head."""
+ with database_app.app_context():
+ migrate_upgrade(revision=existing_head)
+ migrate_upgrade()
+
+ assert _database_revision(database_app) == _head_revision(database_app)
+ tables = set(inspect(db.engine).get_table_names())
+ assert {"blocked_sources", "allowed_sources", "source_documents"} <= tables
+
+
def test_upgrade_is_safe_to_run_when_already_current(database_app: Flask) -> None:
runner = database_app.test_cli_runner()
assert runner.invoke(args=["db", "create-db"]).exit_code == 0