feat(dingtalk): stabilize multimodal answer workflows
This commit is contained in:
@@ -88,7 +88,7 @@ func TestControllerSettingMenuExplainsLanguageWithoutAdminActionsToOrdinaryUser(
|
||||
}
|
||||
}
|
||||
|
||||
func TestControllerSettingMenuExplainsAdminActionsAndBackendAccess(t *testing.T) {
|
||||
func TestControllerSettingMenuExplainsAdminActionsWithoutBackendAccess(t *testing.T) {
|
||||
r := newMemoryRepo()
|
||||
r.admins["t/a"] = true
|
||||
c := NewController(r)
|
||||
@@ -103,15 +103,21 @@ func TestControllerSettingMenuExplainsAdminActionsAndBackendAccess(t *testing.T)
|
||||
"/setting question",
|
||||
"/setting faq",
|
||||
"Schema验证通过后激活并短暂重启",
|
||||
} {
|
||||
if !strings.Contains(out, want) {
|
||||
t.Fatalf("reply=%q must contain %q", out, want)
|
||||
}
|
||||
}
|
||||
for _, forbidden := range []string{
|
||||
"管理后台",
|
||||
"SSH隧道",
|
||||
"127.0.0.1:8090/admin/settings",
|
||||
"Basic Auth",
|
||||
"DOBOTAI_ADMIN_TOKEN",
|
||||
"新管理员私聊 /setting <6位码>",
|
||||
"新管理员生效后再停用旧管理员",
|
||||
"回后台确认",
|
||||
} {
|
||||
if !strings.Contains(out, want) {
|
||||
t.Fatalf("reply=%q must contain %q", out, want)
|
||||
if strings.Contains(out, forbidden) {
|
||||
t.Fatalf("reply=%q must not contain %q", out, forbidden)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -312,11 +318,14 @@ func TestControllerDetectsBootstrapCandidate(t *testing.T) {
|
||||
r := newMemoryRepo()
|
||||
c := NewController(r)
|
||||
c.now = func() time.Time { return time.Unix(100, 0) }
|
||||
_, err := c.Handle(context.Background(), SettingInput{TenantKey: "t", StaffID: "a", UnionID: "union", DisplayName: "Alice", Text: "/setting 123456", ConversationType: "direct"})
|
||||
out, err := c.Handle(context.Background(), SettingInput{TenantKey: "t", StaffID: "a", UnionID: "union", DisplayName: "Alice", Text: "/setting 123456", ConversationType: "direct"})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if r.candidate.Code != "123456" || r.candidate.StaffID != "a" {
|
||||
t.Fatalf("candidate=%+v", r.candidate)
|
||||
}
|
||||
if !strings.Contains(out, "服务器命令行") || strings.Contains(out, "后台") {
|
||||
t.Fatalf("reply=%q must direct confirmation back to the server CLI only", out)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user