diff --git a/web/webtest/main.go b/web/webtest/main.go index f3b1d92..11afa64 100644 --- a/web/webtest/main.go +++ b/web/webtest/main.go @@ -64,16 +64,15 @@ func NewWithDBSetup(modules web.ModuleRegisterFunc, dbCall func(db *database.Dat // New allows to configure WebService for testing func (option Option) New() (*TestServer, error) { - // api setup - gin.EnableJsonDecoderDisallowUnknownFields() - gin.SetMode(gin.TestMode) - ws := &web.Service{} ws.Session.Name = "mysession" ws.Session.Secret = "hidden" + ts := &TestServer{ - WS: ws, + WS: ws, + Close: func() {}, } + // db setup if option.Database { ts.DB = &database.Database{ @@ -110,6 +109,11 @@ func (option Option) New() (*TestServer, error) { ts.Close = mock.Close } + // api setup + + gin.EnableJsonDecoderDisallowUnknownFields() + gin.SetMode(gin.TestMode) + ws.ModuleRegister(option.ModuleLoader) r := gin.Default()