sync: 同步 v1.0.4 开源代码并脱敏
This commit is contained in:
@@ -211,7 +211,7 @@ func TestExecuteTrafficCutoffValidationFailureAllowsValidRows(t *testing.T) {
|
||||
if len(repo.saved) != 2 {
|
||||
t.Fatalf("saved count = %d, want 2; saved = %+v", len(repo.saved), repo.saved)
|
||||
}
|
||||
if repo.saved[0].Success || repo.saved[0].Message != "ICCID is outside the current operator authorization scope" {
|
||||
if repo.saved[0].Success || repo.saved[0].Message != "ICCID不在当前操作员授权范围内" {
|
||||
t.Fatalf("invalid row result = %+v", repo.saved[0])
|
||||
}
|
||||
if !repo.saved[1].Success {
|
||||
@@ -522,3 +522,22 @@ func (u *fakeUpstream) ChangeSimApnFunction(_ context.Context, input *model.SimC
|
||||
u.input = input
|
||||
return u.response, u.responseError
|
||||
}
|
||||
|
||||
func TestValidateDetailCollectsIndependentDiagnostics(t *testing.T) {
|
||||
detail := &Detail{ICCID: "card", Authorized: true, InputMSISDN: "wrong-phone", InputIMSI: "wrong-imsi", Card: &Card{MSISDN: "phone", IMSI: "imsi"}}
|
||||
validateDetail(Operation{}, detail)
|
||||
want := "ICCID缺少通道标识;MSISDN与卡档案不一致;IMSI与卡档案不一致"
|
||||
if detail.Reason != want {
|
||||
t.Fatalf("独立校验原因丢失: got=%q want=%q", detail.Reason, want)
|
||||
}
|
||||
unauthorized := &Detail{ICCID: "card", InputMSISDN: "wrong", Card: &Card{MSISDN: "phone"}}
|
||||
validateDetail(Operation{}, unauthorized)
|
||||
if unauthorized.Reason != "ICCID不在当前操作员授权范围内" {
|
||||
t.Fatalf("越权卡不应返回其他数据差异: %q", unauthorized.Reason)
|
||||
}
|
||||
existing := &Detail{Reason: "原始输入格式错误", Authorized: true, Card: &Card{}}
|
||||
validateDetail(Operation{}, existing)
|
||||
if existing.Reason != "原始输入格式错误" {
|
||||
t.Fatal("原始原因被覆盖")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user