Add projects
This commit is contained in:
parent
2d3a9ad623
commit
8b607dd700
1802 changed files with 503346 additions and 2 deletions
29
backend/sdk/cliproxy/auth/api_key_model_compat_test.go
Normal file
29
backend/sdk/cliproxy/auth/api_key_model_compat_test.go
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
package auth
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
internalconfig "github.com/router-for-me/CLIProxyAPI/v7/internal/config"
|
||||
cliproxyexecutor "github.com/router-for-me/CLIProxyAPI/v7/sdk/cliproxy/executor"
|
||||
)
|
||||
|
||||
func TestResolvedAPIKeyModelInfoPropagatesIsCompat(t *testing.T) {
|
||||
manager := NewManager(nil, nil, nil)
|
||||
manager.SetConfig(&internalconfig.Config{ClaudeKey: []internalconfig.ClaudeKey{{
|
||||
APIKey: "compat-key",
|
||||
Prefix: "tenant",
|
||||
Models: []internalconfig.ClaudeModel{{
|
||||
Name: "deepseek-upstream",
|
||||
Alias: "deepseek-alias",
|
||||
IsCompat: true,
|
||||
}},
|
||||
}}})
|
||||
auth := configuredCapabilityTestAuth("compat-auth", "compat-key")
|
||||
registerCapabilityTestAuth(t, manager, auth)
|
||||
|
||||
req := manager.attachResolvedAPIKeyModelInfo(cliproxyexecutor.Request{}, auth, "tenant/deepseek-alias", "deepseek-upstream")
|
||||
info, ok := ResolvedAPIKeyModelInfo(req)
|
||||
if !ok || info == nil || !info.IsCompat {
|
||||
t.Fatalf("ResolvedAPIKeyModelInfo() = (%+v, %t), want IsCompat=true", info, ok)
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue