mirror of
https://github.com/halejohn/Cloudreve.git
synced 2026-01-27 10:01:56 +08:00
test: fix failed ut
This commit is contained in:
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user