feat(propose): honor project initial_state (§22.4b active landing + unreviewed)

This commit is contained in:
Ben Stull
2026-06-03 23:48:08 -07:00
parent e8ce3cd228
commit fe47eefdd9
2 changed files with 51 additions and 1 deletions
@@ -0,0 +1,43 @@
"""§22.4b — a project with initial_state='active' lands new entries active +
unreviewed; the default 'super-draft' project is unchanged."""
from __future__ import annotations
from fastapi.testclient import TestClient
from test_propose_vertical import ( # noqa: F401
app_with_fake_gitea, tmp_env, provision_user_row, sign_in_as,
)
def _propose(client):
return client.post("/api/rfcs/propose", json={
"title": "Active Lander", "slug": "active-lander",
"pitch": "Lands active.", "tags": [],
})
def test_super_draft_default_unchanged(app_with_fake_gitea):
from app import entry as entry_mod
app, fake = app_with_fake_gitea
with TestClient(app) as client:
provision_user_row(user_id=1, login="ben", role="owner")
sign_in_as(client, user_id=1, gitea_login="ben", display_name="Ben", role="owner")
assert _propose(client).status_code == 200
f = fake.files[("wiggleverse", "meta", "propose/active-lander", "rfcs/active-lander.md")]
e = entry_mod.parse(f["content"])
assert e.state == "super-draft"
assert e.unreviewed is False
def test_active_initial_state_lands_active_unreviewed(app_with_fake_gitea):
from app import db, entry as entry_mod
app, fake = app_with_fake_gitea
with TestClient(app) as client:
db.conn().execute("UPDATE projects SET initial_state='active' WHERE id='default'")
provision_user_row(user_id=1, login="ben", role="owner")
sign_in_as(client, user_id=1, gitea_login="ben", display_name="Ben", role="owner")
assert _propose(client).status_code == 200
f = fake.files[("wiggleverse", "meta", "propose/active-lander", "rfcs/active-lander.md")]
e = entry_mod.parse(f["content"])
assert e.state == "active"
assert e.unreviewed is True