9ca07a3f81
- collections.py resolution helpers (default_collection_id, type, initial_state) - registry mirror writes project grouping fields + default-collection corpus fields - auth.project_of_rfc joins collections; project_member_role reads memberships - cache/api_*/funder writers+readers re-keyed to collection_id (cached_prs + denormalised project_id tags unchanged); api_deployment reads type/initial_state from the default collection - projects.py restamp detects bootstrap via collections; initial_state via collection - tests updated to the three-tier schema; test_migration_028 retired (superseded by 029) - add @S1 acceptance test (collection grain + N=1 serving) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
44 lines
1.8 KiB
Python
44 lines
1.8 KiB
Python
"""§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 collections SET initial_state='active' WHERE project_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
|