Files
LLMGuardX Dev 87c2b04174 0.11.3: 旗舰版第四轮完善(统一审批中心/工具治理/平台环境变量/数字员工入口/个人渠道/报表多维/租户配额)
- 统一审批中心:模型/资源/渠道/工具四类申请聚合审批,通过自动开通
  (marketplace 安装/渠道授权),outbox 双向站内信;门户可发起/撤回。
- 工具治理:rate_limit_rpm(固定窗口原子 upsert,多实例共享)+ approval_required
  (首次调用自动发起审批,批准前一律拒绝)。
- 平台环境变量:平台级注入 skill/MCP 运行时,个人可覆盖;系统管理员可写。
- 数字员工会话入口:门户列表/对话/调用记录,复用用户运行时凭据。
- 个人渠道:webhook 入站令牌 SHA-256 摘要 + constant-time 校验,绑定已批准
  模型,用量归属用户 Key。
- 报表多维:工具调用/审批授权/安全事件三组统计端点与页面。
- 租户配额:部门 Key/月 Token 上限,运行时凭据开通强制校验,概览展示用量。
- 迁移 000042-000045;修复渠道空 API Key NOT NULL 违约与 inet 扫描;
  25 包测试通过,前后端构建通过,端到端验证完成。
2026-08-13 13:41:22 +08:00

30 lines
844 B
Go

package portal
import "testing"
func TestResourceTypeSupported(t *testing.T) {
for _, kind := range []string{"mcp_server", "skill", "digital_employee", "channel", " MCP_SERVER "} {
if !resourceTypeSupported(kind) {
t.Errorf("kind %q should be supported", kind)
}
}
for _, kind := range []string{"model", "tool", "", "wecom"} {
if resourceTypeSupported(kind) {
t.Errorf("kind %q should not be supported", kind)
}
}
}
func TestPersonalChannelCodePattern(t *testing.T) {
for _, code := range []string{"my_bot", "report-bot", "ab1", "chat2"} {
if !personalChannelCodePattern.MatchString(code) {
t.Errorf("code %q should match", code)
}
}
for _, code := range []string{"Bot", "1bot", "b", "has space", "x!y"} {
if personalChannelCodePattern.MatchString(code) {
t.Errorf("code %q should not match", code)
}
}
}