diff --git a/pkg/filesystem/image_test.go b/pkg/filesystem/image_test.go index 7e21c4c..4180858 100644 --- a/pkg/filesystem/image_test.go +++ b/pkg/filesystem/image_test.go @@ -8,7 +8,6 @@ import ( "github.com/cloudreve/Cloudreve/v3/pkg/filesystem/driver" "github.com/cloudreve/Cloudreve/v3/pkg/filesystem/response" "github.com/cloudreve/Cloudreve/v3/pkg/mocks/thumbmock" - "github.com/cloudreve/Cloudreve/v3/pkg/request" "github.com/cloudreve/Cloudreve/v3/pkg/thumb" testMock "github.com/stretchr/testify/mock" "testing" @@ -126,22 +125,3 @@ func TestFileSystem_ThumbWorker(t *testing.T) { getThumbWorker().releaseWorker() }) } - -func TestFileSystem_GenerateThumbnail(t *testing.T) { - fs := &FileSystem{User: &model.User{}} - - // 无法生成缩略图 - { - fs.SetTargetFile(&[]model.File{{}}) - fs.generateThumbnail(context.Background(), &model.File{}) - } - - // 无法获取文件数据 - { - testHandller := new(FileHeaderMock) - testHandller.On("Get", testMock.Anything, "").Return(request.NopRSCloser{}, errors.New("error")) - fs.Handler = testHandller - fs.generateThumbnail(context.Background(), &model.File{Name: "test.png"}) - testHandller.AssertExpectations(t) - } -} diff --git a/pkg/mocks/cachemock/mock.go b/pkg/mocks/cachemock/mock.go index 98fe78c..921b1cd 100644 --- a/pkg/mocks/cachemock/mock.go +++ b/pkg/mocks/cachemock/mock.go @@ -27,3 +27,11 @@ func (c CacheClientMock) Sets(values map[string]interface{}, prefix string) erro func (c CacheClientMock) Delete(keys []string, prefix string) error { return c.Called(keys, prefix).Error(0) } + +func (c CacheClientMock) Persist(path string) error { + return c.Called(path).Error(0) +} + +func (c CacheClientMock) Restore(path string) error { + return c.Called(path).Error(0) +}