✨ feat: WP-11 社区——发布、互动、关注与治理
- 迁移 12:community_content(帖子/角色 Release、publication 六态、可见性)、comment(父级树)、reaction((content,actor,kind) 唯一防重复)、follow(双 FK 显式命名修复 convention 冲突)、report + moderation_case(举报即建司议案) - 发布:帖子直发;角色 Release 由服务端构造公开快照(name/道体/版本数)——私密记忆/关系/对话结构性缺席,测试以注入私密记忆后发布验证零泄露 - 互动:评论(父级校验同内容可见)、点赞/收藏(重复 409、取消后计数正确) - 关注/取关与计数;举报自动生成司议案(治理队列入口,status=pending) - 下架传播:removed 后列表/详情/评论统一 404 或过滤(require_content 单点);非作者下架 404 fail-closed - 测试基建修复:login 返回自包含 headers(显式 Cookie 优先),多用户交替不再串会话 - 测试 79 项全绿(+7)
This commit is contained in:
1 parent
34c481ab9e
commit
99985f5855
7 files changed
+823
-2
No files matched your search
@@ -74,10 +74,21 @@ async def client(db):
|
||||
|
||||
|
||||
async def login(client, email: str) -> dict[str, str]:
|
||||
"""开发档登录:返回需附加的请求头(Cookie 由客户端自动携带)。"""
|
||||
"""开发档登录:返回自包含请求头(显式 Cookie 支持多用户交替)。
|
||||
|
||||
同时保留 cookie jar 自动存储:不带 headers 的旧式请求仍走 jar。
|
||||
显式 Cookie header 优先于 jar(httpx 行为),交替测试不串会话。
|
||||
"""
|
||||
resp = await client.post("/v1/auth/sessions", json={"email": email})
|
||||
assert resp.status_code == 201, resp.text
|
||||
return {"Hunjing-CSRF-Token": resp.json()["csrf_token"]}
|
||||
from app.auth.service import SESSION_COOKIE
|
||||
|
||||
token = resp.cookies.get(SESSION_COOKIE)
|
||||
assert token, "登录未签发会话 Cookie"
|
||||
return {
|
||||
"Hunjing-CSRF-Token": resp.json()["csrf_token"],
|
||||
"Cookie": f"{SESSION_COOKIE}={token}",
|
||||
}
|
||||
|
||||
|
||||
def _mock_openai_stream():
|
||||
|
||||
Reference in new issue
Block a user