diff --git a/pkg/filesystem/driver/cos/handller.go b/pkg/filesystem/driver/cos/handler.go similarity index 100% rename from pkg/filesystem/driver/cos/handller.go rename to pkg/filesystem/driver/cos/handler.go diff --git a/pkg/filesystem/driver/local/handller_test.go b/pkg/filesystem/driver/local/handler_test.go similarity index 100% rename from pkg/filesystem/driver/local/handller_test.go rename to pkg/filesystem/driver/local/handler_test.go diff --git a/pkg/filesystem/driver/onedrive/handller.go b/pkg/filesystem/driver/onedrive/handler.go similarity index 100% rename from pkg/filesystem/driver/onedrive/handller.go rename to pkg/filesystem/driver/onedrive/handler.go diff --git a/pkg/filesystem/driver/oss/handller.go b/pkg/filesystem/driver/oss/handler.go similarity index 100% rename from pkg/filesystem/driver/oss/handller.go rename to pkg/filesystem/driver/oss/handler.go diff --git a/pkg/filesystem/driver/qiniu/handller.go b/pkg/filesystem/driver/qiniu/handler.go similarity index 100% rename from pkg/filesystem/driver/qiniu/handller.go rename to pkg/filesystem/driver/qiniu/handler.go diff --git a/pkg/filesystem/driver/template/handller.go b/pkg/filesystem/driver/template/handler.go similarity index 100% rename from pkg/filesystem/driver/template/handller.go rename to pkg/filesystem/driver/template/handler.go diff --git a/pkg/filesystem/driver/upyun/handller.go b/pkg/filesystem/driver/upyun/handler.go similarity index 100% rename from pkg/filesystem/driver/upyun/handller.go rename to pkg/filesystem/driver/upyun/handler.go diff --git a/pkg/filesystem/upload_test.go b/pkg/filesystem/upload_test.go index a92ed26..1defda4 100644 --- a/pkg/filesystem/upload_test.go +++ b/pkg/filesystem/upload_test.go @@ -60,10 +60,10 @@ func TestFileSystem_Upload(t *testing.T) { asserts := assert.New(t) // 正常 - testHandller := new(FileHeaderMock) - testHandller.On("Put", testMock.Anything, testMock.Anything, testMock.Anything).Return(nil) + testHandler := new(FileHeaderMock) + testHandler.On("Put", testMock.Anything, testMock.Anything, testMock.Anything).Return(nil) fs := &FileSystem{ - Handler: testHandller, + Handler: testHandler, User: &model.User{ Model: gorm.Model{ ID: 1, @@ -88,10 +88,10 @@ func TestFileSystem_Upload(t *testing.T) { asserts.NoError(err) // 正常,上下文已指定源文件 - testHandller = new(FileHeaderMock) - testHandller.On("Put", testMock.Anything, testMock.Anything, "123/123.txt").Return(nil) + testHandler = new(FileHeaderMock) + testHandler.On("Put", testMock.Anything, testMock.Anything, "123/123.txt").Return(nil) fs = &FileSystem{ - Handler: testHandller, + Handler: testHandler, User: &model.User{ Model: gorm.Model{ ID: 1, @@ -124,20 +124,20 @@ func TestFileSystem_Upload(t *testing.T) { err = fs.Upload(ctx, file) asserts.Error(err) fs.Hooks["BeforeUpload"] = nil - testHandller.AssertExpectations(t) + testHandler.AssertExpectations(t) // 上传文件失败 - testHandller2 := new(FileHeaderMock) - testHandller2.On("Put", testMock.Anything, testMock.Anything, testMock.Anything).Return(errors.New("error")) - fs.Handler = testHandller2 + testHandler2 := new(FileHeaderMock) + testHandler2.On("Put", testMock.Anything, testMock.Anything, testMock.Anything).Return(errors.New("error")) + fs.Handler = testHandler2 err = fs.Upload(ctx, file) asserts.Error(err) - testHandller2.AssertExpectations(t) + testHandler2.AssertExpectations(t) // AfterUpload失败 - testHandller3 := new(FileHeaderMock) - testHandller3.On("Put", testMock.Anything, testMock.Anything, testMock.Anything).Return(nil) - fs.Handler = testHandller3 + testHandler3 := new(FileHeaderMock) + testHandler3.On("Put", testMock.Anything, testMock.Anything, testMock.Anything).Return(nil) + fs.Handler = testHandler3 fs.Use("AfterUpload", func(ctx context.Context, fs *FileSystem) error { return errors.New("error") }) @@ -146,7 +146,7 @@ func TestFileSystem_Upload(t *testing.T) { }) err = fs.Upload(ctx, file) asserts.Error(err) - testHandller2.AssertExpectations(t) + testHandler2.AssertExpectations(t) } @@ -180,11 +180,11 @@ func TestFileSystem_GetUploadToken(t *testing.T) { "upload_credential_timeout": "10", "upload_session_timeout": "10", }, "setting_") - testHandller := new(FileHeaderMock) - testHandller.On("Token", testMock.Anything, int64(10), testMock.Anything).Return(serializer.UploadCredential{Token: "test"}, nil) - fs.Handler = testHandller + testHandler := new(FileHeaderMock) + testHandler.On("Token", testMock.Anything, int64(10), testMock.Anything).Return(serializer.UploadCredential{Token: "test"}, nil) + fs.Handler = testHandler res, err := fs.GetUploadToken(ctx, "/", 10, "123") - testHandller.AssertExpectations(t) + testHandler.AssertExpectations(t) asserts.NoError(err) asserts.Equal("test", res.Token) } @@ -195,11 +195,11 @@ func TestFileSystem_GetUploadToken(t *testing.T) { "upload_credential_timeout": "10", "upload_session_timeout": "10", }, "setting_") - testHandller := new(FileHeaderMock) - testHandller.On("Token", testMock.Anything, int64(10), testMock.Anything).Return(serializer.UploadCredential{}, errors.New("error")) - fs.Handler = testHandller + testHandler := new(FileHeaderMock) + testHandler.On("Token", testMock.Anything, int64(10), testMock.Anything).Return(serializer.UploadCredential{}, errors.New("error")) + fs.Handler = testHandler _, err := fs.GetUploadToken(ctx, "/", 10, "123") - testHandller.AssertExpectations(t) + testHandler.AssertExpectations(t) asserts.Error(err) } }