mirror of
https://github.com/router-for-me/CLIProxyAPI.git
synced 2026-02-18 20:30:51 +08:00
fix(kimi): add OAuth model-alias channel support and cover OAuth excluded-models with tests
This commit is contained in:
45
sdk/cliproxy/service_oauth_excluded_models_test.go
Normal file
45
sdk/cliproxy/service_oauth_excluded_models_test.go
Normal file
@@ -0,0 +1,45 @@
|
||||
package cliproxy
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/router-for-me/CLIProxyAPI/v6/sdk/config"
|
||||
)
|
||||
|
||||
func TestOAuthExcludedModels_KimiOAuth(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
svc := &Service{
|
||||
cfg: &config.Config{
|
||||
OAuthExcludedModels: map[string][]string{
|
||||
"kimi": {"kimi-k2-thinking", "kimi-k2.5"},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
got := svc.oauthExcludedModels("kimi", "oauth")
|
||||
if len(got) != 2 {
|
||||
t.Fatalf("expected 2 excluded models, got %d", len(got))
|
||||
}
|
||||
if got[0] != "kimi-k2-thinking" || got[1] != "kimi-k2.5" {
|
||||
t.Fatalf("unexpected excluded models: %#v", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestOAuthExcludedModels_KimiAPIKeyReturnsNil(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
svc := &Service{
|
||||
cfg: &config.Config{
|
||||
OAuthExcludedModels: map[string][]string{
|
||||
"kimi": {"kimi-k2-thinking"},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
got := svc.oauthExcludedModels("kimi", "apikey")
|
||||
if got != nil {
|
||||
t.Fatalf("expected nil for apikey auth kind, got %#v", got)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user