test: cover asset raw round-trip and harden cross-user session upsert
Deny foreign user_id upsert without manage rights (403); unique project names in ctxmgr PG fixture for global name index; add test-env data repair SQL. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -153,11 +153,12 @@ func TestContextManager_DatabaseIntegration(t *testing.T) {
|
||||
// 准备真实项目与用户
|
||||
var projID int64
|
||||
projCode := "PROJ_MGR_" + time.Now().Format("20060102150405")
|
||||
projName := "智能微创内窥镜-" + time.Now().Format("150405.000")
|
||||
err = pool.QueryRow(ctx, `
|
||||
INSERT INTO projects (code, name, customer_name, device_type, current_stage)
|
||||
VALUES ($1, '智能微创内窥镜', '水木创新中心', '内窥镜', 'V0.5_feasibility')
|
||||
VALUES ($1, $2, '水木创新中心', '内窥镜', 'V0.5_feasibility')
|
||||
RETURNING id
|
||||
`, projCode).Scan(&projID)
|
||||
`, projCode, projName).Scan(&projID)
|
||||
if err != nil {
|
||||
t.Fatalf("insert project failed: %v", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user