diff --git a/web/tests/test_content.py b/web/tests/test_content.py index 77add6f..c70063c 100644 --- a/web/tests/test_content.py +++ b/web/tests/test_content.py @@ -839,18 +839,21 @@ class TestArticleServing: resp = await client.get("/en/padel-court-cost-nonexistent") assert resp.status_code == 404 - async def test_draft_article_returns_404(self, client, db): + async def test_draft_article_redirects_to_parent(self, client, db): + # Draft articles are not served; the route redirects to the nearest parent + # rather than showing a bare 404. await _create_article(slug="draft-serve", url_path="/draft-serve", status="draft") resp = await client.get("/en/draft-serve") - assert resp.status_code == 404 + assert resp.status_code == 302 - async def test_future_article_returns_404(self, client, db): + async def test_future_article_redirects_to_parent(self, client, db): + # Scheduled (not yet live) articles redirect to the parent path instead of 404. await _create_article( slug="future-serve", url_path="/future-serve", status="published", published_at="2099-01-01T00:00:00", ) resp = await client.get("/en/future-serve") - assert resp.status_code == 404 + assert resp.status_code == 302 async def test_published_article_served(self, client, db): from padelnomics.content.routes import BUILD_DIR @@ -1256,8 +1259,8 @@ class TestAdminDashboardLinks: async def test_dashboard_has_content_links(self, admin_client): resp = await admin_client.get("/admin/") html = (await resp.data).decode() - assert "/admin/templates" in html - assert "/admin/scenarios" in html + # Sidebar always shows the Content entry point (/admin/articles). + # Templates and Scenarios appear in the subnav only when on a content page. assert "/admin/articles" in html diff --git a/web/tests/test_seo.py b/web/tests/test_seo.py index 06fb56a..31e8a1a 100644 --- a/web/tests/test_seo.py +++ b/web/tests/test_seo.py @@ -499,7 +499,8 @@ class TestSeoAdminRoutes: async def test_seo_sidebar_link(self, admin_client, db): resp = await admin_client.get("/admin/") text = await resp.get_data(as_text=True) - assert "SEO Hub" in text + # Sidebar link goes to /admin/seo (labelled "Analytics" in the nav). + assert "/admin/seo" in text # ── Assertion boundary tests ─────────────────────────────────