Fix empty-category nav and route behavior
Use category-state-driven queries for nav and category listing routes, and add regression tests for empty but valid categories. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -37,3 +37,14 @@ def test_categories_nav_tag_renders_category_link(client, home_page):
|
||||
resp = client.get("/")
|
||||
assert resp.status_code == 200
|
||||
assert "/articles/category/reviews/" in resp.content.decode()
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_categories_nav_tag_includes_empty_nav_category(client, home_page):
|
||||
index = ArticleIndexPage(title="Articles", slug="articles")
|
||||
home_page.add_child(instance=index)
|
||||
Category.objects.create(name="Benchmarks", slug="benchmarks", show_in_nav=True)
|
||||
|
||||
resp = client.get("/")
|
||||
assert resp.status_code == 200
|
||||
assert "/articles/category/benchmarks/" in resp.content.decode()
|
||||
|
||||
Reference in New Issue
Block a user