2019-06-11 16:23:20 +00:00
|
|
|
package handler_test
|
2016-10-13 10:29:13 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2023-03-08 12:03:18 +00:00
|
|
|
"github.com/tus/tusd/v2/pkg/handler"
|
2019-08-20 14:16:05 +00:00
|
|
|
|
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.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
|
|
|
}
|