test: extend advisor e2e fixtures

This commit is contained in:
Windows
2026-09-11 17:59:47 +08:00
parent 3e4f21388c
commit 95633188f1
2 changed files with 28 additions and 10 deletions
+20 -3
View File
@@ -44,10 +44,27 @@ PERMISSIONS: tuple[tuple[int, str, str, str, str], ...] = (
(9015, "config:review", "config", "review", "all"),
(9016, "config:activate", "config", "activate", "all"),
(9017, "model-endpoint:manage", "model-endpoint", "manage", "all"),
(9018, "investment-goal:write:self", "investment-goal", "write", "self"),
(9019, "investment-goal:confirm:self", "investment-goal", "confirm", "self"),
(9020, "investment-goal:read:self", "investment-goal", "read", "self"),
(9021, "product-recommendation:generate:self", "product-recommendation", "generate", "self"),
(9022, "product-recommendation:read:self", "product-recommendation", "read", "self"),
(9023, "portfolio-analysis:read:self", "portfolio-analysis", "read", "self"),
(9024, "asset-allocation:generate:self", "asset-allocation", "generate", "self"),
(9025, "profile-governance:read", "profile-governance", "read", "all"),
(9026, "profile-governance:review", "profile-governance", "review", "all"),
(9027, "investment-goal:review", "investment-goal", "review", "all"),
(9028, "investment-goal:publish", "investment-goal", "publish", "all"),
(9029, "product-recommendation:review", "product-recommendation", "review", "all"),
(9030, "product-recommendation:publish", "product-recommendation", "publish", "all"),
(9031, "asset-allocation:backtest", "asset-allocation", "backtest", "all"),
)
# 客户:业务侧自助能力(自己的会话、反馈、转人工、自己的记忆画像)。
CUSTOMER_PERMISSIONS = (9001, 9002, 9003, 9004, 9005, 9006, 9007, 9008, 9009, 9011)
CUSTOMER_PERMISSIONS = (
9001, 9002, 9003, 9004, 9005, 9006, 9007, 9008, 9009, 9011,
9018, 9019, 9020, 9021, 9022, 9023, 9024,
)
# 风控专员:业务侧只读 + 跨客户记忆 + 审计只读,不含配置写权限。
RISK_PERMISSIONS = (9001, 9002, 9003, 9010, 9011, 9012)
# 平台管理员:管理面全套(配置发布四态 + 模型端点 + 审计)。
@@ -88,8 +105,6 @@ async def seed() -> None:
await session.execute(text("DELETE FROM sys_user_role WHERE user_id IN (9001,9002,9003)"))
await session.execute(text("DELETE FROM sys_permission WHERE id BETWEEN 9001 AND 9099"))
await session.execute(text("DELETE FROM sys_role WHERE id IN (9001,9002,9003)"))
await session.execute(text("DELETE FROM sys_user WHERE id IN (9001,9002,9003)"))
for user_id, user_no, user_name, user_type in USERS:
await session.execute(
text(
@@ -97,6 +112,8 @@ async def seed() -> None:
" professional_investor_status, fund_account_status, status,"
" created_at, updated_at)"
" VALUES (:id,:no,:name,'x',:type,'none','closed','正常',:now,:now)"
" ON DUPLICATE KEY UPDATE user_no=VALUES(user_no), username=VALUES(username),"
" user_type=VALUES(user_type), status=VALUES(status), updated_at=VALUES(updated_at)"
),
{"id": user_id, "no": user_no, "name": user_name, "type": user_type, "now": now},
)