feat: 移除 Client 真实采购手工授权 (#114)
This commit is contained in:
@@ -403,7 +403,7 @@ func TestCreatePurchaseTasksWithOptions_正常采购员可创建真实任务(t *
|
||||
}
|
||||
}
|
||||
|
||||
func TestCreatePurchaseTasksWithOptions_真实模式保留账号和Client能力门禁(t *testing.T) {
|
||||
func TestCreatePurchaseTasksWithOptions_真实模式不要求Client预先声明Live(t *testing.T) {
|
||||
db := newTestDB(t)
|
||||
key := seedPurchasableWorkflow(t, db, "SYB-GATE")
|
||||
SaveSybMapping(db, "SYB-GATE", key, "USR-1")
|
||||
@@ -411,10 +411,11 @@ func TestCreatePurchaseTasksWithOptions_真实模式保留账号和Client能力
|
||||
RegisterClient(db, model.Client{ClientID: "CLIENT-DRY", Capabilities: `{"purchase_mode":"dry_run"}`}, true)
|
||||
request := []PurchaseTaskRequest{{SybID: "SYB-GATE", MaxPriceCent: 4200}}
|
||||
|
||||
if _, err := CreatePurchaseTasksWithOptions(db, admin, request, PurchaseTaskOptions{
|
||||
result, err := CreatePurchaseTasksWithOptions(db, admin, request, PurchaseTaskOptions{
|
||||
ClientID: "CLIENT-DRY", ExecutionMode: model.TaskExecutionLive,
|
||||
}); err == nil || !strings.Contains(err.Error(), "未声明 live") {
|
||||
t.Fatalf("dry_run 客户端必须被拒绝: %v", err)
|
||||
})
|
||||
if err != nil || result.Created != 1 {
|
||||
t.Fatalf("当前账号可见客户端不应被历史能力状态阻止: result=%+v err=%v", result, err)
|
||||
}
|
||||
disabled := *admin
|
||||
disabled.Status = model.UserDisabled
|
||||
|
||||
Reference in New Issue
Block a user