fix: q=category lists only tags on existing posts (v2.12.1)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
PhilandClaude Opus 5.5 committed 2026-11-10 11:28:32 -07:00
1 parent 13936749de
commit b450c0c648
7 files changed
+60 -7

No files matched your search

+12
View File
@@ -198,6 +198,18 @@ class TestQueries:
assert client.get("/micropub?q=category", headers=h).get_json()["categories"] == ["IndieWeb", "python"]
assert client.get("/micropub?q=category&filter=py", headers=h).get_json()["categories"] == ["python"]
def test_category_skips_unused_tags(self, client, h):
"""Tags dropped by an edit or on deleted posts aren't offered (v2.12.1)"""
create(client, h, category=["kept"])
retagged = create(client, h, category=["dropped"])
deleted = create(client, h, category=["trashed"])
body = {"action": "update", "url": retagged, "replace": {"category": ["kept"]}}
assert client.post("/micropub", json=body, headers=h).status_code in (200, 204)
assert client.post("/micropub", json={"action": "delete", "url": deleted}, headers=h).status_code == 204
assert client.get("/micropub?q=category", headers=h).get_json()["categories"] == ["kept"]
assert client.post("/micropub", json={"action": "undelete", "url": deleted}, headers=h).status_code < 300
assert client.get("/micropub?q=category", headers=h).get_json()["categories"] == ["kept", "trashed"]
def test_config_lists_queries(self, client, h):
config = client.get("/micropub?q=config", headers=h).get_json()
assert "category" in config["q"] and "media-endpoint" in config