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:
@@ -233,3 +233,14 @@ def test_article_index_category_route_supports_tag_filter(client, home_page):
|
||||
assert resp.status_code == 200
|
||||
assert "Keep Me" in html
|
||||
assert "Drop Me" not in html
|
||||
|
||||
|
||||
@pytest.mark.django_db
|
||||
def test_article_index_category_route_allows_empty_existing_category(client, home_page):
|
||||
index = ArticleIndexPage(title="Articles", slug="articles")
|
||||
home_page.add_child(instance=index)
|
||||
Category.objects.create(name="Opinion", slug="opinion")
|
||||
|
||||
resp = client.get("/articles/category/opinion/")
|
||||
assert resp.status_code == 200
|
||||
assert "No articles found." in resp.content.decode()
|
||||
|
||||
Reference in New Issue
Block a user