fix(tests): update stale test assertions to match current behavior
- test_draft/future_article: route intentionally redirects to parent (302) instead of bare 404 — rename tests and update assertion accordingly - test_dashboard_has_content_links: /admin/templates and /admin/scenarios are subnav links shown only on content section pages, not the main dashboard; test now only checks /admin/articles which is always in the sidebar - test_seo_sidebar_link: sidebar labels the link "Analytics" (not "SEO Hub" which is the page title); test now checks for /admin/seo URL presence Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
|
||||
@@ -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 ─────────────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user