2021-05-26 12:38:43 +02:00
|
|
|
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
|
|
// See LICENSE.txt for license information.
|
|
|
|
package app
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/golang/mock/gomock"
|
|
|
|
|
|
|
|
"github.com/mattermost/focalboard/server/auth"
|
|
|
|
"github.com/mattermost/focalboard/server/services/config"
|
2021-05-29 08:23:10 +02:00
|
|
|
"github.com/mattermost/focalboard/server/services/mlog"
|
2021-05-26 12:38:43 +02:00
|
|
|
"github.com/mattermost/focalboard/server/services/store/mockstore"
|
|
|
|
"github.com/mattermost/focalboard/server/services/webhook"
|
|
|
|
"github.com/mattermost/focalboard/server/ws"
|
2021-05-29 08:23:10 +02:00
|
|
|
|
2021-05-26 12:38:43 +02:00
|
|
|
"github.com/mattermost/mattermost-server/v5/shared/filestore/mocks"
|
|
|
|
)
|
|
|
|
|
|
|
|
type TestHelper struct {
|
|
|
|
App *App
|
|
|
|
Store *mockstore.MockStore
|
|
|
|
}
|
|
|
|
|
|
|
|
func SetupTestHelper(t *testing.T) *TestHelper {
|
|
|
|
|
|
|
|
ctrl := gomock.NewController(t)
|
|
|
|
defer ctrl.Finish()
|
|
|
|
cfg := config.Configuration{}
|
|
|
|
store := mockstore.NewMockStore(ctrl)
|
|
|
|
auth := auth.New(&cfg, store)
|
2021-05-29 08:23:10 +02:00
|
|
|
logger := mlog.NewLogger()
|
|
|
|
logger.Configure("", cfg.LoggingEscapedJson)
|
2021-05-26 12:38:43 +02:00
|
|
|
sessionToken := "TESTTOKEN"
|
2021-05-29 08:23:10 +02:00
|
|
|
wsserver := ws.NewServer(auth, sessionToken, false, logger)
|
|
|
|
webhook := webhook.NewClient(&cfg, logger)
|
|
|
|
app2 := New(&cfg, store, auth, wsserver, &mocks.FileBackend{}, webhook, logger)
|
2021-05-26 12:38:43 +02:00
|
|
|
|
|
|
|
return &TestHelper{
|
|
|
|
App: app2,
|
|
|
|
Store: store,
|
|
|
|
}
|
|
|
|
}
|