mirror of
https://github.com/mattermost/focalboard.git
synced 2024-12-21 13:38:56 +02:00
c8e729b6fe
* refactor: updated dependency for focalboard server * chore: more dependency fixes * refactor: removed the unless code * refactor: added ctx for login and removed unnessary code * refactor: bump up go version * refactor: removed the commented code * chore: upgraded golinter version * fix: linter issue * refactor: removed feature flg fix golinter * refactor: removed feature flag from code * revert: statistic and it's function * refactor: removed ProductLimit related code * refactor: removed isWithinViewsLimit implementation * refactor: moved function GetUsedCardsCount to statistics.go from cloud.go * refactor: removed insight code board * refactor: removed limit dialog * refactor: updated dependencies for linux * chore: golinter fix * chore: updated helper test function to use newLogger * fix: go test * refactor: db ping attempts from config * revert: feature in action * revert: feature flag in action * revert: boardsEditor setting --------- Co-authored-by: Rajat Dabade <rajat@Rajats-MacBook-Pro.local>
75 lines
2.3 KiB
Go
75 lines
2.3 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/metrics"
|
|
"github.com/mattermost/focalboard/server/services/permissions/mmpermissions"
|
|
mmpermissionsMocks "github.com/mattermost/focalboard/server/services/permissions/mmpermissions/mocks"
|
|
permissionsMocks "github.com/mattermost/focalboard/server/services/permissions/mocks"
|
|
"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/public/shared/mlog"
|
|
"github.com/mattermost/mattermost/server/v8/platform/shared/filestore/mocks"
|
|
)
|
|
|
|
type TestHelper struct {
|
|
App *App
|
|
Store *mockstore.MockStore
|
|
FilesBackend *mocks.FileBackend
|
|
logger mlog.LoggerIFace
|
|
API *mmpermissionsMocks.MockAPI
|
|
}
|
|
|
|
func SetupTestHelper(t *testing.T) (*TestHelper, func()) {
|
|
ctrl := gomock.NewController(t)
|
|
cfg := config.Configuration{}
|
|
store := mockstore.NewMockStore(ctrl)
|
|
filesBackend := &mocks.FileBackend{}
|
|
auth := auth.New(&cfg, store, nil)
|
|
logger, _ := mlog.NewLogger()
|
|
sessionToken := "TESTTOKEN"
|
|
wsserver := ws.NewServer(auth, sessionToken, false, logger, store)
|
|
webhook := webhook.NewClient(&cfg, logger)
|
|
metricsService := metrics.NewMetrics(metrics.InstanceInfo{})
|
|
|
|
mockStore := permissionsMocks.NewMockStore(ctrl)
|
|
mockAPI := mmpermissionsMocks.NewMockAPI(ctrl)
|
|
permissions := mmpermissions.New(mockStore, mockAPI, mlog.CreateConsoleTestLogger(t))
|
|
|
|
appServices := Services{
|
|
Auth: auth,
|
|
Store: store,
|
|
FilesBackend: filesBackend,
|
|
Webhook: webhook,
|
|
Metrics: metricsService,
|
|
Logger: logger,
|
|
SkipTemplateInit: true,
|
|
Permissions: permissions,
|
|
}
|
|
app2 := New(&cfg, wsserver, appServices)
|
|
|
|
tearDown := func() {
|
|
app2.Shutdown()
|
|
if logger != nil {
|
|
_ = logger.Shutdown()
|
|
}
|
|
}
|
|
|
|
return &TestHelper{
|
|
App: app2,
|
|
Store: store,
|
|
FilesBackend: filesBackend,
|
|
logger: logger,
|
|
API: mockAPI,
|
|
}, tearDown
|
|
}
|