Feedback admin: 404 on missing id for read/delete
Per audit: read-toggle and delete returned {"ok":true} even for a nonexistent
id. Return 404 when no row is affected, so the optimistic UI can distinguish a
stale/already-deleted row from a real success. (The postJSON/delJSON imports
flagged in the audit were already present — verified in source + built bundle.)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -88,3 +88,9 @@ def test_feedback_admin_actions_gated(tmp_path, monkeypatch):
|
||||
anon = TestClient(app)
|
||||
assert anon.post("/api/admin/feedback/1/read", json={"read": True}).status_code == 401
|
||||
assert anon.delete("/api/admin/feedback/1").status_code == 401
|
||||
|
||||
|
||||
def test_feedback_actions_404_on_missing_id(tmp_path, monkeypatch):
|
||||
tc = _admin_client(tmp_path, monkeypatch)
|
||||
assert tc.post("/api/admin/feedback/9999/read", json={"read": True}).status_code == 404
|
||||
assert tc.delete("/api/admin/feedback/9999").status_code == 404
|
||||
|
||||
Reference in New Issue
Block a user