From 6f9e6903452f140dd97ceacf6e3ebcc827e4dee9 Mon Sep 17 00:00:00 2001 From: QTom Date: Sat, 28 Feb 2026 20:55:31 +0800 Subject: [PATCH] =?UTF-8?q?test(sora):=20=E8=A1=A5=E5=85=85=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=20stub=20=E4=B8=AD=E7=BC=BA=E5=A4=B1=E7=9A=84=20AddGr?= =?UTF-8?q?oupToAllowedGroups=20=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit feat/admin-apikey-group-update 分支给 UserRepository 接口新增了 AddGroupToAllowedGroups 方法,需要在测试 stub 中补充实现以通过编译。 - sora_client_handler_test.go: stubUserRepoForHandler - sora_generation_service_test.go: stubUserRepoForQuota --- backend/internal/handler/sora_client_handler_test.go | 3 +++ backend/internal/service/sora_generation_service_test.go | 3 +++ 2 files changed, 6 insertions(+) diff --git a/backend/internal/handler/sora_client_handler_test.go b/backend/internal/handler/sora_client_handler_test.go index a639e504..085658ad 100644 --- a/backend/internal/handler/sora_client_handler_test.go +++ b/backend/internal/handler/sora_client_handler_test.go @@ -945,6 +945,9 @@ func (r *stubUserRepoForHandler) RemoveGroupFromAllowedGroups(context.Context, i func (r *stubUserRepoForHandler) UpdateTotpSecret(context.Context, int64, *string) error { return nil } func (r *stubUserRepoForHandler) EnableTotp(context.Context, int64) error { return nil } func (r *stubUserRepoForHandler) DisableTotp(context.Context, int64) error { return nil } +func (r *stubUserRepoForHandler) AddGroupToAllowedGroups(context.Context, int64, int64) error { + return nil +} // ==================== NewSoraClientHandler ==================== diff --git a/backend/internal/service/sora_generation_service_test.go b/backend/internal/service/sora_generation_service_test.go index 820945f0..46f322c8 100644 --- a/backend/internal/service/sora_generation_service_test.go +++ b/backend/internal/service/sora_generation_service_test.go @@ -165,6 +165,9 @@ func (r *stubUserRepoForQuota) RemoveGroupFromAllowedGroups(context.Context, int func (r *stubUserRepoForQuota) UpdateTotpSecret(context.Context, int64, *string) error { return nil } func (r *stubUserRepoForQuota) EnableTotp(context.Context, int64) error { return nil } func (r *stubUserRepoForQuota) DisableTotp(context.Context, int64) error { return nil } +func (r *stubUserRepoForQuota) AddGroupToAllowedGroups(context.Context, int64, int64) error { + return nil +} // ==================== 辅助函数:构造带 CDN 缓存的 SoraS3Storage ====================