mirror of
https://github.com/mattermost/focalboard.git
synced 2024-11-24 08:22:29 +02:00
6cb7e49a2b
* add unit tests * cleanup * cleanup * rename helper file, remove gomock.eq() * update import
40 lines
1.0 KiB
Go
40 lines
1.0 KiB
Go
// 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"
|
|
"github.com/mattermost/focalboard/server/services/store/mockstore"
|
|
"github.com/mattermost/focalboard/server/services/webhook"
|
|
"github.com/mattermost/focalboard/server/ws"
|
|
"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)
|
|
sessionToken := "TESTTOKEN"
|
|
wsserver := ws.NewServer(auth, sessionToken, false)
|
|
webhook := webhook.NewClient(&cfg)
|
|
app2 := New(&cfg, store, auth, wsserver, &mocks.FileBackend{}, webhook)
|
|
|
|
return &TestHelper{
|
|
App: app2,
|
|
Store: store,
|
|
}
|
|
}
|