From 0eb4d0b53dd0640276fb6baac86f4e9491c25789 Mon Sep 17 00:00:00 2001 From: OpenWaygate <27287694+OpenWaygate@users.noreply.github.com> Date: Thu, 4 Sep 2025 00:30:19 +0800 Subject: [PATCH] :white_check_mark: Pass service test and optimize imports --- pkg/auth/service_test.go | 18 ++++++++---------- pkg/channelBanner/channelBanner.go | 1 - pkg/playlistImage/playlistImage.go | 1 - pkg/thumbnail/thumbnail.go | 1 - pkg/video/video.go | 1 - pkg/watermark/watermark.go | 1 - 6 files changed, 8 insertions(+), 15 deletions(-) diff --git a/pkg/auth/service_test.go b/pkg/auth/service_test.go index 8f77586..1f12293 100644 --- a/pkg/auth/service_test.go +++ b/pkg/auth/service_test.go @@ -40,7 +40,7 @@ func TestNewY2BService(t *testing.T) { want: &svc{ Credential: credential, CacheToken: cacheToken, - Cacheable: false, + credFile: "client_secret.json", ctx: context.Background(), }, }, @@ -48,18 +48,14 @@ func TestNewY2BService(t *testing.T) { name: "with all options - base64", args: args{ opts: []Option{ - WithCredential( - "eyJjbGllbnRfaWQiOiJ0ZXN0In0=", mockFS, - ), - WithCacheToken( - "eyJhY2Nlc3NfdG9rZW4iOiJ0ZXN0In0=", mockFS, - ), + WithCredential("eyJjbGllbnRfaWQiOiJ0ZXN0In0=", mockFS), + WithCacheToken("eyJhY2Nlc3NfdG9rZW4iOiJ0ZXN0In0=", mockFS), }, }, want: &svc{ Credential: credential, CacheToken: cacheToken, - Cacheable: false, + credFile: "client_secret.json", ctx: context.Background(), }, }, @@ -74,7 +70,8 @@ func TestNewY2BService(t *testing.T) { want: &svc{ Credential: credential, CacheToken: cacheToken, - Cacheable: true, + credFile: "/client_secrets.json", + tokenFile: "/youtube.token.json", ctx: context.Background(), }, }, @@ -84,7 +81,8 @@ func TestNewY2BService(t *testing.T) { opts: []Option{}, }, want: &svc{ - ctx: context.Background(), + credFile: "client_secret.json", + ctx: context.Background(), }, }, } diff --git a/pkg/channelBanner/channelBanner.go b/pkg/channelBanner/channelBanner.go index f9a6168..217eccc 100644 --- a/pkg/channelBanner/channelBanner.go +++ b/pkg/channelBanner/channelBanner.go @@ -4,7 +4,6 @@ import ( "errors" "fmt" "io" - "os" "github.com/eat-pray-ai/yutu/pkg" "github.com/eat-pray-ai/yutu/pkg/auth" diff --git a/pkg/playlistImage/playlistImage.go b/pkg/playlistImage/playlistImage.go index 2f43806..bd2d505 100644 --- a/pkg/playlistImage/playlistImage.go +++ b/pkg/playlistImage/playlistImage.go @@ -4,7 +4,6 @@ import ( "errors" "fmt" "io" - "os" "github.com/eat-pray-ai/yutu/pkg" "github.com/eat-pray-ai/yutu/pkg/auth" diff --git a/pkg/thumbnail/thumbnail.go b/pkg/thumbnail/thumbnail.go index 87bddd3..ea3ae11 100644 --- a/pkg/thumbnail/thumbnail.go +++ b/pkg/thumbnail/thumbnail.go @@ -4,7 +4,6 @@ import ( "errors" "fmt" "io" - "os" "github.com/eat-pray-ai/yutu/pkg" "github.com/eat-pray-ai/yutu/pkg/auth" diff --git a/pkg/video/video.go b/pkg/video/video.go index 749fa98..034d617 100644 --- a/pkg/video/video.go +++ b/pkg/video/video.go @@ -4,7 +4,6 @@ import ( "errors" "fmt" "io" - "os" "slices" "github.com/eat-pray-ai/yutu/pkg" diff --git a/pkg/watermark/watermark.go b/pkg/watermark/watermark.go index 42b1e19..ff109e4 100644 --- a/pkg/watermark/watermark.go +++ b/pkg/watermark/watermark.go @@ -4,7 +4,6 @@ import ( "errors" "fmt" "io" - "os" "github.com/eat-pray-ai/yutu/pkg" "github.com/eat-pray-ai/yutu/pkg/auth"