2019-06-11 16:23:20 +00:00
|
|
|
package handler_test
|
2016-10-13 10:29:13 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2019-08-20 14:16:05 +00:00
|
|
|
"github.com/tus/tusd/pkg/handler"
|
|
|
|
|
2016-10-13 10:29:13 +00:00
|
|
|
"github.com/golang/mock/gomock"
|
|
|
|
)
|
|
|
|
|
2019-08-20 14:16:05 +00:00
|
|
|
func SubTest(t *testing.T, name string, runTest func(*testing.T, *MockFullDataStore, *handler.StoreComposer)) {
|
2019-06-11 14:29:31 +00:00
|
|
|
t.Run(name, func(subT *testing.T) {
|
|
|
|
//subT.Parallel()
|
2016-10-13 10:29:13 +00:00
|
|
|
|
2019-06-11 14:29:31 +00:00
|
|
|
ctrl := gomock.NewController(subT)
|
|
|
|
defer ctrl.Finish()
|
2016-10-13 10:29:13 +00:00
|
|
|
|
2019-06-11 14:29:31 +00:00
|
|
|
store := NewMockFullDataStore(ctrl)
|
2019-08-20 14:16:05 +00:00
|
|
|
composer := handler.NewStoreComposer()
|
|
|
|
composer.UseCore(store)
|
|
|
|
composer.UseTerminater(store)
|
|
|
|
composer.UseFinisher(store)
|
|
|
|
composer.UseGetReader(store)
|
|
|
|
composer.UseConcater(store)
|
|
|
|
composer.UseLengthDeferrer(store)
|
2016-10-13 10:29:13 +00:00
|
|
|
|
2019-08-20 14:16:05 +00:00
|
|
|
runTest(subT, store, composer)
|
2019-06-11 14:29:31 +00:00
|
|
|
})
|
2016-10-13 10:29:13 +00:00
|
|
|
}
|