Add test for FinisherDataStore

This commit is contained in:
Marius 2016-10-13 18:18:18 +02:00
parent c2bb17b947
commit 3b3e3bcef0
3 changed files with 14 additions and 1 deletions

View File

@ -95,6 +95,16 @@ func (_mr *_MockFullDataStoreRecorder) GetReader(arg0 interface{}) *gomock.Call
return _mr.mock.ctrl.RecordCall(_mr.mock, "GetReader", arg0)
}
func (_m *MockFullDataStore) FinishUpload(id string) error {
ret := _m.ctrl.Call(_m, "FinishUpload", id)
ret0, _ := ret[0].(error)
return ret0
}
func (_mr *_MockFullDataStoreRecorder) FinishUpload(arg0 interface{}) *gomock.Call {
return _mr.mock.ctrl.RecordCall(_mr.mock, "FinishUpload", arg0)
}
// Mock of Locker interface
type MockLocker struct {
ctrl *gomock.Controller

View File

@ -22,6 +22,7 @@ func TestPatch(t *testing.T) {
Size: 10,
}, nil),
store.EXPECT().WriteChunk("yes", int64(5), NewReaderMatcher("hello")).Return(int64(5), nil),
store.EXPECT().FinishUpload("yes"),
)
handler, _ := NewHandler(Config{
@ -59,7 +60,7 @@ func TestPatch(t *testing.T) {
store.EXPECT().GetInfo("yes").Return(FileInfo{
ID: "yes",
Offset: 5,
Size: 10,
Size: 20,
}, nil),
store.EXPECT().WriteChunk("yes", int64(5), NewReaderMatcher("hello")).Return(int64(5), nil),
)
@ -188,6 +189,7 @@ func TestPatch(t *testing.T) {
Size: 20,
}, nil),
store.EXPECT().WriteChunk("yes", int64(5), NewReaderMatcher("hellothisismore")).Return(int64(15), nil),
store.EXPECT().FinishUpload("yes"),
)
handler, _ := NewHandler(Config{

View File

@ -18,6 +18,7 @@ type FullDataStore interface {
tusd.TerminaterDataStore
tusd.ConcaterDataStore
tusd.GetReaderDataStore
tusd.FinisherDataStore
}
type Locker interface {