Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
陈曦
sub2api
Commits
9bd6a62a
Commit
9bd6a62a
authored
Feb 24, 2026
by
cagedbird043
Browse files
test: 更新 Gemini OAuth 内置回退测试用例
parent
0dbea6ca
Changes
1
Hide whitespace changes
Inline
Side-by-side
backend/internal/pkg/geminicli/oauth_test.go
View file @
9bd6a62a
...
...
@@ -408,11 +408,10 @@ func TestBuildAuthorizationURL_WithProjectID(t *testing.T) {
}
}
func
TestBuildAuthorizationURL_OAuthConfigError
(
t
*
testing
.
T
)
{
// 不设置环境变量,也不提供 client 凭据,EffectiveOAuthConfig 应该报错
func
TestBuildAuthorizationURL_UsesBuiltinSecretFallback
(
t
*
testing
.
T
)
{
t
.
Setenv
(
GeminiCLIOAuthClientSecretEnv
,
""
)
_
,
err
:=
BuildAuthorizationURL
(
authURL
,
err
:=
BuildAuthorizationURL
(
OAuthConfig
{},
"test-state"
,
"test-challenge"
,
...
...
@@ -420,8 +419,11 @@ func TestBuildAuthorizationURL_OAuthConfigError(t *testing.T) {
""
,
"code_assist"
,
)
if
err
==
nil
{
t
.
Error
(
"当 EffectiveOAuthConfig 失败时,BuildAuthorizationURL 应该返回错误"
)
if
err
!=
nil
{
t
.
Fatalf
(
"BuildAuthorizationURL() 不应报错: %v"
,
err
)
}
if
!
strings
.
Contains
(
authURL
,
"client_id="
+
GeminiCLIOAuthClientID
)
{
t
.
Errorf
(
"应使用内置 Gemini CLI client_id,实际 URL: %s"
,
authURL
)
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment