diff options
| author | Dennis Fink | 2026-11-17 17:09:59 +0100 |
|---|---|---|
| committer | Dennis Fink | 2026-11-17 17:09:59 +0100 |
| commit | 6d6d079a3a99d3d3a922a640b6925eb2adf044de (patch) | |
| tree | 33cc19241f4ce86ea43b2f194087c58e3fdc8a4d /tests/test_cli.py | |
| parent | 227092b57acc886469e16bcc4c0d3256e86d3d1e (diff) | |
| download | webmentions-ssg-6d6d079a3a99d3d3a922a640b6925eb2adf044de.tar.gz webmentions-ssg-6d6d079a3a99d3d3a922a640b6925eb2adf044de.zip | |
refactor(core)!: split forms and models by feature
Replace monolithic form and model modules with focused packages for
receiver, moderation, source, user, and shared validation concerns.
Rename source policy concepts to domain moderation, including routes,
models, tables, configuration, templates, and tests.
BREAKING CHANGE: form and model import paths, moderation routes, and
`SOURCE_ALLOWLIST_ENABLED` have changed; use `ALLOWLIST_ENABLED` and the
new feature-specific modules.
Diffstat (limited to '')
| -rw-r--r-- | tests/test_cli.py | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/tests/test_cli.py b/tests/test_cli.py index f5535d2..5e71e2a 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -19,7 +19,8 @@ from sqlalchemy.exc import IntegrityError from webmentions_ssg import create_app, db, migrate from webmentions_ssg.config import DevelopmentConfig, TestingConfig -from webmentions_ssg.models import ReceivedWebmention, ReceivedWebmentionStatus, User +from webmentions_ssg.models.received import ReceivedWebmention, ReceivedWebmentionStatus +from webmentions_ssg.models.user import User def test_cli_groups_are_registered(app: Flask) -> None: @@ -158,6 +159,8 @@ def test_create_db_builds_schema_and_records_latest_migration( assert "source_target_digest" in received_columns assert {"attempt_count", "next_retry_at"} <= columns assert "recovery_attempts" in received_columns + assert {"blocked_domains", "allowed_domains"} <= table_names + assert not {"blocked_sources", "allowed_sources"} & table_names assert "ix_received_webmentions_status_updated_at" in received_indexes @@ -250,11 +253,27 @@ def test_upgrade_merges_existing_migration_branches( """Existing installations on either branch can upgrade to a single head.""" with database_app.app_context(): migrate_upgrade(revision=existing_head) + if existing_head == "3e8c87a96b2d": + with db.engine.begin() as connection: + connection.execute( + sa.text("INSERT INTO blocked_sources (domain) VALUES (:domain)"), + {"domain": "existing.example"}, + ) 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 + assert {"blocked_domains", "allowed_domains", "source_documents"} <= tables + assert "blocked_sources" not in tables + assert "allowed_sources" not in tables + if existing_head == "3e8c87a96b2d": + with db.engine.connect() as connection: + assert ( + connection.execute( + sa.text("SELECT domain FROM blocked_domains") + ).scalar_one() + == "existing.example" + ) def test_upgrade_is_safe_to_run_when_already_current(database_app: Flask) -> None: @@ -304,7 +323,7 @@ def test_upgrade_backfills_portable_digest_for_existing_received_rows( :param database_app: Flask application connected to the legacy SQLite schema. """ - from webmentions_ssg.models import source_target_digest + from webmentions_ssg.models.utils import source_target_digest with database_app.app_context(): migrate_upgrade(revision="c0272f25ce17") |
