FetchGoogleOneTier 原先在方法内部直接创建 DriveClient 实例, 导致单元测试中对 googleapis.com 发起真实 HTTP 请求,在 CI 环境 产生 401 错误。 将 DriveClient 作为依赖注入到 GeminiOAuthService,遵循项目 端口与适配器架构规范: - 新增 repository/gemini_drive_client.go 作为 Provider - 注册到 repository Wire ProviderSet - 测试中使用 mockDriveClient 替代真实调用
10 lines
326 B
Go
10 lines
326 B
Go
package repository
|
|
|
|
import "github.com/Wei-Shaw/sub2api/internal/pkg/geminicli"
|
|
|
|
// NewGeminiDriveClient creates a concrete DriveClient for Google Drive API operations.
|
|
// Returned as geminicli.DriveClient interface for DI (Strategy A).
|
|
func NewGeminiDriveClient() geminicli.DriveClient {
|
|
return geminicli.NewDriveClient()
|
|
}
|