中文:收口权限与中心/立项配置改造

This commit is contained in:
Cheng Zhou
2026-05-12 10:16:52 +08:00
parent 6e90370a5f
commit 77e842637d
67 changed files with 706 additions and 669 deletions
+5 -5
View File
@@ -88,7 +88,7 @@ async def client_and_db():
email="admin@test.com",
password_hash=hash_password("admin123"),
full_name="Admin",
department="Admin",
clinical_department="Admin",
role=UserRole.ADMIN,
status=UserStatus.ACTIVE,
)
@@ -109,7 +109,7 @@ async def test_register_creates_pending_user(client_and_db):
"password": "Password123",
"full_name": "New User",
"role": "CRA",
"department": "Clinical",
"clinical_department": "Clinical",
}
resp = await client.post("/api/v1/auth/register", json=payload)
assert resp.status_code == 201
@@ -141,7 +141,7 @@ async def test_login_blocked_before_approval(client_and_db):
"password": "Password123",
"full_name": "Pending User",
"role": "PV",
"department": "Safety",
"clinical_department": "Safety",
}
await client.post("/api/v1/auth/register", json=payload)
resp = await encrypted_login(client, payload["email"], payload["password"])
@@ -157,7 +157,7 @@ async def test_admin_can_approve_user(client_and_db):
"password": "Password123",
"full_name": "Approve Target",
"role": "IMP",
"department": "Supply",
"clinical_department": "Supply",
}
await client.post("/api/v1/auth/register", json=payload)
async with SessionLocal() as session:
@@ -184,7 +184,7 @@ async def test_admin_role_cannot_register(client_and_db):
"password": "Password123",
"full_name": "Bad Admin",
"role": "ADMIN",
"department": "IT",
"clinical_department": "IT",
}
resp = await client.post("/api/v1/auth/register", json=payload)
assert resp.status_code in (400, 422)