Modify: split hooks into small modules

This commit is contained in:
HFO4
2019-11-26 11:42:26 +08:00
parent 451bdb4ee1
commit 0cb80f69f5
11 changed files with 191 additions and 53 deletions

View File

@@ -19,7 +19,7 @@ type FileHeaderMock struct {
testMock.Mock
}
func (m FileHeaderMock) Put(ctx context.Context, file io.ReadCloser, dst string) error {
func (m FileHeaderMock) Put(ctx context.Context, file io.ReadCloser, dst string, size uint64) error {
args := m.Called(ctx, file, dst)
return args.Error(0)
}
@@ -61,9 +61,9 @@ func TestFileSystem_Upload(t *testing.T) {
asserts.NoError(err)
// BeforeUpload 返回错误
fs.BeforeUpload = func(ctx context.Context, fs *FileSystem) error {
fs.Use("BeforeUpload", func(ctx context.Context, fs *FileSystem) error {
return errors.New("error")
}
})
err = fs.Upload(ctx, file)
asserts.Error(err)
fs.BeforeUpload = nil