test(antigravity): add missing unit tests for upstream and custom model_mapping

- Add GetAccessToken upstream branch tests (success/failure/empty/nil)
- Add mapAntigravityModel wildcard-target-equals-request edge case tests
- Add upstream account smart retry test case
- Add GeminiMessagesCompatService custom model_mapping and empty model tests
This commit is contained in:
erio
2026-02-07 14:39:25 +08:00
parent de0927289e
commit 386126b1b2
4 changed files with 203 additions and 0 deletions

View File

@@ -905,6 +905,39 @@ func TestGeminiMessagesCompatService_isModelSupportedByAccount(t *testing.T) {
model: "gpt-4",
expected: false,
},
{
name: "Antigravity平台-空模型允许",
account: &Account{Platform: PlatformAntigravity},
model: "",
expected: true,
},
{
name: "Antigravity平台-自定义映射-支持自定义模型",
account: &Account{
Platform: PlatformAntigravity,
Credentials: map[string]any{
"model_mapping": map[string]any{
"my-custom-model": "upstream-model",
"gpt-4o": "some-model",
},
},
},
model: "my-custom-model",
expected: true,
},
{
name: "Antigravity平台-自定义映射-不在映射中的模型不支持",
account: &Account{
Platform: PlatformAntigravity,
Credentials: map[string]any{
"model_mapping": map[string]any{
"my-custom-model": "upstream-model",
},
},
},
model: "claude-sonnet-4-5",
expected: false,
},
{
name: "Gemini平台-无映射配置-支持所有模型",
account: &Account{Platform: PlatformGemini},