Add test for FinisherDataStore
This commit is contained in:
parent
c2bb17b947
commit
3b3e3bcef0
|
@ -95,6 +95,16 @@ func (_mr *_MockFullDataStoreRecorder) GetReader(arg0 interface{}) *gomock.Call
|
||||||
return _mr.mock.ctrl.RecordCall(_mr.mock, "GetReader", arg0)
|
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
|
// Mock of Locker interface
|
||||||
type MockLocker struct {
|
type MockLocker struct {
|
||||||
ctrl *gomock.Controller
|
ctrl *gomock.Controller
|
||||||
|
|
|
@ -22,6 +22,7 @@ func TestPatch(t *testing.T) {
|
||||||
Size: 10,
|
Size: 10,
|
||||||
}, nil),
|
}, nil),
|
||||||
store.EXPECT().WriteChunk("yes", int64(5), NewReaderMatcher("hello")).Return(int64(5), nil),
|
store.EXPECT().WriteChunk("yes", int64(5), NewReaderMatcher("hello")).Return(int64(5), nil),
|
||||||
|
store.EXPECT().FinishUpload("yes"),
|
||||||
)
|
)
|
||||||
|
|
||||||
handler, _ := NewHandler(Config{
|
handler, _ := NewHandler(Config{
|
||||||
|
@ -59,7 +60,7 @@ func TestPatch(t *testing.T) {
|
||||||
store.EXPECT().GetInfo("yes").Return(FileInfo{
|
store.EXPECT().GetInfo("yes").Return(FileInfo{
|
||||||
ID: "yes",
|
ID: "yes",
|
||||||
Offset: 5,
|
Offset: 5,
|
||||||
Size: 10,
|
Size: 20,
|
||||||
}, nil),
|
}, nil),
|
||||||
store.EXPECT().WriteChunk("yes", int64(5), NewReaderMatcher("hello")).Return(int64(5), nil),
|
store.EXPECT().WriteChunk("yes", int64(5), NewReaderMatcher("hello")).Return(int64(5), nil),
|
||||||
)
|
)
|
||||||
|
@ -188,6 +189,7 @@ func TestPatch(t *testing.T) {
|
||||||
Size: 20,
|
Size: 20,
|
||||||
}, nil),
|
}, nil),
|
||||||
store.EXPECT().WriteChunk("yes", int64(5), NewReaderMatcher("hellothisismore")).Return(int64(15), nil),
|
store.EXPECT().WriteChunk("yes", int64(5), NewReaderMatcher("hellothisismore")).Return(int64(15), nil),
|
||||||
|
store.EXPECT().FinishUpload("yes"),
|
||||||
)
|
)
|
||||||
|
|
||||||
handler, _ := NewHandler(Config{
|
handler, _ := NewHandler(Config{
|
||||||
|
|
|
@ -18,6 +18,7 @@ type FullDataStore interface {
|
||||||
tusd.TerminaterDataStore
|
tusd.TerminaterDataStore
|
||||||
tusd.ConcaterDataStore
|
tusd.ConcaterDataStore
|
||||||
tusd.GetReaderDataStore
|
tusd.GetReaderDataStore
|
||||||
|
tusd.FinisherDataStore
|
||||||
}
|
}
|
||||||
|
|
||||||
type Locker interface {
|
type Locker interface {
|
||||||
|
|
Loading…
Reference in New Issue