From 509d93b2976e353d29441a7a7b7e78ca466dc4fd Mon Sep 17 00:00:00 2001 From: Dennis Fink Date: Sun, 15 Nov 2026 20:42:20 +0100 Subject: refactor(core)!: standardize application terminology Rename configuration keys, task helpers, forms, network utilities, and view endpoints to make their responsibilities and domains more explicit. Align source-management routes and templates with the new terminology and rename the target-matching module and related task abstractions consistently. BREAKING CHANGE: configuration keys have been renamed and sent-source routes move from `/sent` to `/sources`, with corresponding blueprint endpoint changes. --- tests/views/test_admin.py | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) (limited to 'tests/views/test_admin.py') diff --git a/tests/views/test_admin.py b/tests/views/test_admin.py index a88fbfa..90d406b 100644 --- a/tests/views/test_admin.py +++ b/tests/views/test_admin.py @@ -35,7 +35,7 @@ def views_module(app: Flask) -> ModuleType: return module -@pytest.mark.parametrize("path", ["/sent", f"/sent/{uuid.uuid7()}"]) +@pytest.mark.parametrize("path", ["/sources", f"/sources/{uuid.uuid7()}"]) def test_sent_views_require_login(client: FlaskClient, path: str) -> None: response = client.get(path) @@ -47,7 +47,7 @@ def test_sent_lists_sources(app: Flask, client: FlaskClient) -> None: log_in(app, client) identifier = create_sent_source(app) - response = client.get("/sent") + response = client.get("/sources") assert response.status_code == HTTPStatus.OK @@ -55,14 +55,14 @@ def test_sent_lists_sources(app: Flask, client: FlaskClient) -> None: assert "blog/example/index.html" in html assert "https://dennisfink.me/blog/example/" in html - assert f"/sent/{identifier}" in html + assert f"/sources/{identifier}" in html def test_sent_source_lists_webmentions(app: Flask, client: FlaskClient) -> None: log_in(app, client) identifier = create_sent_source(app) - response = client.get(f"/sent/{identifier}") + response = client.get(f"/sources/{identifier}") assert response.status_code == HTTPStatus.OK @@ -86,7 +86,7 @@ def test_sent_source_returns_404_for_unknown_source( app: Flask, client: FlaskClient ) -> None: log_in(app, client) - response = client.get(f"/sent/{uuid.uuid7()}") + response = client.get(f"/sources/{uuid.uuid7()}") assert response.status_code == HTTPStatus.NOT_FOUND @@ -205,7 +205,7 @@ def test_reverify_received_webmention( def test_rescan_sent_sources_requires_login(client: FlaskClient) -> None: - response = client.post("/sent/rescan") + response = client.post("/sources/rescan") assert response.status_code == HTTPStatus.FOUND assert "/login" in response.headers["Location"] @@ -224,7 +224,7 @@ def test_rescan_sent_sources( manual_scan_sources = Mock() monkeypatch.setattr(views_module, "manual_scan_sources", manual_scan_sources) - response = client.post("/sent/rescan") + response = client.post("/sources/rescan") assert response.status_code == ( HTTPStatus.FOUND if valid else HTTPStatus.BAD_REQUEST @@ -232,14 +232,14 @@ def test_rescan_sent_sources( form.validate_on_submit.assert_called_once_with() if valid: - assert response.headers["Location"].endswith("/sent") + assert response.headers["Location"].endswith("/sources") manual_scan_sources.assert_called_once_with() else: manual_scan_sources.assert_not_called() def test_resend_sent_webmention_requires_login(client: FlaskClient) -> None: - response = client.post(f"/sent/{uuid.uuid7()}/{uuid.uuid7()}/resend") + response = client.post(f"/sources/{uuid.uuid7()}/{uuid.uuid7()}/resend") assert response.status_code == HTTPStatus.FOUND assert "/login" in response.headers["Location"] @@ -255,7 +255,9 @@ def test_resend_sent_webmention_rejects_invalid_form( source_identifier, webmention_identifier = create_resendable_sent_webmention(app) mock_admin_action_form(views_module, monkeypatch, valid=False) - response = client.post(f"/sent/{source_identifier}/{webmention_identifier}/resend") + response = client.post( + f"/sources/{source_identifier}/{webmention_identifier}/resend" + ) assert response.status_code == HTTPStatus.BAD_REQUEST @@ -270,7 +272,7 @@ def test_resend_sent_webmention_returns_404_for_unknown_webmention( source_identifier = create_sent_source(app) mock_admin_action_form(views_module, monkeypatch, valid=True) - response = client.post(f"/sent/{source_identifier}/{uuid.uuid7()}/resend") + response = client.post(f"/sources/{source_identifier}/{uuid.uuid7()}/resend") assert response.status_code == HTTPStatus.NOT_FOUND @@ -287,7 +289,7 @@ def test_resend_sent_webmention_rejects_wrong_source( mock_admin_action_form(views_module, monkeypatch, valid=True) response = client.post( - f"/sent/{wrong_source_identifier}/{webmention_identifier}/resend" + f"/sources/{wrong_source_identifier}/{webmention_identifier}/resend" ) assert response.status_code == HTTPStatus.NOT_FOUND @@ -312,10 +314,12 @@ def test_resend_sent_webmention_reopens_current_revision( webmention.next_retry_at = datetime.now(UTC) + timedelta(hours=24) db.session.commit() - response = client.post(f"/sent/{source_identifier}/{webmention_identifier}/resend") + response = client.post( + f"/sources/{source_identifier}/{webmention_identifier}/resend" + ) assert response.status_code == HTTPStatus.FOUND - assert response.headers["Location"].endswith(f"/sent/{source_identifier}") + assert response.headers["Location"].endswith(f"/sources/{source_identifier}") with app.app_context(): webmention = db.session.get(SentWebmention, webmention_identifier) @@ -358,7 +362,7 @@ def test_admin_only_links_safe_existing_status_urls( session["_user_id"] = str(user_id) session["_fresh"] = True - response = client.get(f"/sent/{source_identifier}") + response = client.get(f"/sources/{source_identifier}") assert response.status_code == HTTPStatus.OK html = response.get_data(as_text=True) assert (f'href="{status_url}"' in html) is safe -- cgit v1.3.1