Files
CLIProxyAPI/internal/config/claude_code_test.go
Luis Pater 6914478562 feat(config): add support for disabling model list cloaking in Claude Code
- Introduced `DisableCloakingModelList` in `ClaudeCodeConfig` to control model ID cloaking in Anthropic model list responses.
- Updated relevant APIs and handlers to respect the new configuration.
- Added comprehensive tests for enabling/disabling cloaking behavior and config-driven hot reload scenarios.
- Extended example configuration and documentation to include the new setting.

Closes: #4473
2026-07-27 18:16:41 +08:00

35 lines
752 B
Go

package config
import "testing"
func TestParseConfigBytesClaudeCodeModelListCloaking(t *testing.T) {
tests := []struct {
name string
yaml string
want bool
}{
{
name: "defaults to enabled cloaking",
yaml: "port: 8317\n",
want: false,
},
{
name: "disables model list cloaking",
yaml: "claude-code:\n disable-cloaking-model-list: true\n",
want: true,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
cfg, errParse := ParseConfigBytes([]byte(tt.yaml))
if errParse != nil {
t.Fatalf("ParseConfigBytes() error = %v", errParse)
}
if got := cfg.ClaudeCode.DisableCloakingModelList; got != tt.want {
t.Fatalf("DisableCloakingModelList = %t, want %t", got, tt.want)
}
})
}
}