§22 S2: @S2 acceptance — anonymous empty public collection catalog (C3.6)
Anonymous reader of an empty public collection gets a 200 empty catalog and no propose action (the propose route rejects anonymous); the Catalog footer's 'Sign in to propose' prompt is the existing anonymous affordance. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -139,3 +139,21 @@ def test_scoped_routes_404_for_collection_outside_project(app_with_fake_gitea):
|
||||
with TestClient(app) as client:
|
||||
r = client.get("/api/projects/default/collections/nope/rfcs")
|
||||
assert r.status_code == 404
|
||||
|
||||
|
||||
def test_s2_anonymous_empty_public_collection(app_with_fake_gitea):
|
||||
"""C3.6 (@S2): a public collection with no entries; an anonymous visitor
|
||||
lands on its catalog → an empty catalog (200, no items), and the propose
|
||||
action is not available to them (the propose route rejects anonymous)."""
|
||||
app, _ = app_with_fake_gitea
|
||||
with TestClient(app) as client:
|
||||
_add_features_collection() # public, no entries
|
||||
# Anonymous (no session cookie) reads the empty catalog — 200, [].
|
||||
r = client.get("/api/projects/default/collections/features/rfcs")
|
||||
assert r.status_code == 200, r.text
|
||||
assert r.json()["items"] == []
|
||||
# No propose action for an anonymous visitor.
|
||||
r2 = client.post(
|
||||
"/api/projects/default/collections/features/rfcs/propose",
|
||||
json={"title": "X", "slug": "x", "pitch": "p", "tags": []})
|
||||
assert r2.status_code == 401
|
||||
|
||||
Reference in New Issue
Block a user