[MM-62408] Server Code Coverage with Fully Parallel Tests (#30078)
* TestPool * Store infra * Store tests updates * Bump maximum concurrent postgres connections * More infra * channels/jobs * channels/app * channels/api4 * Protect i18n from concurrent access * Replace some use of os.Setenv * Remove debug * Lint fixes * Fix more linting * Fix test * Remove use of Setenv in drafts tests * Fix flaky TestWebHubCloseConnOnDBFail * Fix merge * [MM-62408] Add CI job to generate test coverage (#30284) * Add CI job to generate test coverage * Remove use of Setenv in drafts tests * Fix flaky TestWebHubCloseConnOnDBFail * Fix more Setenv usage * Fix more potential flakyness * Remove parallelism from flaky test * Remove conflicting env var * Fix * Disable parallelism * Test atomic covermode * Disable parallelism * Enable parallelism * Add upload coverage step * Fix codecov.yml * Add codecov.yml * Remove redundant workspace field * Add Parallel() util methods and refactor * Fix formatting * More formatting fixes * Fix reporting
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
1cf2f08108
Коммит
611b2a8e79
@@ -41,6 +41,7 @@ type TestHelper struct {
|
||||
App *app.App
|
||||
Server *app.Server
|
||||
ConfigStore *config.Store
|
||||
Store store.Store
|
||||
|
||||
Context *request.Context
|
||||
Client *model.Client4
|
||||
@@ -69,8 +70,6 @@ type TestHelper struct {
|
||||
|
||||
LogBuffer *mlog.Buffer
|
||||
TestLogger *mlog.Logger
|
||||
|
||||
workspace string
|
||||
}
|
||||
|
||||
var mainHelper *testlib.MainHelper
|
||||
@@ -79,7 +78,7 @@ func SetMainHelper(mh *testlib.MainHelper) {
|
||||
mainHelper = mh
|
||||
}
|
||||
|
||||
func setupTestHelper(tb testing.TB, dbStore store.Store, searchEngine *searchengine.Broker, enterprise bool, includeCache bool,
|
||||
func setupTestHelper(tb testing.TB, dbStore store.Store, sqlSettings *model.SqlSettings, searchEngine *searchengine.Broker, enterprise bool, includeCache bool,
|
||||
updateConfig func(*model.Config), options []app.Option,
|
||||
) *TestHelper {
|
||||
tempWorkspace, err := os.MkdirTemp("", "apptest")
|
||||
@@ -89,9 +88,11 @@ func setupTestHelper(tb testing.TB, dbStore store.Store, searchEngine *searcheng
|
||||
require.NoError(tb, err, "failed to initialize memory store")
|
||||
|
||||
memoryConfig := &model.Config{
|
||||
SqlSettings: *mainHelper.GetSQLSettings(),
|
||||
SqlSettings: model.SafeDereference(sqlSettings),
|
||||
}
|
||||
memoryConfig.SetDefaults()
|
||||
*memoryConfig.ServiceSettings.LicenseFileLocation = filepath.Join(tempWorkspace, "license.json")
|
||||
*memoryConfig.FileSettings.Directory = filepath.Join(tempWorkspace, "data")
|
||||
*memoryConfig.PluginSettings.Directory = filepath.Join(tempWorkspace, "plugins")
|
||||
*memoryConfig.PluginSettings.ClientDirectory = filepath.Join(tempWorkspace, "webapp")
|
||||
*memoryConfig.FileSettings.Directory = filepath.Join(tempWorkspace, "data")
|
||||
@@ -99,11 +100,12 @@ func setupTestHelper(tb testing.TB, dbStore store.Store, searchEngine *searcheng
|
||||
*memoryConfig.ServiceSettings.LocalModeSocketLocation = filepath.Join(tempWorkspace, "mattermost_local.sock")
|
||||
*memoryConfig.LogSettings.EnableSentry = false // disable error reporting during tests
|
||||
*memoryConfig.LogSettings.ConsoleLevel = mlog.LvlStdLog.Name
|
||||
*memoryConfig.LogSettings.FileLocation = filepath.Join(tempWorkspace, "logs", "mattermost.log")
|
||||
*memoryConfig.AnnouncementSettings.AdminNoticesEnabled = false
|
||||
*memoryConfig.AnnouncementSettings.UserNoticesEnabled = false
|
||||
*memoryConfig.PluginSettings.AutomaticPrepackagedPlugins = false
|
||||
// Enabling Redis with Postgres.
|
||||
if *memoryConfig.SqlSettings.DriverName == model.DatabaseDriverPostgres {
|
||||
if *memoryConfig.SqlSettings.DriverName == model.DatabaseDriverPostgres && !mainHelper.Options.RunParallel {
|
||||
*memoryConfig.CacheSettings.CacheType = model.CacheTypeRedis
|
||||
redisHost := "localhost"
|
||||
if os.Getenv("IS_CI") == "true" {
|
||||
@@ -156,7 +158,7 @@ func setupTestHelper(tb testing.TB, dbStore store.Store, searchEngine *searcheng
|
||||
IncludeCacheLayer: includeCache,
|
||||
TestLogger: testLogger,
|
||||
LogBuffer: buffer,
|
||||
workspace: tempWorkspace,
|
||||
Store: dbStore,
|
||||
}
|
||||
|
||||
if s.Platform().SearchEngine != nil && s.Platform().SearchEngine.BleveEngine != nil && searchEngine != nil {
|
||||
@@ -190,6 +192,14 @@ func setupTestHelper(tb testing.TB, dbStore store.Store, searchEngine *searcheng
|
||||
|
||||
*cfg.ServiceSettings.ListenAddress = "localhost:0"
|
||||
})
|
||||
|
||||
// Support updating feature flags without resorting to os.Setenv which
|
||||
// isn't concurrently safe.
|
||||
if updateConfig != nil {
|
||||
configStore.SetReadOnlyFF(false)
|
||||
th.App.UpdateConfig(updateConfig)
|
||||
}
|
||||
|
||||
err = th.Server.Start()
|
||||
require.NoError(tb, err)
|
||||
|
||||
@@ -203,7 +213,6 @@ func setupTestHelper(tb testing.TB, dbStore store.Store, searchEngine *searcheng
|
||||
th.SystemManagerClient = th.CreateClient()
|
||||
|
||||
// Verify handling of the supported true/false values by randomizing on each run.
|
||||
rand.Seed(time.Now().UTC().UnixNano())
|
||||
trueValues := []string{"1", "t", "T", "TRUE", "true", "True"}
|
||||
falseValues := []string{"0", "f", "F", "FALSE", "false", "False"}
|
||||
trueString := trueValues[rand.Intn(len(trueValues))]
|
||||
@@ -231,6 +240,27 @@ func getLicense(enterprise bool, cfg *model.Config) *model.License {
|
||||
return nil
|
||||
}
|
||||
|
||||
func setupStores(tb testing.TB) (store.Store, *model.SqlSettings, *searchengine.Broker) {
|
||||
var dbStore store.Store
|
||||
var dbSettings *model.SqlSettings
|
||||
var searchEngine *searchengine.Broker
|
||||
if mainHelper.Options.RunParallel {
|
||||
dbStore, _, dbSettings, searchEngine = mainHelper.GetNewStores(tb)
|
||||
tb.Cleanup(func() {
|
||||
dbStore.Close()
|
||||
})
|
||||
} else {
|
||||
dbStore = mainHelper.GetStore()
|
||||
dbStore.DropAllTables()
|
||||
dbStore.MarkSystemRanUnitTests()
|
||||
mainHelper.PreloadMigrations()
|
||||
searchEngine = mainHelper.GetSearchEngine()
|
||||
dbSettings = mainHelper.Settings
|
||||
}
|
||||
|
||||
return dbStore, dbSettings, searchEngine
|
||||
}
|
||||
|
||||
func SetupEnterprise(tb testing.TB, options ...app.Option) *TestHelper {
|
||||
if testing.Short() {
|
||||
tb.SkipNow()
|
||||
@@ -240,13 +270,10 @@ func SetupEnterprise(tb testing.TB, options ...app.Option) *TestHelper {
|
||||
tb.SkipNow()
|
||||
}
|
||||
|
||||
dbStore := mainHelper.GetStore()
|
||||
dbStore.DropAllTables()
|
||||
dbStore.MarkSystemRanUnitTests()
|
||||
mainHelper.PreloadMigrations()
|
||||
searchEngine := mainHelper.GetSearchEngine()
|
||||
th := setupTestHelper(tb, dbStore, searchEngine, true, true, nil, options)
|
||||
dbStore, dbSettings, searchEngine := setupStores(tb)
|
||||
th := setupTestHelper(tb, dbStore, dbSettings, searchEngine, true, true, nil, options)
|
||||
th.InitLogin(tb)
|
||||
|
||||
return th
|
||||
}
|
||||
|
||||
@@ -259,13 +286,10 @@ func Setup(tb testing.TB) *TestHelper {
|
||||
tb.SkipNow()
|
||||
}
|
||||
|
||||
dbStore := mainHelper.GetStore()
|
||||
dbStore.DropAllTables()
|
||||
dbStore.MarkSystemRanUnitTests()
|
||||
mainHelper.PreloadMigrations()
|
||||
searchEngine := mainHelper.GetSearchEngine()
|
||||
th := setupTestHelper(tb, dbStore, searchEngine, false, true, nil, nil)
|
||||
dbStore, dbSettings, searchEngine := setupStores(tb)
|
||||
th := setupTestHelper(tb, dbStore, dbSettings, searchEngine, false, true, nil, nil)
|
||||
th.InitLogin(tb)
|
||||
|
||||
return th
|
||||
}
|
||||
|
||||
@@ -278,14 +302,11 @@ func SetupAndApplyConfigBeforeLogin(tb testing.TB, updateConfig func(cfg *model.
|
||||
tb.SkipNow()
|
||||
}
|
||||
|
||||
dbStore := mainHelper.GetStore()
|
||||
dbStore.DropAllTables()
|
||||
dbStore.MarkSystemRanUnitTests()
|
||||
mainHelper.PreloadMigrations()
|
||||
searchEngine := mainHelper.GetSearchEngine()
|
||||
th := setupTestHelper(tb, dbStore, searchEngine, false, true, nil, nil)
|
||||
dbStore, dbSettings, searchEngine := setupStores(tb)
|
||||
th := setupTestHelper(tb, dbStore, dbSettings, searchEngine, false, true, nil, nil)
|
||||
th.App.UpdateConfig(updateConfig)
|
||||
th.InitLogin(tb)
|
||||
|
||||
return th
|
||||
}
|
||||
|
||||
@@ -298,18 +319,15 @@ func SetupConfig(tb testing.TB, updateConfig func(cfg *model.Config)) *TestHelpe
|
||||
tb.SkipNow()
|
||||
}
|
||||
|
||||
dbStore := mainHelper.GetStore()
|
||||
dbStore.DropAllTables()
|
||||
dbStore.MarkSystemRanUnitTests()
|
||||
mainHelper.PreloadMigrations()
|
||||
searchEngine := mainHelper.GetSearchEngine()
|
||||
th := setupTestHelper(tb, dbStore, searchEngine, false, true, updateConfig, nil)
|
||||
dbStore, dbSettings, searchEngine := setupStores(tb)
|
||||
th := setupTestHelper(tb, dbStore, dbSettings, searchEngine, false, true, updateConfig, nil)
|
||||
th.InitLogin(tb)
|
||||
|
||||
return th
|
||||
}
|
||||
|
||||
func SetupConfigWithStoreMock(tb testing.TB, updateConfig func(cfg *model.Config)) *TestHelper {
|
||||
th := setupTestHelper(tb, testlib.GetMockStoreForSetupFunctions(), nil, false, false, updateConfig, nil)
|
||||
th := setupTestHelper(tb, testlib.GetMockStoreForSetupFunctions(), nil, nil, false, false, updateConfig, nil)
|
||||
statusMock := mocks.StatusStore{}
|
||||
statusMock.On("UpdateExpiredDNDStatuses").Return([]*model.Status{}, nil)
|
||||
statusMock.On("Get", "user1").Return(&model.Status{UserId: "user1", Status: model.StatusOnline}, nil)
|
||||
@@ -323,7 +341,7 @@ func SetupConfigWithStoreMock(tb testing.TB, updateConfig func(cfg *model.Config
|
||||
}
|
||||
|
||||
func SetupWithStoreMock(tb testing.TB) *TestHelper {
|
||||
th := setupTestHelper(tb, testlib.GetMockStoreForSetupFunctions(), nil, false, false, nil, nil)
|
||||
th := setupTestHelper(tb, testlib.GetMockStoreForSetupFunctions(), nil, nil, false, false, nil, nil)
|
||||
statusMock := mocks.StatusStore{}
|
||||
statusMock.On("UpdateExpiredDNDStatuses").Return([]*model.Status{}, nil)
|
||||
statusMock.On("Get", "user1").Return(&model.Status{UserId: "user1", Status: model.StatusOnline}, nil)
|
||||
@@ -337,7 +355,7 @@ func SetupWithStoreMock(tb testing.TB) *TestHelper {
|
||||
}
|
||||
|
||||
func SetupEnterpriseWithStoreMock(tb testing.TB, options ...app.Option) *TestHelper {
|
||||
th := setupTestHelper(tb, testlib.GetMockStoreForSetupFunctions(), nil, true, false, nil, options)
|
||||
th := setupTestHelper(tb, testlib.GetMockStoreForSetupFunctions(), nil, nil, true, false, nil, options)
|
||||
statusMock := mocks.StatusStore{}
|
||||
statusMock.On("UpdateExpiredDNDStatuses").Return([]*model.Status{}, nil)
|
||||
statusMock.On("Get", "user1").Return(&model.Status{UserId: "user1", Status: model.StatusOnline}, nil)
|
||||
@@ -359,13 +377,10 @@ func SetupWithServerOptions(tb testing.TB, options []app.Option) *TestHelper {
|
||||
tb.SkipNow()
|
||||
}
|
||||
|
||||
dbStore := mainHelper.GetStore()
|
||||
dbStore.DropAllTables()
|
||||
dbStore.MarkSystemRanUnitTests()
|
||||
mainHelper.PreloadMigrations()
|
||||
searchEngine := mainHelper.GetSearchEngine()
|
||||
th := setupTestHelper(tb, dbStore, searchEngine, false, true, nil, options)
|
||||
dbStore, dbSettings, searchEngine := setupStores(tb)
|
||||
th := setupTestHelper(tb, dbStore, dbSettings, searchEngine, false, true, nil, options)
|
||||
th.InitLogin(tb)
|
||||
|
||||
return th
|
||||
}
|
||||
|
||||
@@ -378,13 +393,10 @@ func SetupEnterpriseWithServerOptions(tb testing.TB, options []app.Option) *Test
|
||||
tb.SkipNow()
|
||||
}
|
||||
|
||||
dbStore := mainHelper.GetStore()
|
||||
dbStore.DropAllTables()
|
||||
dbStore.MarkSystemRanUnitTests()
|
||||
mainHelper.PreloadMigrations()
|
||||
searchEngine := mainHelper.GetSearchEngine()
|
||||
th := setupTestHelper(tb, dbStore, searchEngine, true, true, nil, options)
|
||||
dbStore, dbSettings, searchEngine := setupStores(tb)
|
||||
th := setupTestHelper(tb, dbStore, dbSettings, searchEngine, true, true, nil, options)
|
||||
th.InitLogin(tb)
|
||||
|
||||
return th
|
||||
}
|
||||
|
||||
@@ -413,8 +425,8 @@ func (th *TestHelper) TearDown() {
|
||||
th.ShutdownApp()
|
||||
|
||||
// Cleanup the workspace
|
||||
if th.workspace != "" {
|
||||
err := os.RemoveAll(th.workspace)
|
||||
if th.tempWorkspace != "" {
|
||||
err := os.RemoveAll(th.tempWorkspace)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@@ -444,29 +456,48 @@ func (th *TestHelper) InitLogin(tb testing.TB) *TestHelper {
|
||||
|
||||
// create users once and cache them because password hashing is slow
|
||||
initBasicOnce.Do(func() {
|
||||
var err *model.AppError
|
||||
|
||||
th.SystemAdminUser = th.CreateUser()
|
||||
th.App.UpdateUserRoles(th.Context, th.SystemAdminUser.Id, model.SystemUserRoleId+" "+model.SystemAdminRoleId, false)
|
||||
th.SystemAdminUser, _ = th.App.GetUser(th.SystemAdminUser.Id)
|
||||
th.SystemAdminUser, err = th.App.GetUser(th.SystemAdminUser.Id)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
userCache.SystemAdminUser = th.SystemAdminUser.DeepCopy()
|
||||
|
||||
th.SystemManagerUser = th.CreateUser()
|
||||
th.App.UpdateUserRoles(th.Context, th.SystemManagerUser.Id, model.SystemUserRoleId+" "+model.SystemManagerRoleId, false)
|
||||
th.SystemManagerUser, _ = th.App.GetUser(th.SystemManagerUser.Id)
|
||||
th.SystemManagerUser, err = th.App.GetUser(th.SystemManagerUser.Id)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
userCache.SystemManagerUser = th.SystemManagerUser.DeepCopy()
|
||||
|
||||
th.TeamAdminUser = th.CreateUser()
|
||||
th.App.UpdateUserRoles(th.Context, th.TeamAdminUser.Id, model.SystemUserRoleId, false)
|
||||
th.TeamAdminUser, _ = th.App.GetUser(th.TeamAdminUser.Id)
|
||||
th.TeamAdminUser, err = th.App.GetUser(th.TeamAdminUser.Id)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
userCache.TeamAdminUser = th.TeamAdminUser.DeepCopy()
|
||||
|
||||
th.BasicUser = th.CreateUser()
|
||||
th.BasicUser, _ = th.App.GetUser(th.BasicUser.Id)
|
||||
th.BasicUser, err = th.App.GetUser(th.BasicUser.Id)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
userCache.BasicUser = th.BasicUser.DeepCopy()
|
||||
|
||||
th.BasicUser2 = th.CreateUser()
|
||||
th.BasicUser2, _ = th.App.GetUser(th.BasicUser2.Id)
|
||||
th.BasicUser2, err = th.App.GetUser(th.BasicUser2.Id)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
userCache.BasicUser2 = th.BasicUser2.DeepCopy()
|
||||
})
|
||||
|
||||
// restore cached users
|
||||
th.SystemAdminUser = userCache.SystemAdminUser.DeepCopy()
|
||||
th.SystemManagerUser = userCache.SystemManagerUser.DeepCopy()
|
||||
@@ -474,8 +505,7 @@ func (th *TestHelper) InitLogin(tb testing.TB) *TestHelper {
|
||||
th.BasicUser = userCache.BasicUser.DeepCopy()
|
||||
th.BasicUser2 = userCache.BasicUser2.DeepCopy()
|
||||
|
||||
users := []*model.User{th.SystemAdminUser, th.TeamAdminUser, th.BasicUser, th.BasicUser2, th.SystemManagerUser}
|
||||
mainHelper.GetSQLStore().User().InsertUsers(users)
|
||||
th.Store.User().InsertUsers([]*model.User{th.SystemAdminUser, th.TeamAdminUser, th.BasicUser, th.BasicUser2, th.SystemManagerUser})
|
||||
|
||||
// restore non hashed password for login
|
||||
th.SystemAdminUser.Password = "Pa$$word11"
|
||||
@@ -494,7 +524,9 @@ func (th *TestHelper) InitLogin(tb testing.TB) *TestHelper {
|
||||
th.LoginTeamAdmin()
|
||||
wg.Done()
|
||||
}()
|
||||
|
||||
wg.Wait()
|
||||
|
||||
return th
|
||||
}
|
||||
|
||||
@@ -1418,3 +1450,7 @@ func (th *TestHelper) SetupScheme(scope string) *model.Scheme {
|
||||
}
|
||||
return scheme
|
||||
}
|
||||
|
||||
func (th *TestHelper) Parallel(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ import (
|
||||
)
|
||||
|
||||
func TestBlevePurgeIndexes(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ import (
|
||||
)
|
||||
|
||||
func TestCreateBot(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
t.Run("create bot without permissions", func(t *testing.T) {
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
@@ -168,6 +169,7 @@ func TestCreateBot(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPatchBot(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
t.Run("patch non-existent bot", func(t *testing.T) {
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
@@ -591,6 +593,7 @@ func TestPatchBot(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetBot(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -772,6 +775,7 @@ func TestGetBot(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetBots(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic().DeleteBots()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -1080,6 +1084,7 @@ func TestGetBots(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDisableBot(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
t.Run("disable non-existent bot", func(t *testing.T) {
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
@@ -1199,7 +1204,9 @@ func TestDisableBot(t *testing.T) {
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
func TestEnableBot(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
t.Run("enable non-existent bot", func(t *testing.T) {
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
@@ -1333,6 +1340,7 @@ func TestEnableBot(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestAssignBot(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -1513,6 +1521,7 @@ func TestAssignBot(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestConvertBotToUser(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ import (
|
||||
)
|
||||
|
||||
func TestGetBrandImage(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -35,6 +36,7 @@ func TestGetBrandImage(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUploadBrandImage(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -136,6 +138,7 @@ func TestUploadBrandImageTwice(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDeleteBrandImage(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
"os"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
@@ -16,9 +15,7 @@ import (
|
||||
)
|
||||
|
||||
func TestCreateChannelBookmark(t *testing.T) {
|
||||
os.Setenv("MM_FEATUREFLAGS_ChannelBookmarks", "true")
|
||||
defer os.Unsetenv("MM_FEATUREFLAGS_ChannelBookmarks")
|
||||
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
err := th.App.SetPhase2PermissionsMigrationStatus(true)
|
||||
@@ -280,9 +277,7 @@ func TestCreateChannelBookmark(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestEditChannelBookmark(t *testing.T) {
|
||||
os.Setenv("MM_FEATUREFLAGS_ChannelBookmarks", "true")
|
||||
defer os.Unsetenv("MM_FEATUREFLAGS_ChannelBookmarks")
|
||||
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
err := th.App.SetPhase2PermissionsMigrationStatus(true)
|
||||
@@ -690,9 +685,7 @@ func TestEditChannelBookmark(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUpdateChannelBookmarkSortOrder(t *testing.T) {
|
||||
os.Setenv("MM_FEATUREFLAGS_ChannelBookmarks", "true")
|
||||
defer os.Unsetenv("MM_FEATUREFLAGS_ChannelBookmarks")
|
||||
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
err := th.App.SetPhase2PermissionsMigrationStatus(true)
|
||||
@@ -1102,9 +1095,7 @@ func TestUpdateChannelBookmarkSortOrder(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDeleteChannelBookmark(t *testing.T) {
|
||||
os.Setenv("MM_FEATUREFLAGS_ChannelBookmarks", "true")
|
||||
defer os.Unsetenv("MM_FEATUREFLAGS_ChannelBookmarks")
|
||||
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
err := th.App.SetPhase2PermissionsMigrationStatus(true)
|
||||
@@ -1461,9 +1452,7 @@ func TestDeleteChannelBookmark(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestListChannelBookmarksForChannel(t *testing.T) {
|
||||
os.Setenv("MM_FEATUREFLAGS_ChannelBookmarks", "true")
|
||||
defer os.Unsetenv("MM_FEATUREFLAGS_ChannelBookmarks")
|
||||
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
err := th.App.SetPhase2PermissionsMigrationStatus(true)
|
||||
|
||||
@@ -18,6 +18,7 @@ import (
|
||||
)
|
||||
|
||||
func TestCreateCategoryForTeamForUser(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -164,6 +165,7 @@ func TestCreateCategoryForTeamForUser(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUpdateCategoryForTeamForUser(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -451,6 +453,7 @@ func TestUpdateCategoryForTeamForUser(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUpdateCategoriesForTeamForUser(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -548,6 +551,7 @@ func TestUpdateCategoriesForTeamForUser(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetCategoriesForTeamForUser(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -600,6 +604,7 @@ func TestGetCategoriesForTeamForUser(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetCategoryOrderForTeamForUser(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -658,6 +663,7 @@ func TestGetCategoryOrderForTeamForUser(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUpdateCategoryOrderForTeamForUser(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -776,6 +782,7 @@ func TestUpdateCategoryOrderForTeamForUser(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetCategoryForTeamForUser(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -874,6 +881,7 @@ func TestGetCategoryForTeamForUser(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestValidateSidebarCategory(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -996,6 +1004,7 @@ func TestValidateSidebarCategory(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestValidateSidebarCategoryChannels(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -1081,6 +1090,7 @@ func TestValidateSidebarCategoryChannels(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDeleteCategoryForTeamForUser(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
t.Run("should move channels to default categories when custom category is deleted", func(t *testing.T) {
|
||||
|
||||
@@ -27,6 +27,7 @@ import (
|
||||
)
|
||||
|
||||
func TestCreateChannel(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -203,6 +204,7 @@ func TestCreateChannel(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUpdateChannel(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -378,6 +380,7 @@ func TestUpdateChannel(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPatchChannel(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -1164,6 +1167,7 @@ func TestCanEditChannelBanner(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestChannelUnicodeNames(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -1223,6 +1227,7 @@ func TestChannelUnicodeNames(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCreateDirectChannel(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -1285,6 +1290,7 @@ func TestCreateDirectChannel(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCreateDirectChannelAsGuest(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -1333,6 +1339,7 @@ func TestCreateDirectChannelAsGuest(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDeleteDirectChannel(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -1349,6 +1356,7 @@ func TestDeleteDirectChannel(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCreateGroupChannel(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -1411,6 +1419,7 @@ func TestCreateGroupChannel(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCreateGroupChannelAsGuest(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -1478,6 +1487,7 @@ func TestCreateGroupChannelAsGuest(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDeleteGroupChannel(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
user := th.BasicUser
|
||||
@@ -1497,6 +1507,7 @@ func TestDeleteGroupChannel(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetChannel(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -1547,6 +1558,7 @@ func TestGetChannel(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetDeletedChannelsForTeam(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -1622,6 +1634,7 @@ func TestGetDeletedChannelsForTeam(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetPrivateChannelsForTeam(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
team := th.BasicTeam
|
||||
@@ -1660,6 +1673,7 @@ func TestGetPrivateChannelsForTeam(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetPublicChannelsForTeam(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -1736,6 +1750,7 @@ func TestGetPublicChannelsForTeam(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetPublicChannelsByIdsForTeam(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -1793,6 +1808,7 @@ func TestGetPublicChannelsByIdsForTeam(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetChannelsForTeamForUser(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -1873,6 +1889,7 @@ func TestGetChannelsForTeamForUser(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetChannelsForUser(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -1925,6 +1942,7 @@ func TestGetChannelsForUser(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetAllChannels(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
th.LoginSystemManager()
|
||||
defer th.TearDown()
|
||||
@@ -2086,6 +2104,7 @@ func TestGetAllChannels(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetAllChannelsWithCount(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -2118,6 +2137,7 @@ func TestGetAllChannelsWithCount(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSearchChannels(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -2251,6 +2271,7 @@ func TestSearchChannels(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSearchArchivedChannels(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -2341,6 +2362,7 @@ func TestSearchArchivedChannels(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSearchAllChannels(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := setupForSharedChannels(t).InitBasic()
|
||||
th.LoginSystemManager()
|
||||
defer th.TearDown()
|
||||
@@ -2631,6 +2653,7 @@ func TestSearchAllChannels(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSearchAllChannelsPaged(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -2650,6 +2673,7 @@ func TestSearchAllChannelsPaged(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSearchGroupChannels(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -2718,6 +2742,7 @@ func TestSearchGroupChannels(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDeleteChannel(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
c := th.Client
|
||||
@@ -2806,6 +2831,7 @@ func TestDeleteChannel(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDeleteChannel2(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -2885,6 +2911,7 @@ func TestDeleteChannel2(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPermanentDeleteChannel(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -2923,6 +2950,7 @@ func TestPermanentDeleteChannel(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUpdateChannelPrivacy(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -3017,6 +3045,7 @@ func TestUpdateChannelPrivacy(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestRestoreChannel(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -3075,6 +3104,7 @@ func TestRestoreChannel(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetChannelByName(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -3140,6 +3170,7 @@ func TestGetChannelByName(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetChannelByNameForTeamName(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -3201,6 +3232,7 @@ func TestGetChannelByNameForTeamName(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetChannelMembers(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
th.TestForAllClients(t, func(t *testing.T, client *model.Client4) {
|
||||
@@ -3249,6 +3281,7 @@ func TestGetChannelMembers(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetChannelMembersByIds(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -3291,6 +3324,7 @@ func TestGetChannelMembersByIds(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetChannelMember(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
c := th.Client
|
||||
@@ -3340,6 +3374,7 @@ func TestGetChannelMember(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetChannelMembersForUser(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -3388,6 +3423,7 @@ func TestGetChannelMembersForUser(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestViewChannel(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -3466,6 +3502,7 @@ func TestViewChannel(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestReadMultipleChannels(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -3545,6 +3582,7 @@ func TestReadMultipleChannels(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetChannelUnread(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -3593,6 +3631,7 @@ func TestGetChannelUnread(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetChannelStats(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -3651,6 +3690,7 @@ func TestGetChannelStats(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetPinnedPosts(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -3687,6 +3727,7 @@ func TestGetPinnedPosts(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUpdateChannelRoles(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -3766,6 +3807,7 @@ func TestUpdateChannelRoles(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUpdateChannelMemberSchemeRoles(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -3920,6 +3962,7 @@ func TestUpdateChannelMemberSchemeRoles(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUpdateChannelNotifyProps(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -3965,6 +4008,7 @@ func TestUpdateChannelNotifyProps(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestAddChannelMember(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -4183,6 +4227,7 @@ func TestAddChannelMember(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestAddChannelMembers(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -4213,6 +4258,7 @@ func TestAddChannelMembers(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestAddChannelMemberFromThread(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
t.Skip("MM-41285")
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
@@ -4334,6 +4380,7 @@ func TestAddChannelMemberGuestAccessControl(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestAddChannelMemberAddMyself(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -4409,6 +4456,7 @@ func TestAddChannelMemberAddMyself(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestRemoveChannelMember(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
user1 := th.BasicUser
|
||||
user2 := th.BasicUser2
|
||||
@@ -4629,6 +4677,7 @@ func TestRemoveChannelMember(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestAutocompleteChannels(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -4697,6 +4746,7 @@ func TestAutocompleteChannels(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestAutocompleteChannelsForSearch(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -4810,6 +4860,7 @@ func TestAutocompleteChannelsForSearch(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestAutocompleteChannelsForSearchGuestUsers(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -4939,6 +4990,7 @@ func TestAutocompleteChannelsForSearchGuestUsers(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUpdateChannelScheme(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -5022,6 +5074,7 @@ func TestUpdateChannelScheme(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetChannelMembersTimezones(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -5065,6 +5118,7 @@ func TestGetChannelMembersTimezones(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestChannelMembersMinusGroupMembers(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -5159,6 +5213,7 @@ func TestChannelMembersMinusGroupMembers(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetChannelModerations(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -5373,6 +5428,7 @@ func TestGetChannelModerations(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPatchChannelModerations(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -5557,6 +5613,7 @@ func TestPatchChannelModerations(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetChannelMemberCountsByGroup(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -5649,6 +5706,7 @@ func TestGetChannelMemberCountsByGroup(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetChannelsMemberCount(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
// Setup
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
@@ -5733,6 +5791,7 @@ func TestGetChannelsMemberCount(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestMoveChannel(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -5864,6 +5923,7 @@ func TestMoveChannel(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestRootMentionsCount(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -5905,6 +5965,7 @@ func TestRootMentionsCount(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestViewChannelWithoutCollapsedThreads(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ import (
|
||||
)
|
||||
|
||||
func Test_GetSubscription(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
deliquencySince := int64(2000000000)
|
||||
|
||||
subscription := &model.Subscription{
|
||||
@@ -52,6 +53,7 @@ func Test_GetSubscription(t *testing.T) {
|
||||
}
|
||||
|
||||
t.Run("NON Admin users receive the user facing subscription", func(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -77,6 +79,7 @@ func Test_GetSubscription(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("Admin users receive the full subscription information", func(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -103,7 +106,9 @@ func Test_GetSubscription(t *testing.T) {
|
||||
}
|
||||
|
||||
func Test_validateBusinessEmail(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
t.Run("Returns forbidden for invalid business email", func(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -129,6 +134,7 @@ func Test_validateBusinessEmail(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("Validate business email for admin", func(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -154,6 +160,7 @@ func Test_validateBusinessEmail(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("Empty body returns bad request", func(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -169,7 +176,9 @@ func Test_validateBusinessEmail(t *testing.T) {
|
||||
}
|
||||
|
||||
func Test_validateWorkspaceBusinessEmail(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
t.Run("validate the Cloud Customer has used a valid email to create the workspace", func(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -201,6 +210,7 @@ func Test_validateWorkspaceBusinessEmail(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("validate the Cloud Customer has used a invalid email to create the workspace and must validate admin email", func(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -237,6 +247,7 @@ func Test_validateWorkspaceBusinessEmail(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("Error while grabbing the cloud customer returns bad request", func(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -271,6 +282,7 @@ func Test_validateWorkspaceBusinessEmail(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetCloudProducts(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
cloudProducts := []*model.Product{
|
||||
{
|
||||
ID: "prod_test1",
|
||||
@@ -337,6 +349,7 @@ func TestGetCloudProducts(t *testing.T) {
|
||||
},
|
||||
}
|
||||
t.Run("get products for admins", func(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -359,6 +372,7 @@ func TestGetCloudProducts(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("get products for non admins", func(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -418,6 +432,7 @@ func TestGetCloudProducts(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetSelfHostedProducts(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
products := []*model.Product{
|
||||
{
|
||||
ID: "prod_test",
|
||||
@@ -459,6 +474,7 @@ func TestGetSelfHostedProducts(t *testing.T) {
|
||||
}
|
||||
|
||||
t.Run("get products for admins", func(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -479,6 +495,7 @@ func TestGetSelfHostedProducts(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("get products for non admins", func(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ import (
|
||||
)
|
||||
|
||||
func TestGetClusterStatus(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ import (
|
||||
)
|
||||
|
||||
func TestHelpCommand(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ import (
|
||||
)
|
||||
|
||||
func TestCreateCommand(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -36,7 +37,8 @@ func TestCreateCommand(t *testing.T) {
|
||||
TeamId: th.BasicTeam.Id,
|
||||
URL: "http://nowhere.com",
|
||||
Method: model.CommandMethodPost,
|
||||
Trigger: "trigger"}
|
||||
Trigger: "trigger",
|
||||
}
|
||||
|
||||
_, resp, err := client.CreateCommand(context.Background(), newCmd)
|
||||
require.Error(t, err)
|
||||
@@ -82,6 +84,7 @@ func TestCreateCommand(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUpdateCommand(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
user := th.SystemAdminUser
|
||||
@@ -161,6 +164,7 @@ func TestUpdateCommand(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestMoveCommand(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
user := th.SystemAdminUser
|
||||
@@ -219,6 +223,7 @@ func TestMoveCommand(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDeleteCommand(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
user := th.SystemAdminUser
|
||||
@@ -277,6 +282,7 @@ func TestDeleteCommand(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestListCommands(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -292,7 +298,8 @@ func TestListCommands(t *testing.T) {
|
||||
TeamId: th.BasicTeam.Id,
|
||||
URL: "http://nowhere.com",
|
||||
Method: model.CommandMethodPost,
|
||||
Trigger: "custom_command"}
|
||||
Trigger: "custom_command",
|
||||
}
|
||||
|
||||
_, _, err := th.SystemAdminClient.CreateCommand(context.Background(), newCmd)
|
||||
require.NoError(t, err)
|
||||
@@ -372,6 +379,7 @@ func TestListCommands(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestListAutocompleteCommands(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -381,7 +389,8 @@ func TestListAutocompleteCommands(t *testing.T) {
|
||||
TeamId: th.BasicTeam.Id,
|
||||
URL: "http://nowhere.com",
|
||||
Method: model.CommandMethodPost,
|
||||
Trigger: "custom_command"}
|
||||
Trigger: "custom_command",
|
||||
}
|
||||
|
||||
_, _, err := th.SystemAdminClient.CreateCommand(context.Background(), newCmd)
|
||||
require.NoError(t, err)
|
||||
@@ -441,6 +450,7 @@ func TestListAutocompleteCommands(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestListCommandAutocompleteSuggestions(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -450,7 +460,8 @@ func TestListCommandAutocompleteSuggestions(t *testing.T) {
|
||||
TeamId: th.BasicTeam.Id,
|
||||
URL: "http://nowhere.com",
|
||||
Method: model.CommandMethodPost,
|
||||
Trigger: "custom_command"}
|
||||
Trigger: "custom_command",
|
||||
}
|
||||
|
||||
_, _, err := th.SystemAdminClient.CreateCommand(context.Background(), newCmd)
|
||||
require.NoError(t, err)
|
||||
@@ -533,6 +544,7 @@ func TestListCommandAutocompleteSuggestions(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetCommand(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -547,7 +559,8 @@ func TestGetCommand(t *testing.T) {
|
||||
TeamId: th.BasicTeam.Id,
|
||||
URL: "http://nowhere.com",
|
||||
Method: model.CommandMethodPost,
|
||||
Trigger: "roger"}
|
||||
Trigger: "roger",
|
||||
}
|
||||
|
||||
newCmd, _, err := th.SystemAdminClient.CreateCommand(context.Background(), newCmd)
|
||||
require.NoError(t, err)
|
||||
@@ -594,6 +607,7 @@ func TestGetCommand(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestRegenToken(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -609,7 +623,8 @@ func TestRegenToken(t *testing.T) {
|
||||
TeamId: th.BasicTeam.Id,
|
||||
URL: "http://nowhere.com",
|
||||
Method: model.CommandMethodPost,
|
||||
Trigger: "trigger"}
|
||||
Trigger: "trigger",
|
||||
}
|
||||
|
||||
createdCmd, resp, err := th.SystemAdminClient.CreateCommand(context.Background(), newCmd)
|
||||
require.NoError(t, err)
|
||||
@@ -626,6 +641,7 @@ func TestRegenToken(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestExecuteInvalidCommand(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -696,6 +712,7 @@ func TestExecuteInvalidCommand(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestExecuteGetCommand(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -758,6 +775,7 @@ func TestExecuteGetCommand(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestExecutePostCommand(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -818,6 +836,7 @@ func TestExecutePostCommand(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestExecuteCommandAgainstChannelOnAnotherTeam(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -871,6 +890,7 @@ func TestExecuteCommandAgainstChannelOnAnotherTeam(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestExecuteCommandAgainstChannelUserIsNotIn(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -927,6 +947,7 @@ func TestExecuteCommandAgainstChannelUserIsNotIn(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestExecuteCommandInDirectMessageChannel(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -991,6 +1012,7 @@ func TestExecuteCommandInDirectMessageChannel(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestExecuteCommandInTeamUserIsNotOn(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -1067,6 +1089,7 @@ func TestExecuteCommandInTeamUserIsNotOn(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestExecuteCommandReadOnly(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
|
||||
@@ -17,6 +17,7 @@ import (
|
||||
)
|
||||
|
||||
func TestEchoCommand(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -41,6 +42,7 @@ func TestEchoCommand(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGroupmsgCommands(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -89,6 +91,7 @@ func TestGroupmsgCommands(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestInvitePeopleCommand(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -167,10 +170,12 @@ func testJoinCommands(t *testing.T, alias string) {
|
||||
}
|
||||
|
||||
func TestJoinCommands(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
testJoinCommands(t, "join")
|
||||
}
|
||||
|
||||
func TestLoadTestHelpCommands(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -190,6 +195,7 @@ func TestLoadTestHelpCommands(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestLoadTestSetupCommands(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -209,6 +215,7 @@ func TestLoadTestSetupCommands(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestLoadTestUsersCommands(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -228,6 +235,7 @@ func TestLoadTestUsersCommands(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestLoadTestChannelsCommands(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -247,6 +255,7 @@ func TestLoadTestChannelsCommands(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestLoadTestPostsCommands(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -266,6 +275,7 @@ func TestLoadTestPostsCommands(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestLeaveCommands(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -322,6 +332,7 @@ func TestLeaveCommands(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestLogoutTestCommand(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -330,6 +341,7 @@ func TestLogoutTestCommand(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestMeCommand(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -357,6 +369,7 @@ func TestMeCommand(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestMsgCommands(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -404,10 +417,12 @@ func TestMsgCommands(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestOpenCommands(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
testJoinCommands(t, "open")
|
||||
}
|
||||
|
||||
func TestSearchCommand(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -416,6 +431,7 @@ func TestSearchCommand(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSettingsCommand(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -424,6 +440,7 @@ func TestSettingsCommand(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestShortcutsCommand(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -432,6 +449,7 @@ func TestShortcutsCommand(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestShrugCommand(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -452,6 +470,7 @@ func TestShrugCommand(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestStatusCommands(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ const (
|
||||
)
|
||||
|
||||
func TestCORSRequestHandling(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
for name, testcase := range map[string]struct {
|
||||
AllowCorsFrom string
|
||||
CorsExposedHeaders string
|
||||
|
||||
@@ -7,7 +7,6 @@ import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
@@ -17,9 +16,10 @@ import (
|
||||
)
|
||||
|
||||
func TestCreateCPAField(t *testing.T) {
|
||||
os.Setenv("MM_FEATUREFLAGS_CUSTOMPROFILEATTRIBUTES", "true")
|
||||
defer os.Unsetenv("MM_FEATUREFLAGS_CUSTOMPROFILEATTRIBUTES")
|
||||
th := Setup(t)
|
||||
mainHelper.Parallel(t)
|
||||
th := SetupConfig(t, func(cfg *model.Config) {
|
||||
cfg.FeatureFlags.CustomProfileAttributes = true
|
||||
})
|
||||
defer th.TearDown()
|
||||
|
||||
th.TestForSystemAdminAndLocal(t, func(t *testing.T, client *model.Client4) {
|
||||
@@ -96,9 +96,10 @@ func TestCreateCPAField(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestListCPAFields(t *testing.T) {
|
||||
os.Setenv("MM_FEATUREFLAGS_CUSTOMPROFILEATTRIBUTES", "true")
|
||||
defer os.Unsetenv("MM_FEATUREFLAGS_CUSTOMPROFILEATTRIBUTES")
|
||||
th := Setup(t)
|
||||
mainHelper.Parallel(t)
|
||||
th := SetupConfig(t, func(cfg *model.Config) {
|
||||
cfg.FeatureFlags.CustomProfileAttributes = true
|
||||
})
|
||||
defer th.TearDown()
|
||||
|
||||
field, err := model.NewCPAFieldFromPropertyField(&model.PropertyField{
|
||||
@@ -142,9 +143,10 @@ func TestListCPAFields(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPatchCPAField(t *testing.T) {
|
||||
os.Setenv("MM_FEATUREFLAGS_CUSTOMPROFILEATTRIBUTES", "true")
|
||||
defer os.Unsetenv("MM_FEATUREFLAGS_CUSTOMPROFILEATTRIBUTES")
|
||||
th := Setup(t)
|
||||
mainHelper.Parallel(t)
|
||||
th := SetupConfig(t, func(cfg *model.Config) {
|
||||
cfg.FeatureFlags.CustomProfileAttributes = true
|
||||
})
|
||||
defer th.TearDown()
|
||||
|
||||
th.TestForSystemAdminAndLocal(t, func(t *testing.T, client *model.Client4) {
|
||||
@@ -283,9 +285,10 @@ func TestPatchCPAField(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDeleteCPAField(t *testing.T) {
|
||||
os.Setenv("MM_FEATUREFLAGS_CUSTOMPROFILEATTRIBUTES", "true")
|
||||
defer os.Unsetenv("MM_FEATUREFLAGS_CUSTOMPROFILEATTRIBUTES")
|
||||
th := Setup(t)
|
||||
mainHelper.Parallel(t)
|
||||
th := SetupConfig(t, func(cfg *model.Config) {
|
||||
cfg.FeatureFlags.CustomProfileAttributes = true
|
||||
})
|
||||
defer th.TearDown()
|
||||
|
||||
th.TestForSystemAdminAndLocal(t, func(t *testing.T, client *model.Client4) {
|
||||
@@ -355,9 +358,11 @@ func TestDeleteCPAField(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestListCPAValues(t *testing.T) {
|
||||
os.Setenv("MM_FEATUREFLAGS_CUSTOMPROFILEATTRIBUTES", "true")
|
||||
defer os.Unsetenv("MM_FEATUREFLAGS_CUSTOMPROFILEATTRIBUTES")
|
||||
th := Setup(t).InitBasic()
|
||||
mainHelper.Parallel(t)
|
||||
|
||||
th := SetupConfig(t, func(cfg *model.Config) {
|
||||
cfg.FeatureFlags.CustomProfileAttributes = true
|
||||
}).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
th.RemovePermissionFromRole(model.PermissionViewMembers.Id, model.SystemUserRoleId)
|
||||
@@ -442,9 +447,11 @@ func TestListCPAValues(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPatchCPAValues(t *testing.T) {
|
||||
os.Setenv("MM_FEATUREFLAGS_CUSTOMPROFILEATTRIBUTES", "true")
|
||||
defer os.Unsetenv("MM_FEATUREFLAGS_CUSTOMPROFILEATTRIBUTES")
|
||||
th := Setup(t).InitBasic()
|
||||
mainHelper.Parallel(t)
|
||||
|
||||
th := SetupConfig(t, func(cfg *model.Config) {
|
||||
cfg.FeatureFlags.CustomProfileAttributes = true
|
||||
}).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
field, err := model.NewCPAFieldFromPropertyField(&model.PropertyField{
|
||||
|
||||
@@ -17,6 +17,7 @@ import (
|
||||
)
|
||||
|
||||
func TestDataRetentionGetPolicy(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -26,6 +27,7 @@ func TestDataRetentionGetPolicy(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetPolicies(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -112,6 +114,7 @@ func TestGetPolicies(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetDataRetentionPoliciesCount(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -159,6 +162,7 @@ func TestGetDataRetentionPoliciesCount(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetPolicy(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -244,6 +248,7 @@ func TestGetPolicy(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCreatePolicy(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -340,6 +345,7 @@ func TestCreatePolicy(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPatchPolicy(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -455,6 +461,7 @@ func TestPatchPolicy(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDeletePolicy(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -522,6 +529,7 @@ func TestDeletePolicy(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetTeamPoliciesForUser(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -607,6 +615,7 @@ func TestGetTeamPoliciesForUser(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetChannelPoliciesForUser(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -692,6 +701,7 @@ func TestGetChannelPoliciesForUser(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetTeamsForPolicy(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -782,6 +792,7 @@ func TestGetTeamsForPolicy(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestAddTeamsToPolicy(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -852,6 +863,7 @@ func TestAddTeamsToPolicy(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestRemoveTeamsFromPolicy(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -922,6 +934,7 @@ func TestRemoveTeamsFromPolicy(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetChannelsForPolicy(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -1022,6 +1035,7 @@ func TestGetChannelsForPolicy(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestAddChannelsToPolicy(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -1141,6 +1155,7 @@ func TestAddChannelsToPolicy(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestRemoveChannelsFromPolicy(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@ package api4
|
||||
|
||||
import (
|
||||
"context"
|
||||
"os"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
@@ -17,10 +16,7 @@ import (
|
||||
)
|
||||
|
||||
func TestUpsertDraft(t *testing.T) {
|
||||
os.Setenv("MM_FEATUREFLAGS_GLOBALDRAFTS", "true")
|
||||
defer os.Unsetenv("MM_FEATUREFLAGS_GLOBALDRAFTS")
|
||||
os.Setenv("MM_SERVICESETTINGS_ALLOWSYNCEDDRAFTS", "true")
|
||||
defer os.Unsetenv("MM_SERVICESETTINGS_ALLOWSYNCEDDRAFTS")
|
||||
mainHelper.Parallel(t)
|
||||
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
@@ -76,8 +72,6 @@ func TestUpsertDraft(t *testing.T) {
|
||||
CheckForbiddenStatus(t, resp)
|
||||
|
||||
// try to upsert draft without config setting set to true
|
||||
os.Setenv("MM_SERVICESETTINGS_ALLOWSYNCEDDRAFTS", "false")
|
||||
defer os.Unsetenv("MM_SERVICESETTINGS_ALLOWSYNCEDDRAFTS")
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.AllowSyncedDrafts = false })
|
||||
|
||||
_, resp, err = client.UpsertDraft(context.Background(), draft)
|
||||
@@ -86,10 +80,7 @@ func TestUpsertDraft(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetDrafts(t *testing.T) {
|
||||
os.Setenv("MM_FEATUREFLAGS_GLOBALDRAFTS", "true")
|
||||
defer os.Unsetenv("MM_FEATUREFLAGS_GLOBALDRAFTS")
|
||||
os.Setenv("MM_SERVICESETTINGS_ALLOWSYNCEDDRAFTS", "true")
|
||||
defer os.Unsetenv("MM_SERVICESETTINGS_ALLOWSYNCEDDRAFTS")
|
||||
mainHelper.Parallel(t)
|
||||
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
@@ -149,8 +140,6 @@ func TestGetDrafts(t *testing.T) {
|
||||
CheckForbiddenStatus(t, resp)
|
||||
|
||||
// try to get drafts when config is turned off
|
||||
os.Setenv("MM_SERVICESETTINGS_ALLOWSYNCEDDRAFTS", "false")
|
||||
defer os.Unsetenv("MM_SERVICESETTINGS_ALLOWSYNCEDDRAFTS")
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.AllowSyncedDrafts = false })
|
||||
_, resp, err = client.GetDrafts(context.Background(), user.Id, team.Id)
|
||||
require.Error(t, err)
|
||||
@@ -158,10 +147,7 @@ func TestGetDrafts(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDeleteDraft(t *testing.T) {
|
||||
os.Setenv("MM_FEATUREFLAGS_GLOBALDRAFTS", "true")
|
||||
defer os.Unsetenv("MM_FEATUREFLAGS_GLOBALDRAFTS")
|
||||
os.Setenv("MM_SERVICESETTINGS_ALLOWSYNCEDDRAFTS", "true")
|
||||
defer os.Unsetenv("MM_SERVICESETTINGS_ALLOWSYNCEDDRAFTS")
|
||||
mainHelper.Parallel(t)
|
||||
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
@@ -201,7 +187,7 @@ func TestDeleteDraft(t *testing.T) {
|
||||
_, _, err = client.UpsertDraft(context.Background(), draft2)
|
||||
require.NoError(t, err)
|
||||
|
||||
//get drafts
|
||||
// get drafts
|
||||
draftResp, _, err := client.GetDrafts(context.Background(), user.Id, team.Id)
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -217,7 +203,7 @@ func TestDeleteDraft(t *testing.T) {
|
||||
_, _, err = client.DeleteDraft(context.Background(), user.Id, channel1.Id, draft1.RootId)
|
||||
require.NoError(t, err)
|
||||
|
||||
//get drafts
|
||||
// get drafts
|
||||
draftResp, _, err = client.GetDrafts(context.Background(), user.Id, team.Id)
|
||||
require.NoError(t, err)
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ import (
|
||||
)
|
||||
|
||||
func TestElasticsearchTest(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -56,6 +57,7 @@ func TestElasticsearchTest(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestElasticsearchPurgeIndexes(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ import (
|
||||
)
|
||||
|
||||
func TestCreateEmoji(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -212,6 +213,7 @@ func TestCreateEmoji(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetEmojiList(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -305,6 +307,7 @@ func TestGetEmojiList(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetEmojisByNames(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -385,6 +388,7 @@ func TestGetEmojisByNames(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDeleteEmoji(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -414,7 +418,7 @@ func TestDeleteEmoji(t *testing.T) {
|
||||
_, _, err = client.GetEmoji(context.Background(), newEmoji.Id)
|
||||
require.Error(t, err, "expected error fetching deleted emoji")
|
||||
|
||||
//Admin can delete other users emoji
|
||||
// Admin can delete other users emoji
|
||||
newEmoji, _, err = client.CreateEmoji(context.Background(), emoji, utils.CreateTestGif(t, 10, 10), "image.gif")
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -429,17 +433,17 @@ func TestDeleteEmoji(t *testing.T) {
|
||||
require.Error(t, err)
|
||||
CheckNotFoundStatus(t, resp)
|
||||
|
||||
//Try to delete non-existing emoji
|
||||
// Try to delete non-existing emoji
|
||||
resp, err = client.DeleteEmoji(context.Background(), model.NewId())
|
||||
require.Error(t, err)
|
||||
CheckNotFoundStatus(t, resp)
|
||||
|
||||
//Try to delete without Id
|
||||
// Try to delete without Id
|
||||
resp, err = client.DeleteEmoji(context.Background(), "")
|
||||
require.Error(t, err)
|
||||
CheckNotFoundStatus(t, resp)
|
||||
|
||||
//Try to delete my custom emoji without permissions
|
||||
// Try to delete my custom emoji without permissions
|
||||
newEmoji, _, err = client.CreateEmoji(context.Background(), emoji, utils.CreateTestGif(t, 10, 10), "image.gif")
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -449,7 +453,7 @@ func TestDeleteEmoji(t *testing.T) {
|
||||
CheckForbiddenStatus(t, resp)
|
||||
th.AddPermissionToRole(model.PermissionDeleteEmojis.Id, model.SystemUserRoleId)
|
||||
|
||||
//Try to delete other user's custom emoji without DELETE_EMOJIS permissions
|
||||
// Try to delete other user's custom emoji without DELETE_EMOJIS permissions
|
||||
emoji = &model.Emoji{
|
||||
CreatorId: th.BasicUser.Id,
|
||||
Name: model.NewId(),
|
||||
@@ -476,7 +480,7 @@ func TestDeleteEmoji(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
th.LoginBasic()
|
||||
|
||||
//Try to delete other user's custom emoji without DELETE_OTHERS_EMOJIS permissions
|
||||
// Try to delete other user's custom emoji without DELETE_OTHERS_EMOJIS permissions
|
||||
emoji = &model.Emoji{
|
||||
CreatorId: th.BasicUser.Id,
|
||||
Name: model.NewId(),
|
||||
@@ -497,7 +501,7 @@ func TestDeleteEmoji(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
th.LoginBasic()
|
||||
|
||||
//Try to delete other user's custom emoji with permissions
|
||||
// Try to delete other user's custom emoji with permissions
|
||||
emoji = &model.Emoji{
|
||||
CreatorId: th.BasicUser.Id,
|
||||
Name: model.NewId(),
|
||||
@@ -520,7 +524,7 @@ func TestDeleteEmoji(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
th.LoginBasic()
|
||||
|
||||
//Try to delete my custom emoji with permissions at team level
|
||||
// Try to delete my custom emoji with permissions at team level
|
||||
newEmoji, _, err = client.CreateEmoji(context.Background(), emoji, utils.CreateTestGif(t, 10, 10), "image.gif")
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -531,7 +535,7 @@ func TestDeleteEmoji(t *testing.T) {
|
||||
th.AddPermissionToRole(model.PermissionDeleteEmojis.Id, model.SystemUserRoleId)
|
||||
th.RemovePermissionFromRole(model.PermissionDeleteEmojis.Id, model.TeamUserRoleId)
|
||||
|
||||
//Try to delete other user's custom emoji with permissions at team level
|
||||
// Try to delete other user's custom emoji with permissions at team level
|
||||
emoji = &model.Emoji{
|
||||
CreatorId: th.BasicUser.Id,
|
||||
Name: model.NewId(),
|
||||
@@ -555,6 +559,7 @@ func TestDeleteEmoji(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetEmoji(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -583,6 +588,7 @@ func TestGetEmoji(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetEmojiByName(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -613,6 +619,7 @@ func TestGetEmojiByName(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetEmojiImage(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -708,6 +715,7 @@ func TestGetEmojiImage(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSearchEmoji(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -810,6 +818,7 @@ func TestSearchEmoji(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestAutocompleteEmoji(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
|
||||
@@ -17,6 +17,7 @@ import (
|
||||
)
|
||||
|
||||
func TestListExports(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -87,6 +88,7 @@ func TestListExports(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDeleteExport(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -131,6 +133,7 @@ func TestDeleteExport(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDownloadExport(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
|
||||
@@ -205,6 +205,7 @@ func testUploadFilesMultipart(
|
||||
}
|
||||
|
||||
func TestUploadFiles(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
if *th.App.Config().FileSettings.DriverName == "" {
|
||||
@@ -781,6 +782,7 @@ func TestUploadFiles(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetFile(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -822,6 +824,7 @@ func TestGetFile(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetFileAsSystemAdmin(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -907,6 +910,7 @@ func TestGetFileAsSystemAdmin(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetFileHeaders(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -975,6 +979,7 @@ func TestGetFileHeaders(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetFileThumbnail(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -1025,6 +1030,7 @@ func TestGetFileThumbnail(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetFileThumbnailAsSystemAdmin(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -1112,6 +1118,7 @@ func TestGetFileThumbnailAsSystemAdmin(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetFileLink(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -1183,6 +1190,7 @@ func TestGetFileLink(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetFilePreview(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -1232,6 +1240,7 @@ func TestGetFilePreview(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetFileInfo(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -1289,6 +1298,7 @@ func TestGetFileInfo(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetPublicFile(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -1352,6 +1362,7 @@ func TestGetPublicFile(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSearchFilesInTeam(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
experimentalViewArchivedChannels := *th.App.Config().TeamSettings.ExperimentalViewArchivedChannels
|
||||
@@ -1502,6 +1513,7 @@ func TestSearchFilesInTeam(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSearchFilesAcrossTeams(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
experimentalViewArchivedChannels := *th.App.Config().TeamSettings.ExperimentalViewArchivedChannels
|
||||
|
||||
@@ -18,6 +18,7 @@ import (
|
||||
)
|
||||
|
||||
func TestGetGroup(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -69,6 +70,7 @@ func TestGetGroup(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCreateGroup(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -179,6 +181,7 @@ func TestCreateGroup(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDeleteGroup(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -224,6 +227,7 @@ func TestDeleteGroup(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUndeleteGroup(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -256,6 +260,7 @@ func TestUndeleteGroup(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPatchGroup(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -359,6 +364,7 @@ func TestPatchGroup(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestLinkGroupTeam(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -472,6 +478,7 @@ func TestLinkGroupTeam(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestLinkGroupChannel(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -597,6 +604,7 @@ func TestLinkGroupChannel(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUnlinkGroupTeam(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -716,6 +724,7 @@ func TestUnlinkGroupTeam(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUnlinkGroupChannel(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -997,6 +1006,7 @@ func TestUnlinkGroupChannel(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetGroupTeam(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -1060,6 +1070,7 @@ func TestGetGroupTeam(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetGroupChannel(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -1123,6 +1134,7 @@ func TestGetGroupChannel(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetGroupTeams(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -1177,6 +1189,7 @@ func TestGetGroupTeams(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetGroupChannels(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -1230,6 +1243,7 @@ func TestGetGroupChannels(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPatchGroupTeam(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -1303,6 +1317,7 @@ func TestPatchGroupTeam(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPatchGroupChannel(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -1387,6 +1402,7 @@ func TestPatchGroupChannel(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetGroupsByChannel(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -1530,6 +1546,7 @@ func TestGetGroupsByChannel(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetGroupsAssociatedToChannelsByTeam(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -1682,6 +1699,7 @@ func TestGetGroupsAssociatedToChannelsByTeam(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetGroupsByTeam(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -1874,6 +1892,7 @@ func TestGetGroupsByTeam(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetGroups(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -2256,6 +2275,7 @@ func TestGetGroups(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetGroupsByUserId(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -2327,6 +2347,7 @@ func TestGetGroupsByUserId(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetGroupMembers(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -2394,6 +2415,7 @@ func TestGetGroupMembers(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetGroupStats(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -2443,6 +2465,7 @@ func TestGetGroupStats(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetGroupsGroupConstrainedParentTeam(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -2526,6 +2549,7 @@ func TestGetGroupsGroupConstrainedParentTeam(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestAddMembersToGroup(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -2699,6 +2723,7 @@ func TestAddMembersToGroup(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDeleteMembersFromGroup(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
|
||||
@@ -69,6 +69,7 @@ func testAPIHandlerNoGzipMode(t *testing.T, name string, h http.Handler, token s
|
||||
}
|
||||
|
||||
func TestAPIHandlersWithGzip(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@ import (
|
||||
)
|
||||
|
||||
func TestGetImage(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ import (
|
||||
)
|
||||
|
||||
func TestListImports(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -110,6 +111,7 @@ func TestListImports(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestImportInLocalMode(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := SetupWithServerOptions(t, []app.Option{app.RunEssentialJobs})
|
||||
defer th.TearDown()
|
||||
|
||||
|
||||
@@ -47,6 +47,7 @@ func (th *testHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func TestPostActionCookies(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -148,6 +149,7 @@ func TestPostActionCookies(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestOpenDialog(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -285,6 +287,7 @@ func TestOpenDialog(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSubmitDialog(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
|
||||
@@ -16,6 +16,7 @@ import (
|
||||
)
|
||||
|
||||
func TestCreateJob(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
th.LoginSystemManager()
|
||||
defer th.TearDown()
|
||||
@@ -50,6 +51,7 @@ func TestCreateJob(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetJob(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -86,6 +88,7 @@ func TestGetJob(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetJobs(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -170,6 +173,7 @@ func TestGetJobs(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetJobsByType(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
th.LoginSystemManager()
|
||||
defer th.TearDown()
|
||||
@@ -239,6 +243,7 @@ func TestGetJobsByType(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDownloadJob(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
th.LoginSystemManager()
|
||||
defer th.TearDown()
|
||||
@@ -280,7 +285,7 @@ func TestDownloadJob(t *testing.T) {
|
||||
require.NoError(t, delErr, "Failed to delete job %s", job.Id)
|
||||
}()
|
||||
|
||||
filePath := filepath.Join(*th.App.Config().FileSettings.Directory, "export", job.Id+"/testdat.txt")
|
||||
filePath := filepath.Join(*th.App.Config().FileSettings.Directory, "export/"+job.Id+"/testdat.txt")
|
||||
err = os.MkdirAll(filepath.Dir(filePath), 0770)
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -314,7 +319,7 @@ func TestDownloadJob(t *testing.T) {
|
||||
|
||||
// Now we stub the results of the job into the same directory and try to download it again
|
||||
// This time we should successfully retrieve the results without any error
|
||||
filePath = filepath.Join(*th.App.Config().FileSettings.Directory, "export", job.Id+".zip")
|
||||
filePath = filepath.Join(*th.App.Config().FileSettings.Directory, "export/"+job.Id+".zip")
|
||||
err = os.MkdirAll(filepath.Dir(filePath), 0770)
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -372,6 +377,7 @@ func TestDownloadJob(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCancelJob(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -422,6 +428,7 @@ func TestCancelJob(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUpdateJobStatus(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
|
||||
@@ -101,6 +101,7 @@ MCOV5SHi05kD42JSSbmw190VAa4QRGikaeWRhDsj
|
||||
-----END CERTIFICATE-----`
|
||||
|
||||
func TestTestLdap(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -127,6 +128,7 @@ func TestTestLdap(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSyncLdap(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -175,6 +177,7 @@ func TestSyncLdap(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetLdapGroups(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -190,6 +193,7 @@ func TestGetLdapGroups(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestLinkLdapGroup(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
const entryUUID string = "foo"
|
||||
|
||||
th := Setup(t)
|
||||
@@ -205,6 +209,7 @@ func TestLinkLdapGroup(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUnlinkLdapGroup(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
const entryUUID string = "foo"
|
||||
|
||||
th := Setup(t)
|
||||
@@ -220,6 +225,7 @@ func TestUnlinkLdapGroup(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestMigrateIdLdap(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -239,6 +245,7 @@ func TestMigrateIdLdap(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUploadPublicCertificate(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -260,6 +267,7 @@ func TestUploadPublicCertificate(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUploadPrivateCertificate(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -281,6 +289,7 @@ func TestUploadPrivateCertificate(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestAddUserToGroupSyncables(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ import (
|
||||
)
|
||||
|
||||
func TestGetOldClientLicense(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -193,6 +194,7 @@ func TestUploadLicenseFile(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestRemoveLicenseFile(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -407,6 +409,7 @@ func TestRequestTrialLicenseWithExtraFields(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestRequestTrialLicense(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
|
||||
@@ -5,8 +5,11 @@ package api4
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"os"
|
||||
"strconv"
|
||||
"testing"
|
||||
|
||||
"github.com/mattermost/mattermost/server/public/shared/mlog"
|
||||
"github.com/mattermost/mattermost/server/v8/channels/testlib"
|
||||
)
|
||||
|
||||
@@ -18,10 +21,21 @@ func TestMain(m *testing.M) {
|
||||
flag.Parse()
|
||||
}
|
||||
|
||||
var options = testlib.HelperOptions{
|
||||
var parallelism int
|
||||
if f := flag.Lookup("test.parallel"); f != nil {
|
||||
parallelism, _ = strconv.Atoi(f.Value.String())
|
||||
}
|
||||
runParallel := os.Getenv("ENABLE_FULLY_PARALLEL_TESTS") == "true" && parallelism > 1
|
||||
if runParallel {
|
||||
mlog.Info("Fully parallel tests enabled", mlog.Int("parallelism", parallelism))
|
||||
}
|
||||
|
||||
options := testlib.HelperOptions{
|
||||
EnableStore: true,
|
||||
EnableResources: true,
|
||||
WithReadReplica: replicaFlag,
|
||||
RunParallel: runParallel,
|
||||
Parallelism: parallelism,
|
||||
}
|
||||
|
||||
mainHelper = testlib.NewMainHelperWithOptions(&options)
|
||||
|
||||
@@ -35,6 +35,7 @@ func setupMetricsMock() *mocks.MetricsInterface {
|
||||
|
||||
return metricsMock
|
||||
}
|
||||
|
||||
func TestSubmitMetrics(t *testing.T) {
|
||||
t.Run("unauthenticated user should not submit metrics", func(t *testing.T) {
|
||||
th := Setup(t)
|
||||
|
||||
@@ -13,7 +13,9 @@ import (
|
||||
)
|
||||
|
||||
func TestNotifyAdmin(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
t.Run("error when notifying with empty data", func(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -24,6 +26,7 @@ func TestNotifyAdmin(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("error when plan is unknown when notifying on upgrade", func(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -38,6 +41,7 @@ func TestNotifyAdmin(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("error when plan is unknown when notifying to trial", func(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -53,6 +57,7 @@ func TestNotifyAdmin(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("error when feature is unknown when notifying on upgrade", func(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -67,6 +72,7 @@ func TestNotifyAdmin(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("error when feature is unknown when notifying to trial", func(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -82,6 +88,7 @@ func TestNotifyAdmin(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("error when user tries to notify again on same feature within the cool off period", func(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -104,6 +111,7 @@ func TestNotifyAdmin(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("successfully save upgrade notification", func(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -118,7 +126,9 @@ func TestNotifyAdmin(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestTriggerNotifyAdmin(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
t.Run("error when EnableAPITriggerAdminNotifications is not true", func(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -132,6 +142,7 @@ func TestTriggerNotifyAdmin(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("error when non admins try to trigger notifications", func(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -145,6 +156,7 @@ func TestTriggerNotifyAdmin(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("happy path", func(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ import (
|
||||
)
|
||||
|
||||
func TestCreateOAuthApp(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -80,6 +81,8 @@ func TestCreateOAuthApp(t *testing.T) {
|
||||
func TestUpdateOAuthApp(t *testing.T) {
|
||||
t.Skip("https://mattermost.atlassian.net/browse/MM-62895")
|
||||
|
||||
mainHelper.Parallel(t)
|
||||
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -203,6 +206,7 @@ func TestUpdateOAuthApp(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetOAuthApps(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -273,6 +277,7 @@ func TestGetOAuthApps(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetOAuthApp(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -344,6 +349,7 @@ func TestGetOAuthApp(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetOAuthAppInfo(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -413,6 +419,7 @@ func TestGetOAuthAppInfo(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDeleteOAuthApp(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -486,6 +493,7 @@ func TestDeleteOAuthApp(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestRegenerateOAuthAppSecret(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -561,6 +569,7 @@ func TestRegenerateOAuthAppSecret(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetAuthorizedOAuthAppsForUser(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -619,6 +628,7 @@ func TestGetAuthorizedOAuthAppsForUser(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestNilAuthorizeOAuthApp(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
|
||||
@@ -14,6 +14,7 @@ import (
|
||||
)
|
||||
|
||||
func TestGetAncillaryPermissions(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@ import (
|
||||
)
|
||||
|
||||
func TestPlugin(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -286,6 +287,7 @@ func TestPlugin(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestNotifyClusterPluginEvent(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -378,6 +380,7 @@ func TestNotifyClusterPluginEvent(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDisableOnRemove(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
path, _ := fileutils.FindDir("tests")
|
||||
tarData, err := os.ReadFile(filepath.Join(path, "testplugin.tar.gz"))
|
||||
require.NoError(t, err)
|
||||
@@ -1139,6 +1142,7 @@ func TestGetLocalPluginInMarketplace(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetRemotePluginInMarketplace(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -1328,6 +1332,7 @@ func TestGetPrepackagedPluginInMarketplace(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetPrepackagedPlaybooksPluginIn(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -1756,6 +1761,7 @@ func TestInstallMarketplacePlugin(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestInstallMarketplacePluginPrepackagedDisabled(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
path, _ := fileutils.FindDir("tests")
|
||||
|
||||
signatureFilename := "testplugin2.tar.gz.sig"
|
||||
@@ -2093,6 +2099,7 @@ func findClusterMessages(event model.ClusterEvent, msgs []*model.ClusterMessage)
|
||||
}
|
||||
|
||||
func TestPluginWebSocketSession(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -2145,6 +2152,7 @@ func TestPluginWebSocketSession(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPluginWebSocketRemoteAddress(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
|
||||
@@ -34,6 +34,8 @@ import (
|
||||
)
|
||||
|
||||
func TestCreatePost(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -304,6 +306,8 @@ func TestCreatePost(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCreatePostForPriority(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -477,6 +481,7 @@ func TestCreatePostForPriority(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCreatePostWithOAuthClient(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -545,6 +550,8 @@ func TestCreatePostWithOAuthClient(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCreatePostEphemeral(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.SystemAdminClient
|
||||
@@ -583,6 +590,8 @@ func testCreatePostWithOutgoingHook(
|
||||
triggerWhen int,
|
||||
commentPostType bool,
|
||||
) {
|
||||
mainHelper.Parallel(t)
|
||||
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
user := th.SystemAdminUser
|
||||
@@ -1089,6 +1098,8 @@ func TestMoveThread(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCreatePostPublic(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -1146,6 +1157,8 @@ func TestCreatePostPublic(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCreatePostAll(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -1212,6 +1225,8 @@ func TestCreatePostAll(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCreatePostSendOutOfChannelMentions(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -1274,6 +1289,8 @@ func TestCreatePostSendOutOfChannelMentions(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCreatePostCheckOnlineStatus(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -1340,6 +1357,8 @@ func TestCreatePostCheckOnlineStatus(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUpdatePost(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -1690,6 +1709,8 @@ func TestUpdatePost(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUpdateOthersPostInDirectMessageChannel(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
|
||||
// This test checks that a sysadmin with the "EDIT_OTHERS_POSTS" permission can edit someone else's post in a
|
||||
// channel without a team (DM/GM). This indirectly checks for the proper cascading all the way to system-wide roles
|
||||
// on the user object of permissions based on a post in a channel with no team ID.
|
||||
@@ -1715,6 +1736,8 @@ func TestUpdateOthersPostInDirectMessageChannel(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPatchPost(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -2041,6 +2064,8 @@ func TestPatchPost(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPinPost(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -2072,6 +2097,8 @@ func TestPinPost(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUnpinPost(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -2103,6 +2130,8 @@ func TestUnpinPost(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetPostsForChannel(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -2346,6 +2375,8 @@ func TestGetPostsForChannel(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetFlaggedPostsForUser(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -2552,6 +2583,8 @@ func TestGetFlaggedPostsForUser(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetPostsBefore(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -2719,6 +2752,8 @@ func TestGetPostsBefore(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetPostsAfter(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -2867,6 +2902,8 @@ func TestGetPostsAfter(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetPostsForChannelAroundLastUnread(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -3120,6 +3157,8 @@ func TestGetPostsForChannelAroundLastUnread(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetPost(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
// TODO: migrate this entirely to the subtest's client
|
||||
@@ -3219,6 +3258,8 @@ func TestGetPost(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDeletePost(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -3275,6 +3316,8 @@ func TestDeletePost(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPermanentDeletePost(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -3352,7 +3395,11 @@ func TestPermanentDeletePost(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestWebHubMembership(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
|
||||
t.Run("WithChannelIteration", func(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
|
||||
th := SetupConfig(t, func(cfg *model.Config) {
|
||||
*cfg.ServiceSettings.EnableWebHubChannelIteration = true
|
||||
}).InitBasic()
|
||||
@@ -3362,6 +3409,8 @@ func TestWebHubMembership(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("WithoutChannelIteration", func(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -3490,6 +3539,8 @@ func _testWebHubMembership(th *TestHelper, t *testing.T) {
|
||||
}
|
||||
|
||||
func TestWebHubCloseConnOnDBFail(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
|
||||
th := SetupConfig(t, func(cfg *model.Config) {
|
||||
*cfg.ServiceSettings.EnableWebHubChannelIteration = true
|
||||
}).InitBasic()
|
||||
@@ -3510,12 +3561,21 @@ func TestWebHubCloseConnOnDBFail(t *testing.T) {
|
||||
|
||||
wsClient, err := th.CreateWebSocketClientWithClient(cli)
|
||||
require.NoError(t, err)
|
||||
|
||||
wsClient.Listen()
|
||||
select {
|
||||
case <-wsClient.EventChannel: // event channel should be closed on failure
|
||||
case <-time.After(5 * time.Second):
|
||||
require.FailNow(t, "timed out waiting for event")
|
||||
}
|
||||
wsClient.Close()
|
||||
|
||||
require.NoError(t, th.TestLogger.Flush())
|
||||
}
|
||||
|
||||
func TestDeletePostEvent(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -3543,6 +3603,8 @@ func TestDeletePostEvent(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDeletePostMessage(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
|
||||
th := Setup(t).InitBasic()
|
||||
th.LinkUserToTeam(th.SystemAdminUser, th.BasicTeam)
|
||||
_, appErr := th.App.AddUserToChannel(th.Context, th.SystemAdminUser, th.BasicChannel, false)
|
||||
@@ -3589,6 +3651,8 @@ func TestDeletePostMessage(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetPostThread(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -3718,6 +3782,8 @@ func TestGetPostThread(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSearchPosts(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
experimentalViewArchivedChannels := *th.App.Config().TeamSettings.ExperimentalViewArchivedChannels
|
||||
@@ -3870,6 +3936,8 @@ func TestSearchPosts(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSearchHashtagPosts(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
th.LoginBasic()
|
||||
@@ -3896,6 +3964,8 @@ func TestSearchHashtagPosts(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSearchPostsInChannel(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
th.LoginBasic()
|
||||
@@ -3950,6 +4020,8 @@ func TestSearchPostsInChannel(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSearchPostsFromUser(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -4018,6 +4090,8 @@ func TestSearchPostsFromUser(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSearchPostsWithDateFlags(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
th.LoginBasic()
|
||||
@@ -4161,6 +4235,8 @@ func TestGetFileInfosForPost(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSetChannelUnread(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -4335,6 +4411,8 @@ func TestSetChannelUnread(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSetPostUnreadWithoutCollapsedThreads(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
th.App.UpdateConfig(func(cfg *model.Config) {
|
||||
@@ -4430,6 +4508,8 @@ func TestSetPostUnreadWithoutCollapsedThreads(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetPostsByIds(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -4454,6 +4534,8 @@ func TestGetPostsByIds(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetEditHistoryForPost(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -4574,6 +4656,8 @@ func TestGetEditHistoryForPost(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCreatePostNotificationsWithCRT(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
rpost := th.CreatePost()
|
||||
@@ -4727,6 +4811,8 @@ func TestCreatePostNotificationsWithCRT(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetPostStripActionIntegrations(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -4838,6 +4924,8 @@ func TestPostReminder(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPostGetInfo(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -5107,6 +5195,8 @@ func TestPostGetInfo(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestAcknowledgePost(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
th.App.Srv().SetLicense(model.NewTestLicenseSKU(model.LicenseShortSkuProfessional))
|
||||
@@ -5148,6 +5238,8 @@ func TestAcknowledgePost(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUnacknowledgePost(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
th.App.Srv().SetLicense(model.NewTestLicenseSKU(model.LicenseShortSkuProfessional))
|
||||
@@ -5193,6 +5285,8 @@ func TestUnacknowledgePost(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestRestorePostVersion(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
|
||||
@@ -16,6 +16,7 @@ import (
|
||||
)
|
||||
|
||||
func TestGetPreferences(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -87,6 +88,7 @@ func TestGetPreferences(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetPreferencesByCategory(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -157,6 +159,7 @@ func TestGetPreferencesByCategory(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetPreferenceByCategoryAndName(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -226,6 +229,7 @@ func TestGetPreferenceByCategoryAndName(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUpdatePreferences(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -305,6 +309,7 @@ func TestUpdatePreferences(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUpdatePreferencesOverload(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -341,6 +346,7 @@ func TestUpdatePreferencesOverload(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUpdatePreferencesWebsocket(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -392,6 +398,7 @@ func TestUpdatePreferencesWebsocket(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUpdateSidebarPreferences(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
t.Run("when favoriting a channel, should add it to the Favorites sidebar category", func(t *testing.T) {
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
@@ -619,6 +626,7 @@ func TestUpdateSidebarPreferences(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDeletePreferences(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -689,6 +697,7 @@ func TestDeletePreferences(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDeletePreferencesOverload(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -725,6 +734,7 @@ func TestDeletePreferencesOverload(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDeletePreferencesWebsocket(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -778,6 +788,7 @@ func TestDeletePreferencesWebsocket(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDeleteSidebarPreferences(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
t.Run("when removing a favorited channel preference, should remove it from the Favorites sidebar category", func(t *testing.T) {
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
@@ -993,6 +1004,7 @@ func TestDeleteSidebarPreferences(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUpdateLimitVisibleDMsGMs(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
t.Run("Update limit_visible_dms_gms to a valid value", func(t *testing.T) {
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -15,6 +15,7 @@ import (
|
||||
)
|
||||
|
||||
func TestSaveReaction(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -195,6 +196,7 @@ func TestSaveReaction(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetReactions(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -278,6 +280,7 @@ func TestGetReactions(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDeleteReaction(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -519,6 +522,7 @@ func TestDeleteReaction(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetBulkReactions(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
|
||||
@@ -13,6 +13,7 @@ import (
|
||||
)
|
||||
|
||||
func TestGetRemoteClusters(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
t.Run("Should not work if the remote cluster service is not enabled", func(t *testing.T) {
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
@@ -182,6 +183,7 @@ func TestGetRemoteClusters(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCreateRemoteCluster(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
rcWithTeamAndPassword := &model.RemoteClusterWithPassword{
|
||||
RemoteCluster: &model.RemoteCluster{
|
||||
Name: "remotecluster",
|
||||
@@ -294,6 +296,7 @@ func TestCreateRemoteCluster(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestRemoteClusterAcceptinvite(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
rcAcceptInvite := &model.RemoteClusterAcceptInvite{
|
||||
Name: "remotecluster",
|
||||
Invite: "myinvitecode",
|
||||
@@ -392,6 +395,7 @@ func TestRemoteClusterAcceptinvite(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGenerateRemoteClusterInvite(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
password := "mysupersecret"
|
||||
|
||||
newRC := &model.RemoteCluster{
|
||||
@@ -482,6 +486,7 @@ func TestGenerateRemoteClusterInvite(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetRemoteCluster(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
newRC := &model.RemoteCluster{
|
||||
Name: "remotecluster",
|
||||
SiteURL: "http://example.com",
|
||||
@@ -540,6 +545,7 @@ func TestGetRemoteCluster(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPatchRemoteCluster(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
newRC := &model.RemoteCluster{
|
||||
Name: "remotecluster",
|
||||
DisplayName: "initialvalue",
|
||||
@@ -604,6 +610,7 @@ func TestPatchRemoteCluster(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDeleteRemoteCluster(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
newRC := &model.RemoteCluster{
|
||||
Name: "remotecluster",
|
||||
DisplayName: "initialvalue",
|
||||
|
||||
@@ -14,6 +14,7 @@ import (
|
||||
)
|
||||
|
||||
func TestGetUsersForReporting(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -59,6 +60,7 @@ func TestGetUsersForReporting(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestFillReportingBaseOptions(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
t.Run("default values", func(t *testing.T) {
|
||||
values := url.Values{}
|
||||
|
||||
@@ -114,6 +116,7 @@ func TestFillReportingBaseOptions(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestFillUserReportOptions(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
validTeamID := model.NewId()
|
||||
|
||||
t.Run("default values", func(t *testing.T) {
|
||||
|
||||
@@ -17,6 +17,7 @@ import (
|
||||
)
|
||||
|
||||
func TestGetAllRoles(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -39,6 +40,7 @@ func TestGetAllRoles(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetRole(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -81,6 +83,7 @@ func TestGetRole(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetRoleByName(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -123,6 +126,7 @@ func TestGetRoleByName(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetRolesByNames(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -215,6 +219,7 @@ func TestGetRolesByNames(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPatchRole(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ import (
|
||||
)
|
||||
|
||||
func TestGetSamlMetadata(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -27,6 +28,7 @@ func TestGetSamlMetadata(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSamlCompleteCSRFPass(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -55,6 +57,7 @@ func TestSamlCompleteCSRFPass(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSamlResetId(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := SetupEnterprise(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
th.App.Channels().Saml = &mocks.SamlInterface{}
|
||||
|
||||
@@ -12,6 +12,7 @@ import (
|
||||
)
|
||||
|
||||
func TestCreateScheduledPost(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ import (
|
||||
)
|
||||
|
||||
func TestCreateScheme(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -193,6 +194,7 @@ func TestCreateScheme(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetScheme(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -260,6 +262,7 @@ func TestGetScheme(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetSchemes(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -328,6 +331,7 @@ func TestGetSchemes(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetTeamsForScheme(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -425,6 +429,7 @@ func TestGetTeamsForScheme(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetChannelsForScheme(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -524,6 +529,7 @@ func TestGetChannelsForScheme(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPatchScheme(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -652,6 +658,7 @@ func TestPatchScheme(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDeleteScheme(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -871,6 +878,7 @@ func TestDeleteScheme(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUpdateTeamSchemeWithTeamMembers(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
|
||||
@@ -18,9 +18,7 @@ import (
|
||||
"github.com/mattermost/mattermost/server/public/model"
|
||||
)
|
||||
|
||||
var (
|
||||
rnd = rand.New(rand.NewSource(time.Now().UnixNano()))
|
||||
)
|
||||
var rnd = rand.New(rand.NewSource(time.Now().UnixNano()))
|
||||
|
||||
func setupForSharedChannels(tb testing.TB) *TestHelper {
|
||||
th := SetupConfig(tb, func(cfg *model.Config) {
|
||||
@@ -36,6 +34,7 @@ func setupForSharedChannels(tb testing.TB) *TestHelper {
|
||||
}
|
||||
|
||||
func TestGetAllSharedChannels(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := setupForSharedChannels(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -107,6 +106,7 @@ func randomBool() bool {
|
||||
}
|
||||
|
||||
func TestGetRemoteClusterById(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := setupForSharedChannels(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -161,6 +161,7 @@ func TestGetRemoteClusterById(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCreateDirectChannelWithRemoteUser(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
t.Run("should not create a local DM channel that is shared", func(t *testing.T) {
|
||||
th := setupForSharedChannels(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
@@ -276,6 +277,7 @@ func TestCreateDirectChannelWithRemoteUser(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetSharedChannelRemotesByRemoteCluster(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
t.Run("Should not work if the remote cluster service is not enabled", func(t *testing.T) {
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
@@ -534,6 +536,7 @@ func TestGetSharedChannelRemotesByRemoteCluster(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestInviteRemoteClusterToChannel(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
t.Run("Should not work if the remote cluster service is not enabled", func(t *testing.T) {
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
@@ -579,6 +582,7 @@ func TestInviteRemoteClusterToChannel(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUninviteRemoteClusterToChannel(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
t.Run("Should not work if the remote cluster service is not enabled", func(t *testing.T) {
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -15,6 +15,7 @@ import (
|
||||
)
|
||||
|
||||
func TestGetUserStatus(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -79,7 +80,7 @@ func TestGetUserStatus(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("get other user status", func(t *testing.T) {
|
||||
//Get user2 status logged as user1
|
||||
// Get user2 status logged as user1
|
||||
userStatus, _, err := client.GetUserStatus(context.Background(), th.BasicUser2.Id, "")
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, "offline", userStatus.Status)
|
||||
@@ -102,6 +103,7 @@ func TestGetUserStatus(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetUsersStatusesByIds(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -185,6 +187,7 @@ func TestGetUsersStatusesByIds(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUpdateUserStatus(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -249,6 +252,7 @@ func TestUpdateUserStatus(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUpdateUserCustomStatus(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -351,6 +355,7 @@ func TestUpdateUserCustomStatus(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestRemoveUserCustomStatus(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
|
||||
@@ -111,6 +111,7 @@ func TestGetPing(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetAudits(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -143,6 +144,7 @@ func TestGetAudits(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestEmailTest(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -224,6 +226,7 @@ func TestEmailTest(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGenerateSupportPacket(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
th.LoginSystemManager()
|
||||
defer th.TearDown()
|
||||
@@ -283,6 +286,7 @@ func TestGenerateSupportPacket(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSupportPacketFileName(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
tests := map[string]struct {
|
||||
now time.Time
|
||||
customerName string
|
||||
@@ -314,6 +318,7 @@ func TestSupportPacketFileName(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSiteURLTest(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -360,6 +365,7 @@ func TestSiteURLTest(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDatabaseRecycle(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -385,6 +391,7 @@ func TestDatabaseRecycle(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestInvalidateCaches(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -410,6 +417,7 @@ func TestInvalidateCaches(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetLogs(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -458,6 +466,7 @@ func TestGetLogs(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDownloadLogs(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -500,6 +509,7 @@ func TestDownloadLogs(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPostLog(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -542,6 +552,7 @@ func TestPostLog(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetAnalyticsOld(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -595,9 +606,12 @@ func TestGetAnalyticsOld(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, "total_websocket_connections", rows2[5].Name)
|
||||
assert.Equal(t, float64(1), rows2[5].Value)
|
||||
|
||||
WebSocketClient.Close()
|
||||
|
||||
// Give it a second for internal webhub counters to be updated after the client disconnects.
|
||||
// Test can be flaky otherwise.
|
||||
time.Sleep(time.Second)
|
||||
|
||||
rows2, _, err = th.SystemAdminClient.GetAnalyticsOld(context.Background(), "standard", "")
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, "total_websocket_connections", rows2[5].Name)
|
||||
@@ -612,6 +626,7 @@ func TestGetAnalyticsOld(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestS3TestConnection(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -697,6 +712,7 @@ func TestS3TestConnection(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSupportedTimezones(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -709,6 +725,7 @@ func TestSupportedTimezones(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestRedirectLocation(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
expected := "https://mattermost.com/wp-content/themes/mattermostv2/img/logo-light.svg"
|
||||
|
||||
testServer := httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) {
|
||||
@@ -799,6 +816,7 @@ func TestRedirectLocation(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSetServerBusy(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -819,6 +837,7 @@ func TestSetServerBusy(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSetServerBusyInvalidParam(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -834,6 +853,7 @@ func TestSetServerBusyInvalidParam(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestClearServerBusy(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -854,6 +874,7 @@ func TestClearServerBusy(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetServerBusy(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -874,6 +895,7 @@ func TestGetServerBusy(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestServerBusy503(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -917,6 +939,7 @@ func TestServerBusy503(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPushNotificationAck(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
api, err := Init(th.Server)
|
||||
require.NoError(t, err)
|
||||
@@ -1010,6 +1033,7 @@ func TestPushNotificationAck(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCompleteOnboarding(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -1143,6 +1167,7 @@ func TestCompleteOnboarding(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetAppliedSchemaMigrations(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -1170,6 +1195,7 @@ func TestGetAppliedSchemaMigrations(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCheckHasNilFields(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
t.Run("check if the empty struct has nil fields", func(t *testing.T) {
|
||||
var s model.FileSettings
|
||||
res := checkHasNilFields(&s)
|
||||
|
||||
@@ -28,6 +28,7 @@ import (
|
||||
)
|
||||
|
||||
func TestCreateTeam(t *testing.T) {
|
||||
// Test cannot easily run in parallel because it relies on (and mutates) i18n package translations.
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -198,6 +199,7 @@ func TestCreateTeam(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCreateTeamSanitization(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -235,6 +237,7 @@ func TestCreateTeamSanitization(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetTeam(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -291,6 +294,7 @@ func TestGetTeam(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetTeamSanitization(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -360,6 +364,7 @@ func TestGetTeamSanitization(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetTeamUnread(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -396,6 +401,7 @@ func TestGetTeamUnread(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUpdateTeam(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -580,6 +586,7 @@ func TestUpdateTeamPrivacyInvitePermissions(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUpdateTeamSanitization(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -612,6 +619,7 @@ func TestUpdateTeamSanitization(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPatchTeam(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -880,6 +888,7 @@ func TestPatchTeam(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestRestoreTeam(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -1007,6 +1016,7 @@ func TestRestoreTeam(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPatchTeamSanitization(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -1039,6 +1049,7 @@ func TestPatchTeamSanitization(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUpdateTeamPrivacy(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -1131,6 +1142,7 @@ func TestUpdateTeamPrivacy(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestTeamUnicodeNames(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -1201,6 +1213,7 @@ func TestTeamUnicodeNames(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestRegenerateTeamInviteId(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -1225,6 +1238,7 @@ func TestRegenerateTeamInviteId(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSoftDeleteTeam(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -1262,6 +1276,7 @@ func TestSoftDeleteTeam(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPermanentDeleteTeam(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -1313,6 +1328,7 @@ func TestPermanentDeleteTeam(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetAllTeams(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
th.LoginSystemManager()
|
||||
defer th.TearDown()
|
||||
@@ -1579,6 +1595,7 @@ func TestGetAllTeams(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetAllTeamsSanitization(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -1640,6 +1657,7 @@ func TestGetAllTeamsSanitization(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetTeamByName(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
team := th.BasicTeam
|
||||
@@ -1694,6 +1712,7 @@ func TestGetTeamByName(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetTeamByNameSanitization(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -1764,6 +1783,7 @@ func TestGetTeamByNameSanitization(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSearchAllTeams(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
th.LoginSystemManager()
|
||||
defer th.TearDown()
|
||||
@@ -1871,6 +1891,7 @@ func TestSearchAllTeams(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSearchAllTeamsPaged(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
commonRandom := model.NewId()
|
||||
@@ -2000,6 +2021,7 @@ func TestSearchAllTeamsPaged(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSearchAllTeamsSanitization(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -2070,6 +2092,7 @@ func TestSearchAllTeamsSanitization(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetTeamsForUser(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -2112,6 +2135,7 @@ func TestGetTeamsForUser(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetTeamsForUserSanitization(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -2211,6 +2235,7 @@ func TestGetTeamsForUserSanitization(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetTeamMember(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -2249,6 +2274,7 @@ func TestGetTeamMember(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetTeamMembers(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -2321,6 +2347,7 @@ func TestGetTeamMembers(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetTeamMembersForUser(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -2363,6 +2390,7 @@ func TestGetTeamMembersForUser(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetTeamMembersByIds(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -2400,6 +2428,7 @@ func TestGetTeamMembersByIds(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestAddTeamMember(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -2688,6 +2717,7 @@ func TestAddTeamMemberGuestPermissions(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestAddTeamMemberMyself(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -2778,6 +2808,7 @@ func TestAddTeamMemberMyself(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestAddTeamMembersDomainConstrained(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.SystemAdminClient
|
||||
@@ -2838,6 +2869,7 @@ func TestAddTeamMembersDomainConstrained(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestAddTeamMembers(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -3037,6 +3069,7 @@ func TestAddTeamMembersGuestPermissions(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestRemoveTeamMember(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -3104,6 +3137,7 @@ func TestRemoveTeamMember(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestRemoveTeamMemberEvents(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -3138,6 +3172,7 @@ func TestRemoveTeamMemberEvents(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetTeamStats(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -3189,6 +3224,7 @@ func TestGetTeamStats(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUpdateTeamMemberRoles(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -3268,6 +3304,7 @@ func TestUpdateTeamMemberRoles(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUpdateTeamMemberSchemeRoles(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
enableGuestAccounts := *th.App.Config().GuestAccountsSettings.Enable
|
||||
@@ -3410,6 +3447,7 @@ func TestUpdateTeamMemberSchemeRoles(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetMyTeamsUnread(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -3442,6 +3480,7 @@ func TestGetMyTeamsUnread(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestTeamExists(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -3538,6 +3577,7 @@ func TestTeamExists(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestImportTeam(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -3629,6 +3669,7 @@ func TestImportTeam(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestValidateUserPermissionsOnChannels(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -3657,6 +3698,7 @@ func TestValidateUserPermissionsOnChannels(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestInviteUsersToTeam(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -3826,6 +3868,7 @@ func TestInviteUsersToTeam(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestInviteGuestsToTeam(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -3971,6 +4014,7 @@ func TestInviteGuestsToTeam(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestInviteGuest(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
guest1 := th.GenerateTestEmail()
|
||||
@@ -4017,6 +4061,7 @@ func TestInviteGuest(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetTeamInviteInfo(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -4042,6 +4087,7 @@ func TestGetTeamInviteInfo(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSetTeamIcon(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -4100,6 +4146,7 @@ func TestSetTeamIcon(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetTeamIcon(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -4119,6 +4166,7 @@ func TestGetTeamIcon(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestRemoveTeamIcon(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -4158,6 +4206,7 @@ func TestRemoveTeamIcon(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUpdateTeamScheme(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -4238,6 +4287,7 @@ func TestUpdateTeamScheme(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestTeamMembersMinusGroupMembers(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -4331,6 +4381,7 @@ func TestTeamMembersMinusGroupMembers(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestInvalidateAllEmailInvites(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ import (
|
||||
)
|
||||
|
||||
func TestGetTermsOfService(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -31,6 +32,7 @@ func TestGetTermsOfService(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCreateTermsOfService(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -40,6 +42,7 @@ func TestCreateTermsOfService(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCreateTermsOfServiceAdminUser(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.SystemAdminClient
|
||||
|
||||
@@ -20,6 +20,7 @@ import (
|
||||
)
|
||||
|
||||
func TestCreateUpload(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -119,6 +120,7 @@ func TestCreateUpload(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetUpload(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -163,6 +165,7 @@ func TestGetUpload(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetUploadsForUser(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -210,6 +213,7 @@ func TestGetUploadsForUser(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUploadData(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
if *th.App.Config().FileSettings.DriverName == "" {
|
||||
@@ -335,6 +339,7 @@ func TestUploadData(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUploadDataMultipart(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
if *th.App.Config().FileSettings.DriverName == "" {
|
||||
|
||||
@@ -15,6 +15,7 @@ import (
|
||||
)
|
||||
|
||||
func TestGetPostsUsage(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
t.Run("unauthenticated users can not access", func(t *testing.T) {
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
@@ -54,6 +55,7 @@ func TestGetPostsUsage(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetStorageUsage(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
t.Run("unauthenticated users cannot access", func(t *testing.T) {
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
@@ -69,6 +71,7 @@ func TestGetStorageUsage(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetTeamsUsage(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
t.Run("unauthenticated users can not access", func(t *testing.T) {
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
@@ -13,6 +13,7 @@ import (
|
||||
)
|
||||
|
||||
func TestAPIRestrictedViewMembers(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ import (
|
||||
)
|
||||
|
||||
func TestCreateIncomingWebhook(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -108,6 +109,7 @@ func TestCreateIncomingWebhook(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCreateIncomingWebhook_BypassTeamPermissions(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -145,6 +147,7 @@ func TestCreateIncomingWebhook_BypassTeamPermissions(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetIncomingWebhooks(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -223,6 +226,7 @@ func TestGetIncomingWebhooks(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetIncomingWebhooksListByUser(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
BasicClient := th.Client
|
||||
@@ -258,7 +262,7 @@ func TestGetIncomingWebhooksListByUser(t *testing.T) {
|
||||
assert.Equal(t, 2, len(adminHooks))
|
||||
})
|
||||
|
||||
//Re-check basic user that has no MANAGE_OTHERS permission
|
||||
// Re-check basic user that has no MANAGE_OTHERS permission
|
||||
filteredHooks, _, err := BasicClient.GetIncomingWebhooks(context.Background(), 0, 1000, "")
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, 1, len(filteredHooks))
|
||||
@@ -266,6 +270,7 @@ func TestGetIncomingWebhooksListByUser(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetIncomingWebhooksByTeam(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
BasicClient := th.Client
|
||||
@@ -300,7 +305,7 @@ func TestGetIncomingWebhooksByTeam(t *testing.T) {
|
||||
assert.Equal(t, 2, len(adminHooks))
|
||||
})
|
||||
|
||||
//Re-check basic user that has no MANAGE_OTHERS permission
|
||||
// Re-check basic user that has no MANAGE_OTHERS permission
|
||||
filteredHooks, _, err := BasicClient.GetIncomingWebhooksForTeam(context.Background(), th.BasicTeam.Id, 0, 1000, "")
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, 1, len(filteredHooks))
|
||||
@@ -308,6 +313,7 @@ func TestGetIncomingWebhooksByTeam(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetIncomingWebhooksWithCount(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
BasicClient := th.Client
|
||||
@@ -362,6 +368,7 @@ func TestGetIncomingWebhooksWithCount(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetIncomingWebhook(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -398,13 +405,14 @@ func TestGetIncomingWebhook(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDeleteIncomingWebhook(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableIncomingWebhooks = true })
|
||||
|
||||
//var rhook *model.IncomingWebhook
|
||||
//var hook *model.IncomingWebhook
|
||||
// var rhook *model.IncomingWebhook
|
||||
// var hook *model.IncomingWebhook
|
||||
|
||||
th.TestForSystemAdminAndLocal(t, func(t *testing.T, client *model.Client4) {
|
||||
resp, err := client.DeleteIncomingWebhook(context.Background(), "abc")
|
||||
@@ -449,6 +457,7 @@ func TestDeleteIncomingWebhook(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCreateOutgoingWebhook(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -533,6 +542,7 @@ func TestCreateOutgoingWebhook(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetOutgoingWebhooks(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -632,6 +642,7 @@ func TestGetOutgoingWebhooks(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetOutgoingWebhooksByTeam(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -665,7 +676,7 @@ func TestGetOutgoingWebhooksByTeam(t *testing.T) {
|
||||
assert.Equal(t, 2, len(adminHooks))
|
||||
})
|
||||
|
||||
//Re-check basic user that has no MANAGE_OTHERS permission
|
||||
// Re-check basic user that has no MANAGE_OTHERS permission
|
||||
filteredHooks, _, err := th.Client.GetOutgoingWebhooksForTeam(context.Background(), th.BasicTeam.Id, 0, 1000, "")
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, 1, len(filteredHooks))
|
||||
@@ -673,6 +684,7 @@ func TestGetOutgoingWebhooksByTeam(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetOutgoingWebhooksByChannel(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -706,7 +718,7 @@ func TestGetOutgoingWebhooksByChannel(t *testing.T) {
|
||||
assert.Equal(t, 2, len(adminHooks))
|
||||
})
|
||||
|
||||
//Re-check basic user that has no MANAGE_OTHERS permission
|
||||
// Re-check basic user that has no MANAGE_OTHERS permission
|
||||
filteredHooks, _, err := th.Client.GetOutgoingWebhooksForChannel(context.Background(), th.BasicChannel.Id, 0, 1000, "")
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, 1, len(filteredHooks))
|
||||
@@ -714,6 +726,7 @@ func TestGetOutgoingWebhooksByChannel(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetOutgoingWebhooksListByUser(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
th.LoginBasic()
|
||||
@@ -748,7 +761,7 @@ func TestGetOutgoingWebhooksListByUser(t *testing.T) {
|
||||
assert.Equal(t, 2, len(adminHooks))
|
||||
})
|
||||
|
||||
//Re-check basic user that has no MANAGE_OTHERS permission
|
||||
// Re-check basic user that has no MANAGE_OTHERS permission
|
||||
filteredHooks, _, err := th.Client.GetOutgoingWebhooks(context.Background(), 0, 1000, "")
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, 1, len(filteredHooks))
|
||||
@@ -756,6 +769,7 @@ func TestGetOutgoingWebhooksListByUser(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetOutgoingWebhook(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -791,6 +805,7 @@ func TestGetOutgoingWebhook(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUpdateIncomingHook(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -834,7 +849,7 @@ func TestUpdateIncomingHook(t *testing.T) {
|
||||
require.Empty(t, updatedHook.Username, "Hook username was incorrectly updated")
|
||||
require.Empty(t, updatedHook.IconURL, "Hook icon was incorrectly updated")
|
||||
|
||||
//updatedHook, _ = th.App.GetIncomingWebhook(createdHook.Id)
|
||||
// updatedHook, _ = th.App.GetIncomingWebhook(createdHook.Id)
|
||||
assert.Equal(t, updatedHook.ChannelId, createdHook.ChannelId)
|
||||
}, "UpdateIncomingHook, overrides disabled")
|
||||
|
||||
@@ -862,7 +877,7 @@ func TestUpdateIncomingHook(t *testing.T) {
|
||||
require.Exactly(t, "username", updatedHook.Username, "Hook username is not updated")
|
||||
require.Exactly(t, "icon", updatedHook.IconURL, "Hook icon is not updated")
|
||||
|
||||
//updatedHook, _ = th.App.GetIncomingWebhook(createdHook.Id)
|
||||
// updatedHook, _ = th.App.GetIncomingWebhook(createdHook.Id)
|
||||
assert.Equal(t, updatedHook.ChannelId, createdHook.ChannelId)
|
||||
}, "UpdateIncomingHook")
|
||||
|
||||
@@ -993,6 +1008,7 @@ func TestUpdateIncomingHook(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUpdateIncomingWebhook_BypassTeamPermissions(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -1030,6 +1046,7 @@ func TestUpdateIncomingWebhook_BypassTeamPermissions(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestRegenOutgoingHookToken(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
@@ -1044,7 +1061,7 @@ func TestRegenOutgoingHookToken(t *testing.T) {
|
||||
require.Error(t, err)
|
||||
CheckBadRequestStatus(t, resp)
|
||||
|
||||
//investigate why is act weird on jenkins
|
||||
// investigate why is act weird on jenkins
|
||||
// _, resp,_ = th.SystemAdminClient.RegenOutgoingHookToken(context.Background(), "")
|
||||
// CheckNotFoundStatus(t, resp)
|
||||
|
||||
@@ -1063,6 +1080,7 @@ func TestRegenOutgoingHookToken(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUpdateOutgoingHook(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -1074,8 +1092,10 @@ func TestUpdateOutgoingHook(t *testing.T) {
|
||||
th.AddPermissionToRole(model.PermissionManageOutgoingWebhooks.Id, model.TeamAdminRoleId)
|
||||
th.RemovePermissionFromRole(model.PermissionManageOutgoingWebhooks.Id, model.TeamUserRoleId)
|
||||
|
||||
createdHook := &model.OutgoingWebhook{ChannelId: th.BasicChannel.Id, TeamId: th.BasicChannel.TeamId,
|
||||
CallbackURLs: []string{"http://nowhere.com"}, TriggerWords: []string{"cats"}}
|
||||
createdHook := &model.OutgoingWebhook{
|
||||
ChannelId: th.BasicChannel.Id, TeamId: th.BasicChannel.TeamId,
|
||||
CallbackURLs: []string{"http://nowhere.com"}, TriggerWords: []string{"cats"},
|
||||
}
|
||||
|
||||
th.TestForSystemAdminAndLocal(t, func(t *testing.T, client *model.Client4) {
|
||||
rcreatedHook, _, err := th.SystemAdminClient.CreateOutgoingWebhook(context.Background(), createdHook)
|
||||
@@ -1112,8 +1132,10 @@ func TestUpdateOutgoingHook(t *testing.T) {
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableOutgoingWebhooks = true })
|
||||
th.TestForSystemAdminAndLocal(t, func(t *testing.T, client *model.Client4) {
|
||||
hook2 := &model.OutgoingWebhook{ChannelId: th.BasicChannel.Id, TeamId: th.BasicChannel.TeamId,
|
||||
CallbackURLs: []string{"http://nowhere.com"}, TriggerWords: []string{"rats"}}
|
||||
hook2 := &model.OutgoingWebhook{
|
||||
ChannelId: th.BasicChannel.Id, TeamId: th.BasicChannel.TeamId,
|
||||
CallbackURLs: []string{"http://nowhere.com"}, TriggerWords: []string{"rats"},
|
||||
}
|
||||
|
||||
createdHook2, _, err := th.SystemAdminClient.CreateOutgoingWebhook(context.Background(), hook2)
|
||||
require.NoError(t, err)
|
||||
@@ -1145,8 +1167,10 @@ func TestUpdateOutgoingHook(t *testing.T) {
|
||||
}, "ModifyUpdateAt")
|
||||
|
||||
th.TestForSystemAdminAndLocal(t, func(t *testing.T, client *model.Client4) {
|
||||
nonExistentHook := &model.OutgoingWebhook{ChannelId: th.BasicChannel.Id, TeamId: th.BasicChannel.TeamId,
|
||||
CallbackURLs: []string{"http://nowhere.com"}, TriggerWords: []string{"rats"}}
|
||||
nonExistentHook := &model.OutgoingWebhook{
|
||||
ChannelId: th.BasicChannel.Id, TeamId: th.BasicChannel.TeamId,
|
||||
CallbackURLs: []string{"http://nowhere.com"}, TriggerWords: []string{"rats"},
|
||||
}
|
||||
|
||||
_, resp, err := client.UpdateOutgoingWebhook(context.Background(), nonExistentHook)
|
||||
require.Error(t, err)
|
||||
@@ -1168,8 +1192,10 @@ func TestUpdateOutgoingHook(t *testing.T) {
|
||||
})
|
||||
|
||||
th.AddPermissionToRole(model.PermissionManageOutgoingWebhooks.Id, model.TeamUserRoleId)
|
||||
hook2 := &model.OutgoingWebhook{ChannelId: th.BasicChannel.Id, TeamId: th.BasicChannel.TeamId,
|
||||
CallbackURLs: []string{"http://nowhere.com"}, TriggerWords: []string{"rats2"}}
|
||||
hook2 := &model.OutgoingWebhook{
|
||||
ChannelId: th.BasicChannel.Id, TeamId: th.BasicChannel.TeamId,
|
||||
CallbackURLs: []string{"http://nowhere.com"}, TriggerWords: []string{"rats2"},
|
||||
}
|
||||
|
||||
createdHook2, _, err := th.SystemAdminClient.CreateOutgoingWebhook(context.Background(), hook2)
|
||||
require.NoError(t, err)
|
||||
@@ -1195,13 +1221,17 @@ func TestUpdateOutgoingHook(t *testing.T) {
|
||||
})
|
||||
|
||||
th.TestForSystemAdminAndLocal(t, func(t *testing.T, client *model.Client4) {
|
||||
firstHook := &model.OutgoingWebhook{ChannelId: th.BasicChannel.Id, TeamId: th.BasicChannel.TeamId,
|
||||
CallbackURLs: []string{"http://someurl"}, TriggerWords: []string{"first"}}
|
||||
firstHook := &model.OutgoingWebhook{
|
||||
ChannelId: th.BasicChannel.Id, TeamId: th.BasicChannel.TeamId,
|
||||
CallbackURLs: []string{"http://someurl"}, TriggerWords: []string{"first"},
|
||||
}
|
||||
firstHook, _, err = th.SystemAdminClient.CreateOutgoingWebhook(context.Background(), firstHook)
|
||||
require.NoError(t, err)
|
||||
|
||||
baseHook := &model.OutgoingWebhook{ChannelId: th.BasicChannel.Id, TeamId: th.BasicChannel.TeamId,
|
||||
CallbackURLs: []string{"http://someurl"}, TriggerWords: []string{"base"}}
|
||||
baseHook := &model.OutgoingWebhook{
|
||||
ChannelId: th.BasicChannel.Id, TeamId: th.BasicChannel.TeamId,
|
||||
CallbackURLs: []string{"http://someurl"}, TriggerWords: []string{"base"},
|
||||
}
|
||||
baseHook, _, err = th.SystemAdminClient.CreateOutgoingWebhook(context.Background(), baseHook)
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -1273,6 +1303,7 @@ func TestUpdateOutgoingHook(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUpdateOutgoingWebhook_BypassTeamPermissions(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -1284,8 +1315,10 @@ func TestUpdateOutgoingWebhook_BypassTeamPermissions(t *testing.T) {
|
||||
th.AddPermissionToRole(model.PermissionManageOutgoingWebhooks.Id, model.TeamAdminRoleId)
|
||||
th.AddPermissionToRole(model.PermissionManageOutgoingWebhooks.Id, model.TeamUserRoleId)
|
||||
|
||||
hook := &model.OutgoingWebhook{ChannelId: th.BasicChannel.Id, TeamId: th.BasicChannel.TeamId,
|
||||
CallbackURLs: []string{"http://nowhere.com"}, TriggerWords: []string{"rats2"}}
|
||||
hook := &model.OutgoingWebhook{
|
||||
ChannelId: th.BasicChannel.Id, TeamId: th.BasicChannel.TeamId,
|
||||
CallbackURLs: []string{"http://nowhere.com"}, TriggerWords: []string{"rats2"},
|
||||
}
|
||||
|
||||
rhook, _, err := th.Client.CreateOutgoingWebhook(context.Background(), hook)
|
||||
require.NoError(t, err)
|
||||
@@ -1308,6 +1341,7 @@ func TestUpdateOutgoingWebhook_BypassTeamPermissions(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDeleteOutgoingHook(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -1326,8 +1360,10 @@ func TestDeleteOutgoingHook(t *testing.T) {
|
||||
}, "WhenHookDoesNotExist")
|
||||
|
||||
th.TestForSystemAdminAndLocal(t, func(t *testing.T, client *model.Client4) {
|
||||
hook := &model.OutgoingWebhook{ChannelId: th.BasicChannel.Id, TeamId: th.BasicChannel.TeamId,
|
||||
CallbackURLs: []string{"http://nowhere.com"}, TriggerWords: []string{"cats"}}
|
||||
hook := &model.OutgoingWebhook{
|
||||
ChannelId: th.BasicChannel.Id, TeamId: th.BasicChannel.TeamId,
|
||||
CallbackURLs: []string{"http://nowhere.com"}, TriggerWords: []string{"cats"},
|
||||
}
|
||||
rhook, _, err := th.SystemAdminClient.CreateOutgoingWebhook(context.Background(), hook)
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -1342,8 +1378,10 @@ func TestDeleteOutgoingHook(t *testing.T) {
|
||||
}, "WhenHookExists")
|
||||
|
||||
t.Run("WhenUserDoesNotHavePermissions", func(t *testing.T) {
|
||||
hook := &model.OutgoingWebhook{ChannelId: th.BasicChannel.Id, TeamId: th.BasicChannel.TeamId,
|
||||
CallbackURLs: []string{"http://nowhere.com"}, TriggerWords: []string{"dogs"}}
|
||||
hook := &model.OutgoingWebhook{
|
||||
ChannelId: th.BasicChannel.Id, TeamId: th.BasicChannel.TeamId,
|
||||
CallbackURLs: []string{"http://nowhere.com"}, TriggerWords: []string{"dogs"},
|
||||
}
|
||||
rhook, _, err := th.SystemAdminClient.CreateOutgoingWebhook(context.Background(), hook)
|
||||
require.NoError(t, err)
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ import (
|
||||
// because the websocket client is known to be racy and needs a big overhaul
|
||||
// to fix everything.
|
||||
func TestWebSocket(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
WebSocketClient, err := th.CreateWebSocketClient()
|
||||
|
||||
@@ -21,6 +21,7 @@ import (
|
||||
)
|
||||
|
||||
func TestWebSocketTrailingSlash(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -30,6 +31,7 @@ func TestWebSocketTrailingSlash(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestWebSocketEvent(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -95,6 +97,7 @@ func TestWebSocketEvent(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCreateDirectChannelWithSocket(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -150,6 +153,7 @@ func TestCreateDirectChannelWithSocket(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestWebsocketOriginSecurity(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -200,6 +204,7 @@ func TestWebsocketOriginSecurity(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestWebSocketReconnectRace(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -234,6 +239,7 @@ func TestWebSocketReconnectRace(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestWebSocketSendBinary(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -273,6 +279,7 @@ func TestWebSocketSendBinary(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestWebSocketStatuses(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -412,6 +419,7 @@ func TestWebSocketStatuses(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestWebSocketPresence(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -442,6 +450,7 @@ func TestWebSocketPresence(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestWebSocketUpgrade(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ import (
|
||||
)
|
||||
|
||||
func TestGetLatestVersion(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@ func init() {
|
||||
}
|
||||
|
||||
func TestUnitUpdateConfig(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := SetupWithStoreMock(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -290,6 +291,7 @@ func TestDoEmojisPermissionsMigration(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDBHealthCheckWriteAndDelete(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ import (
|
||||
)
|
||||
|
||||
func TestParseAuthTokenFromRequest(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
cases := []struct {
|
||||
header string
|
||||
cookie string
|
||||
@@ -63,6 +64,7 @@ func TestParseAuthTokenFromRequest(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCheckPasswordAndAllCriteria(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
|
||||
@@ -118,6 +118,7 @@ func TestSessionHasPermissionToAndNotRestrictedAdmin(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCheckIfRolesGrantPermission(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -144,12 +145,14 @@ func TestCheckIfRolesGrantPermission(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestChannelRolesGrantPermission(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
testPermissionInheritance(t, func(t *testing.T, th *TestHelper, testData permissionInheritanceTestData) {
|
||||
require.Equal(t, testData.shouldHavePermission, th.App.RolesGrantPermission([]string{testData.channelRole.Name}, testData.permission.Id), "row: %+v\n", testData.truthTableRow)
|
||||
})
|
||||
}
|
||||
|
||||
func TestHasPermissionToTeam(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -167,6 +170,7 @@ func TestHasPermissionToTeam(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSessionHasPermissionToTeams(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -225,6 +229,7 @@ func TestSessionHasPermissionToTeams(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSessionHasPermissionToChannel(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -296,6 +301,7 @@ func TestSessionHasPermissionToChannel(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSessionHasPermissionToChannels(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -444,6 +450,7 @@ func TestSessionHasPermissionToChannels(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestHasPermissionToUser(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -453,6 +460,7 @@ func TestHasPermissionToUser(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSessionHasPermissionToManageBot(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -564,6 +572,7 @@ func TestSessionHasPermissionToManageBot(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSessionHasPermissionToUser(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -614,6 +623,7 @@ func TestSessionHasPermissionToUser(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSessionHasPermissionToManageUserOrBot(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -669,6 +679,7 @@ func TestSessionHasPermissionToManageUserOrBot(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestHasPermissionToCategory(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
session, err := th.App.CreateSession(th.Context, &model.Session{UserId: th.BasicUser.Id, Props: model.StringMap{}})
|
||||
@@ -687,6 +698,7 @@ func TestHasPermissionToCategory(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSessionHasPermissionToGroup(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -771,6 +783,7 @@ func TestSessionHasPermissionToGroup(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestHasPermissionToReadChannel(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -885,6 +898,7 @@ func TestHasPermissionToReadChannel(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSessionHasPermissionToChannelByPost(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -948,6 +962,7 @@ func TestSessionHasPermissionToChannelByPost(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestHasPermissionToChannelByPost(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ import (
|
||||
)
|
||||
|
||||
func TestSetAutoResponderStatus(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -55,6 +56,7 @@ func TestSetAutoResponderStatus(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDisableAutoResponder(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -90,6 +92,7 @@ func TestDisableAutoResponder(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSendAutoResponseIfNecessary(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
t.Run("should send auto response when enabled", func(t *testing.T) {
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
@@ -110,7 +113,8 @@ func TestSendAutoResponseIfNecessary(t *testing.T) {
|
||||
savedPost, _ := th.App.CreatePost(th.Context, &model.Post{
|
||||
ChannelId: channel.Id,
|
||||
Message: NewTestId(),
|
||||
UserId: th.BasicUser.Id},
|
||||
UserId: th.BasicUser.Id,
|
||||
},
|
||||
th.BasicChannel,
|
||||
model.CreatePostFlags{SetOnline: true})
|
||||
|
||||
@@ -140,7 +144,8 @@ func TestSendAutoResponseIfNecessary(t *testing.T) {
|
||||
savedPost, _ := th.App.CreatePost(th.Context, &model.Post{
|
||||
ChannelId: channel.Id,
|
||||
Message: NewTestId(),
|
||||
UserId: th.BasicUser.Id},
|
||||
UserId: th.BasicUser.Id,
|
||||
},
|
||||
th.BasicChannel,
|
||||
model.CreatePostFlags{SetOnline: true})
|
||||
|
||||
@@ -157,7 +162,8 @@ func TestSendAutoResponseIfNecessary(t *testing.T) {
|
||||
savedPost, _ := th.App.CreatePost(th.Context, &model.Post{
|
||||
ChannelId: th.BasicChannel.Id,
|
||||
Message: NewTestId(),
|
||||
UserId: th.BasicUser.Id},
|
||||
UserId: th.BasicUser.Id,
|
||||
},
|
||||
th.BasicChannel,
|
||||
model.CreatePostFlags{SetOnline: true})
|
||||
|
||||
@@ -197,7 +203,8 @@ func TestSendAutoResponseIfNecessary(t *testing.T) {
|
||||
savedPost, _ := th.App.CreatePost(th.Context, &model.Post{
|
||||
ChannelId: channel.Id,
|
||||
Message: NewTestId(),
|
||||
UserId: botUser.Id},
|
||||
UserId: botUser.Id,
|
||||
},
|
||||
th.BasicChannel,
|
||||
model.CreatePostFlags{SetOnline: true})
|
||||
|
||||
@@ -249,6 +256,7 @@ func TestSendAutoResponseIfNecessary(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSendAutoResponseSuccess(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -269,7 +277,8 @@ func TestSendAutoResponseSuccess(t *testing.T) {
|
||||
savedPost, _ := th.App.CreatePost(th.Context, &model.Post{
|
||||
ChannelId: th.BasicChannel.Id,
|
||||
Message: "zz" + model.NewId() + "a",
|
||||
UserId: th.BasicUser.Id},
|
||||
UserId: th.BasicUser.Id,
|
||||
},
|
||||
th.BasicChannel,
|
||||
model.CreatePostFlags{SetOnline: true})
|
||||
|
||||
@@ -292,6 +301,7 @@ func TestSendAutoResponseSuccess(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSendAutoResponseSuccessOnThread(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -312,7 +322,8 @@ func TestSendAutoResponseSuccessOnThread(t *testing.T) {
|
||||
parentPost, _ := th.App.CreatePost(th.Context, &model.Post{
|
||||
ChannelId: th.BasicChannel.Id,
|
||||
Message: "zz" + model.NewId() + "a",
|
||||
UserId: th.BasicUser.Id},
|
||||
UserId: th.BasicUser.Id,
|
||||
},
|
||||
th.BasicChannel,
|
||||
model.CreatePostFlags{SetOnline: true})
|
||||
|
||||
@@ -344,6 +355,7 @@ func TestSendAutoResponseSuccessOnThread(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSendAutoResponseFailure(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -364,7 +376,8 @@ func TestSendAutoResponseFailure(t *testing.T) {
|
||||
savedPost, _ := th.App.CreatePost(th.Context, &model.Post{
|
||||
ChannelId: th.BasicChannel.Id,
|
||||
Message: "zz" + model.NewId() + "a",
|
||||
UserId: th.BasicUser.Id},
|
||||
UserId: th.BasicUser.Id,
|
||||
},
|
||||
th.BasicChannel,
|
||||
model.CreatePostFlags{SetOnline: true})
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ import (
|
||||
)
|
||||
|
||||
func TestCreateBot(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
t.Run("invalid bot", func(t *testing.T) {
|
||||
t.Run("relative to user", func(t *testing.T) {
|
||||
th := Setup(t).InitBasic()
|
||||
@@ -116,6 +117,7 @@ func TestCreateBot(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestEnsureBot(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
t.Run("ensure bot should pass if already exist bot user", func(t *testing.T) {
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
@@ -190,6 +192,7 @@ func TestEnsureBot(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPatchBot(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
t.Run("invalid patch for user", func(t *testing.T) {
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
@@ -306,6 +309,7 @@ func TestPatchBot(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetBot(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -376,6 +380,7 @@ func TestGetBot(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetBots(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).DeleteBots()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -586,6 +591,7 @@ func TestGetBots(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUpdateBotActive(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
t.Run("unknown bot", func(t *testing.T) {
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
@@ -631,6 +637,7 @@ func TestUpdateBotActive(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPermanentDeleteBot(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -649,6 +656,7 @@ func TestPermanentDeleteBot(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDisableUserBots(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -710,6 +718,7 @@ func TestDisableUserBots(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestNotifySysadminsBotOwnerDisabled(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -727,7 +736,8 @@ func TestNotifySysadminsBotOwnerDisabled(t *testing.T) {
|
||||
Nickname: "nn_sysadmin1",
|
||||
Password: "hello1",
|
||||
Username: "un_sysadmin1",
|
||||
Roles: model.SystemAdminRoleId + " " + model.SystemUserRoleId}
|
||||
Roles: model.SystemAdminRoleId + " " + model.SystemUserRoleId,
|
||||
}
|
||||
_, err := th.App.CreateUser(th.Context, &sysadmin1)
|
||||
require.Nil(t, err, "failed to create user")
|
||||
_, err = th.App.UpdateUserRoles(th.Context, sysadmin1.Id, model.SystemUserRoleId+" "+model.SystemAdminRoleId, false)
|
||||
@@ -738,7 +748,8 @@ func TestNotifySysadminsBotOwnerDisabled(t *testing.T) {
|
||||
Nickname: "nn_sysadmin2",
|
||||
Password: "hello1",
|
||||
Username: "un_sysadmin2",
|
||||
Roles: model.SystemAdminRoleId + " " + model.SystemUserRoleId}
|
||||
Roles: model.SystemAdminRoleId + " " + model.SystemUserRoleId,
|
||||
}
|
||||
_, err = th.App.CreateUser(th.Context, &sysadmin2)
|
||||
require.Nil(t, err, "failed to create user")
|
||||
_, err = th.App.UpdateUserRoles(th.Context, sysadmin2.Id, model.SystemUserRoleId+" "+model.SystemAdminRoleId, false)
|
||||
@@ -846,6 +857,7 @@ func TestNotifySysadminsBotOwnerDisabled(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestConvertUserToBot(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
t.Run("invalid user", func(t *testing.T) {
|
||||
t.Run("invalid user id", func(t *testing.T) {
|
||||
th := Setup(t).InitBasic()
|
||||
@@ -952,6 +964,7 @@ func TestConvertUserToBot(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetSystemBot(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
t.Run("An error should be returned if there are no sysadmins in the instance", func(t *testing.T) {
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -16,6 +16,8 @@ import (
|
||||
)
|
||||
|
||||
func TestBusySet(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
|
||||
cluster := &ClusterMock{Busy: &Busy{}, t: t}
|
||||
busy := NewBusy(cluster)
|
||||
|
||||
@@ -54,6 +56,7 @@ func TestBusySet(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestBusyExpires(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
cluster := &ClusterMock{Busy: &Busy{}, t: t}
|
||||
busy := NewBusy(cluster)
|
||||
|
||||
@@ -90,6 +93,7 @@ func TestBusyExpires(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestBusyRace(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
cluster := &ClusterMock{Busy: &Busy{}, t: t}
|
||||
busy := NewBusy(cluster)
|
||||
|
||||
@@ -148,12 +152,15 @@ func (c *ClusterMock) NotifyMsg(buf []byte) {}
|
||||
func (c *ClusterMock) GetClusterStats(rctx request.CTX) ([]*model.ClusterStats, *model.AppError) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (c *ClusterMock) GetLogs(rctx request.CTX, page, perPage int) ([]string, *model.AppError) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (c *ClusterMock) QueryLogs(rctx request.CTX, page, perPage int) (map[string][]string, *model.AppError) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (c *ClusterMock) GenerateSupportPacket(rctx request.CTX, options *model.SupportPacketOptions) (map[string][]model.FileData, error) {
|
||||
return nil, nil
|
||||
}
|
||||
@@ -165,6 +172,7 @@ func (c *ClusterMock) HealthScore() int { return 0 }
|
||||
func (c *ClusterMock) WebConnCountForUser(userID string) (int, *model.AppError) {
|
||||
return 0, nil
|
||||
}
|
||||
|
||||
func (c *ClusterMock) GetWSQueues(userID, connectionID string, seqNum int64) (map[string]*model.WSQueues, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@ func createBookmark(name string, bookmarkType model.ChannelBookmarkType, channel
|
||||
}
|
||||
|
||||
func TestCreateBookmark(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -81,12 +82,13 @@ func TestCreateBookmark(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUpdateBookmark(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
var updateBookmark *model.ChannelBookmarkWithFileInfo
|
||||
|
||||
var testUpdateAnotherFile = func(th *TestHelper, t *testing.T) {
|
||||
testUpdateAnotherFile := func(th *TestHelper, t *testing.T) {
|
||||
file := &model.FileInfo{
|
||||
Id: model.NewId(),
|
||||
ChannelId: th.BasicChannel.Id,
|
||||
@@ -328,6 +330,7 @@ func TestUpdateBookmark(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDeleteBookmark(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -353,6 +356,7 @@ func TestDeleteBookmark(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetChannelBookmarks(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -437,6 +441,7 @@ func TestGetChannelBookmarks(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUpdateChannelBookmarkSortOrder(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ import (
|
||||
)
|
||||
|
||||
func TestSidebarCategory(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -86,6 +87,7 @@ func TestSidebarCategory(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetSidebarCategories(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
t.Run("should return the sidebar categories for the given user/team", func(t *testing.T) {
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
@@ -128,11 +130,10 @@ func TestGetSidebarCategories(t *testing.T) {
|
||||
defer th.TearDown()
|
||||
|
||||
// Temporarily renaming a table to force a DB error.
|
||||
sqlStore := mainHelper.GetSQLStore()
|
||||
_, err := sqlStore.GetMaster().Exec("ALTER TABLE SidebarCategories RENAME TO SidebarCategoriesTest")
|
||||
_, err := th.SQLStore.GetMaster().Exec("ALTER TABLE SidebarCategories RENAME TO SidebarCategoriesTest")
|
||||
require.NoError(t, err)
|
||||
defer func() {
|
||||
_, err := sqlStore.GetMaster().Exec("ALTER TABLE SidebarCategoriesTest RENAME TO SidebarCategories")
|
||||
_, err := th.SQLStore.GetMaster().Exec("ALTER TABLE SidebarCategoriesTest RENAME TO SidebarCategories")
|
||||
require.NoError(t, err)
|
||||
}()
|
||||
|
||||
@@ -144,6 +145,7 @@ func TestGetSidebarCategories(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUpdateSidebarCategories(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
t.Run("should mute and unmute all channels in a category when it is muted or unmuted", func(t *testing.T) {
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
@@ -487,6 +489,7 @@ func TestUpdateSidebarCategories(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDiffChannelsBetweenCategories(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
t.Run("should return nothing when the categories contain identical channels", func(t *testing.T) {
|
||||
originalCategories := []*model.SidebarCategoryWithChannels{
|
||||
{
|
||||
|
||||
@@ -29,6 +29,7 @@ import (
|
||||
)
|
||||
|
||||
func TestPermanentDeleteChannel(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -86,6 +87,7 @@ func TestPermanentDeleteChannel(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestRemoveAllDeactivatedMembersFromChannel(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
var appErr *model.AppError
|
||||
@@ -122,6 +124,7 @@ func TestRemoveAllDeactivatedMembersFromChannel(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestMoveChannel(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
t.Run("should move channels between teams", func(t *testing.T) {
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
@@ -304,6 +307,7 @@ func TestMoveChannel(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestRemoveUsersFromChannelNotMemberOfTeam(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -345,6 +349,7 @@ func TestRemoveUsersFromChannelNotMemberOfTeam(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestJoinDefaultChannelsCreatesChannelMemberHistoryRecordTownSquare(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -377,6 +382,7 @@ func TestJoinDefaultChannelsCreatesChannelMemberHistoryRecordTownSquare(t *testi
|
||||
}
|
||||
|
||||
func TestJoinDefaultChannelsCreatesChannelMemberHistoryRecordOffTopic(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -409,6 +415,7 @@ func TestJoinDefaultChannelsCreatesChannelMemberHistoryRecordOffTopic(t *testing
|
||||
}
|
||||
|
||||
func TestJoinDefaultChannelsExperimentalDefaultChannels(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -435,6 +442,7 @@ func TestJoinDefaultChannelsExperimentalDefaultChannels(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestJoinDefaultChannelsExperimentalDefaultChannelsMissing(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -465,6 +473,7 @@ func TestJoinDefaultChannelsExperimentalDefaultChannelsMissing(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCreateChannelPublicCreatesChannelMemberHistoryRecord(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -480,6 +489,7 @@ func TestCreateChannelPublicCreatesChannelMemberHistoryRecord(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCreateChannelPrivateCreatesChannelMemberHistoryRecord(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -493,7 +503,9 @@ func TestCreateChannelPrivateCreatesChannelMemberHistoryRecord(t *testing.T) {
|
||||
assert.Equal(t, th.BasicUser.Id, histories[0].UserId)
|
||||
assert.Equal(t, privateChannel.Id, histories[0].ChannelId)
|
||||
}
|
||||
|
||||
func TestCreateChannelDisplayNameTrimsWhitespace(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -507,6 +519,7 @@ func TestCreateChannelDisplayNameTrimsWhitespace(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUpdateChannelPrivacy(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -520,6 +533,7 @@ func TestUpdateChannelPrivacy(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetOrCreateDirectChannel(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -574,6 +588,7 @@ func TestGetOrCreateDirectChannel(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCreateGroupChannel(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -597,6 +612,7 @@ func TestCreateGroupChannel(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCreateGroupChannelCreatesChannelMemberHistoryRecord(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -627,6 +643,7 @@ func TestCreateGroupChannelCreatesChannelMemberHistoryRecord(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCreateDirectChannelCreatesChannelMemberHistoryRecord(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -653,6 +670,7 @@ func TestCreateDirectChannelCreatesChannelMemberHistoryRecord(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetDirectChannelCreatesChannelMemberHistoryRecord(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -681,6 +699,7 @@ func TestGetDirectChannelCreatesChannelMemberHistoryRecord(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestAddUserToChannelCreatesChannelMemberHistoryRecord(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic().DeleteBots()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -711,6 +730,7 @@ func TestAddUserToChannelCreatesChannelMemberHistoryRecord(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUsersAndPostsCreateActivityInChannel(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic().DeleteBots()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -793,6 +813,7 @@ func TestUsersAndPostsCreateActivityInChannel(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestLeaveDefaultChannel(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -852,6 +873,7 @@ func TestLeaveDefaultChannel(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestLeaveChannel(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -911,6 +933,7 @@ func TestLeaveChannel(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestLeaveLastChannel(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -940,6 +963,7 @@ func TestLeaveLastChannel(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestAddChannelMemberNoUserRequestor(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -981,6 +1005,7 @@ func TestAddChannelMemberNoUserRequestor(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestAddChannelMemberDeletedUser(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -997,6 +1022,7 @@ func TestAddChannelMemberDeletedUser(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestAppUpdateChannelScheme(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -1013,6 +1039,7 @@ func TestAppUpdateChannelScheme(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSetChannelsMuted(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
t.Run("should mute and unmute the given channels", func(t *testing.T) {
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
@@ -1064,6 +1091,7 @@ func TestSetChannelsMuted(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestFillInChannelProps(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -1284,6 +1312,7 @@ func TestFillInChannelProps(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestRenameChannel(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -1351,6 +1380,7 @@ func TestRenameChannel(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetChannelMembersTimezones(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -1394,6 +1424,7 @@ func TestGetChannelMembersTimezones(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetChannelsForUser(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
channel := &model.Channel{
|
||||
DisplayName: "Public",
|
||||
@@ -1438,6 +1469,7 @@ func TestGetChannelsForUser(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetPublicChannelsForTeam(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
team := th.CreateTeam()
|
||||
defer th.TearDown()
|
||||
@@ -1485,6 +1517,7 @@ func TestGetPublicChannelsForTeam(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetPrivateChannelsForTeam(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
team := th.CreateTeam()
|
||||
defer th.TearDown()
|
||||
@@ -1521,6 +1554,7 @@ func TestGetPrivateChannelsForTeam(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUpdateChannelMemberRolesChangingGuest(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -1599,6 +1633,7 @@ func TestUpdateChannelMemberRolesChangingGuest(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDefaultChannelNames(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -1616,6 +1651,7 @@ func TestDefaultChannelNames(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSearchChannelsForUser(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -1673,6 +1709,7 @@ func TestSearchChannelsForUser(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestMarkChannelAsUnreadFromPost(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -1829,6 +1866,7 @@ func TestMarkChannelAsUnreadFromPost(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestAddUserToChannel(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -1923,6 +1961,7 @@ func TestAddUserToChannel(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestRemoveUserFromChannel(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -1982,6 +2021,7 @@ func TestRemoveUserFromChannel(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPatchChannelModerationsForChannel(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -2461,6 +2501,7 @@ func TestPatchChannelModerationsForChannel(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestClearChannelMembersCache(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := SetupWithStoreMock(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -2476,7 +2517,8 @@ func TestClearChannelMembersCache(t *testing.T) {
|
||||
mockChannelStore.On("GetMembers", "channelID", 100, 100).Return(model.ChannelMembers{
|
||||
model.ChannelMember{
|
||||
ChannelId: "1",
|
||||
}}, nil)
|
||||
},
|
||||
}, nil)
|
||||
mockStore.On("Channel").Return(&mockChannelStore)
|
||||
mockStore.On("GetDBSchemaVersion").Return(1, nil)
|
||||
|
||||
@@ -2484,6 +2526,7 @@ func TestClearChannelMembersCache(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetMemberCountsByGroup(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := SetupWithStoreMock(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -2506,6 +2549,7 @@ func TestGetMemberCountsByGroup(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetChannelsMemberCount(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := SetupWithStoreMock(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -2524,6 +2568,7 @@ func TestGetChannelsMemberCount(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestViewChannelCollapsedThreadsTurnedOff(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -2602,6 +2647,7 @@ func TestViewChannelCollapsedThreadsTurnedOff(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestMarkChannelAsUnreadFromPostCollapsedThreadsTurnedOff(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
// Enable CRT
|
||||
|
||||
th := Setup(t).InitBasic()
|
||||
@@ -2689,6 +2735,7 @@ func TestMarkChannelAsUnreadFromPostCollapsedThreadsTurnedOff(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestMarkUnreadCRTOffUpdatesThreads(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
th.App.UpdateConfig(func(cfg *model.Config) {
|
||||
@@ -2729,6 +2776,7 @@ func TestMarkUnreadCRTOffUpdatesThreads(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIsCRTEnabledForUser(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
type preference struct {
|
||||
val string
|
||||
err error
|
||||
@@ -2808,6 +2856,7 @@ func TestIsCRTEnabledForUser(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetGroupMessageMembersCommonTeams(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := SetupWithStoreMock(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -2874,6 +2923,7 @@ func TestGetGroupMessageMembersCommonTeams(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestConvertGroupMessageToChannel(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := SetupWithStoreMock(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -3022,6 +3072,7 @@ func TestConvertGroupMessageToChannel(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPatchChannelMembersNotifyProps(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ import (
|
||||
)
|
||||
|
||||
func TestParseStaticListArgument(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
items := []model.AutocompleteListItem{
|
||||
{
|
||||
Hint: "[hint]",
|
||||
@@ -25,12 +26,12 @@ func TestParseStaticListArgument(t *testing.T) {
|
||||
fixedArgs := &model.AutocompleteStaticListArg{PossibleArguments: items}
|
||||
|
||||
argument := &model.AutocompleteArg{
|
||||
Name: "", //positional
|
||||
Name: "", // positional
|
||||
HelpText: "some_help",
|
||||
Type: model.AutocompleteArgTypeStaticList,
|
||||
Data: fixedArgs,
|
||||
}
|
||||
found, _, _, suggestions := parseStaticListArgument(argument, "", "") //TODO understand this!
|
||||
found, _, _, suggestions := parseStaticListArgument(argument, "", "") // TODO understand this!
|
||||
assert.True(t, found)
|
||||
assert.Equal(t, []model.AutocompleteSuggestion{{Complete: "on", Suggestion: "on", Hint: "[hint]", Description: "help"}}, suggestions)
|
||||
|
||||
@@ -91,8 +92,9 @@ func TestParseStaticListArgument(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestParseInputTextArgument(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
argument := &model.AutocompleteArg{
|
||||
Name: "", //positional
|
||||
Name: "", // positional
|
||||
HelpText: "some_help",
|
||||
Type: model.AutocompleteArgTypeText,
|
||||
Data: &model.AutocompleteTextArg{Hint: "hint", Pattern: "pat"},
|
||||
@@ -136,8 +138,9 @@ func TestParseInputTextArgument(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestParseNamedArguments(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
argument := &model.AutocompleteArg{
|
||||
Name: "name", //named
|
||||
Name: "name", // named
|
||||
HelpText: "some_help",
|
||||
Type: model.AutocompleteArgTypeText,
|
||||
Data: &model.AutocompleteTextArg{Hint: "hint", Pattern: "pat"},
|
||||
@@ -201,6 +204,7 @@ func TestParseNamedArguments(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSuggestions(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -327,6 +331,7 @@ func TestSuggestions(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCommandWithOptionalArgs(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -614,6 +619,7 @@ func createJiraAutocompleteData() *model.AutocompleteData {
|
||||
}
|
||||
|
||||
func TestDynamicListArgsForBuiltin(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -637,8 +643,7 @@ func TestDynamicListArgsForBuiltin(t *testing.T) {
|
||||
})
|
||||
}
|
||||
|
||||
type testCommandProvider struct {
|
||||
}
|
||||
type testCommandProvider struct{}
|
||||
|
||||
func (p *testCommandProvider) GetTrigger() string {
|
||||
return "bogus"
|
||||
|
||||
@@ -10,6 +10,7 @@ import (
|
||||
)
|
||||
|
||||
func TestPossibleAtMentions(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
fixture := []struct {
|
||||
message string
|
||||
expected []string
|
||||
@@ -55,6 +56,7 @@ func TestPossibleAtMentions(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestTrimUsernameSpecialChar(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
fixture := []struct {
|
||||
word string
|
||||
expectedString string
|
||||
|
||||
@@ -18,6 +18,7 @@ import (
|
||||
)
|
||||
|
||||
func TestAsymmetricSigningKey(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := SetupWithStoreMock(t)
|
||||
defer th.TearDown()
|
||||
assert.NotNil(t, th.App.AsymmetricSigningKey())
|
||||
@@ -25,12 +26,14 @@ func TestAsymmetricSigningKey(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPostActionCookieSecret(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := SetupWithStoreMock(t)
|
||||
defer th.TearDown()
|
||||
assert.Equal(t, 32, len(th.App.PostActionCookieSecret()))
|
||||
}
|
||||
|
||||
func TestClientConfigWithComputed(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := SetupWithStoreMock(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -58,6 +61,7 @@ func TestClientConfigWithComputed(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestEnsureInstallationDate(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"os"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
@@ -16,8 +15,7 @@ import (
|
||||
)
|
||||
|
||||
func TestGetCPAField(t *testing.T) {
|
||||
os.Setenv("MM_FEATUREFLAGS_CUSTOMPROFILEATTRIBUTES", "true")
|
||||
defer os.Unsetenv("MM_FEATUREFLAGS_CUSTOMPROFILEATTRIBUTES")
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -122,8 +120,7 @@ func TestGetCPAField(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestListCPAFields(t *testing.T) {
|
||||
os.Setenv("MM_FEATUREFLAGS_CUSTOMPROFILEATTRIBUTES", "true")
|
||||
defer os.Unsetenv("MM_FEATUREFLAGS_CUSTOMPROFILEATTRIBUTES")
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -167,8 +164,7 @@ func TestListCPAFields(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCreateCPAField(t *testing.T) {
|
||||
os.Setenv("MM_FEATUREFLAGS_CUSTOMPROFILEATTRIBUTES", "true")
|
||||
defer os.Unsetenv("MM_FEATUREFLAGS_CUSTOMPROFILEATTRIBUTES")
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
|
||||
cpaGroupID, cErr := th.App.CpaGroupID()
|
||||
@@ -276,8 +272,7 @@ func TestCreateCPAField(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPatchCPAField(t *testing.T) {
|
||||
os.Setenv("MM_FEATUREFLAGS_CUSTOMPROFILEATTRIBUTES", "true")
|
||||
defer os.Unsetenv("MM_FEATUREFLAGS_CUSTOMPROFILEATTRIBUTES")
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -540,8 +535,7 @@ func TestPatchCPAField(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDeleteCPAField(t *testing.T) {
|
||||
os.Setenv("MM_FEATUREFLAGS_CUSTOMPROFILEATTRIBUTES", "true")
|
||||
defer os.Unsetenv("MM_FEATUREFLAGS_CUSTOMPROFILEATTRIBUTES")
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -622,8 +616,7 @@ func TestDeleteCPAField(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetCPAValue(t *testing.T) {
|
||||
os.Setenv("MM_FEATUREFLAGS_CUSTOMPROFILEATTRIBUTES", "true")
|
||||
defer os.Unsetenv("MM_FEATUREFLAGS_CUSTOMPROFILEATTRIBUTES")
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -699,9 +692,10 @@ func TestGetCPAValue(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestListCPAValues(t *testing.T) {
|
||||
os.Setenv("MM_FEATUREFLAGS_CUSTOMPROFILEATTRIBUTES", "true")
|
||||
defer os.Unsetenv("MM_FEATUREFLAGS_CUSTOMPROFILEATTRIBUTES")
|
||||
th := Setup(t).InitBasic()
|
||||
mainHelper.Parallel(t)
|
||||
th := SetupConfig(t, func(cfg *model.Config) {
|
||||
cfg.FeatureFlags.CustomProfileAttributes = true
|
||||
}).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
cpaGroupID, cErr := th.App.CpaGroupID()
|
||||
@@ -756,8 +750,7 @@ func TestListCPAValues(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPatchCPAValue(t *testing.T) {
|
||||
os.Setenv("MM_FEATUREFLAGS_CUSTOMPROFILEATTRIBUTES", "true")
|
||||
defer os.Unsetenv("MM_FEATUREFLAGS_CUSTOMPROFILEATTRIBUTES")
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -882,9 +875,10 @@ func TestPatchCPAValue(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDeleteCPAValues(t *testing.T) {
|
||||
os.Setenv("MM_FEATUREFLAGS_CUSTOMPROFILEATTRIBUTES", "true")
|
||||
defer os.Unsetenv("MM_FEATUREFLAGS_CUSTOMPROFILEATTRIBUTES")
|
||||
th := Setup(t).InitBasic()
|
||||
mainHelper.Parallel(t)
|
||||
th := SetupConfig(t, func(cfg *model.Config) {
|
||||
cfg.FeatureFlags.CustomProfileAttributes = true
|
||||
}).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
cpaGroupID, cErr := th.App.CpaGroupID()
|
||||
|
||||
@@ -18,6 +18,7 @@ const (
|
||||
)
|
||||
|
||||
func TestGenerateAndSaveDesktopToken(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -29,6 +30,7 @@ func TestGenerateAndSaveDesktopToken(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestValidateDesktopToken(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ import (
|
||||
)
|
||||
|
||||
func TestDownloadFromURL(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"os"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
@@ -16,11 +15,7 @@ import (
|
||||
)
|
||||
|
||||
func TestGetDraft(t *testing.T) {
|
||||
os.Setenv("MM_FEATUREFLAGS_GLOBALDRAFTS", "true")
|
||||
defer os.Unsetenv("MM_FEATUREFLAGS_GLOBALDRAFTS")
|
||||
os.Setenv("MM_SERVICESETTINGS_ALLOWSYNCEDDRAFTS", "true")
|
||||
defer os.Unsetenv("MM_SERVICESETTINGS_ALLOWSYNCEDDRAFTS")
|
||||
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -52,11 +47,6 @@ func TestGetDraft(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("get draft feature flag", func(t *testing.T) {
|
||||
os.Setenv("MM_FEATUREFLAGS_GLOBALDRAFTS", "false")
|
||||
defer os.Unsetenv("MM_FEATUREFLAGS_GLOBALDRAFTS")
|
||||
os.Setenv("MM_SERVICESETTINGS_ALLOWSYNCEDDRAFTS", "false")
|
||||
defer os.Unsetenv("MM_SERVICESETTINGS_ALLOWSYNCEDDRAFTS")
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.AllowSyncedDrafts = false })
|
||||
defer th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.AllowSyncedDrafts = true })
|
||||
|
||||
@@ -66,6 +56,7 @@ func TestGetDraft(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUpsertDraft(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -115,11 +106,6 @@ func TestUpsertDraft(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("upsert draft feature flag", func(t *testing.T) {
|
||||
os.Setenv("MM_FEATUREFLAGS_GLOBALDRAFTS", "false")
|
||||
defer os.Unsetenv("MM_FEATUREFLAGS_GLOBALDRAFTS")
|
||||
os.Setenv("MM_SERVICESETTINGS_ALLOWSYNCEDDRAFTS", "false")
|
||||
defer os.Unsetenv("MM_SERVICESETTINGS_ALLOWSYNCEDDRAFTS")
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.AllowSyncedDrafts = false })
|
||||
defer th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.AllowSyncedDrafts = true })
|
||||
|
||||
@@ -129,6 +115,7 @@ func TestUpsertDraft(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCreateDraft(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -187,6 +174,7 @@ func TestCreateDraft(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUpdateDraft(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -232,6 +220,7 @@ func TestUpdateDraft(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetDraftsForUser(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -346,11 +335,6 @@ func TestGetDraftsForUser(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("get drafts feature flag", func(t *testing.T) {
|
||||
os.Setenv("MM_FEATUREFLAGS_GLOBALDRAFTS", "false")
|
||||
defer os.Unsetenv("MM_FEATUREFLAGS_GLOBALDRAFTS")
|
||||
os.Setenv("MM_SERVICESETTINGS_ALLOWSYNCEDDRAFTS", "false")
|
||||
defer os.Unsetenv("MM_SERVICESETTINGS_ALLOWSYNCEDDRAFTS")
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.AllowSyncedDrafts = false })
|
||||
defer th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.AllowSyncedDrafts = true })
|
||||
|
||||
@@ -360,6 +344,7 @@ func TestGetDraftsForUser(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDeleteDraft(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -388,11 +373,6 @@ func TestDeleteDraft(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("delete drafts feature flag", func(t *testing.T) {
|
||||
os.Setenv("MM_FEATUREFLAGS_GLOBALDRAFTS", "false")
|
||||
defer os.Unsetenv("MM_FEATUREFLAGS_GLOBALDRAFTS")
|
||||
os.Setenv("MM_SERVICESETTINGS_ALLOWSYNCEDDRAFTS", "false")
|
||||
defer os.Unsetenv("MM_SERVICESETTINGS_ALLOWSYNCEDDRAFTS")
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.AllowSyncedDrafts = false })
|
||||
defer th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.AllowSyncedDrafts = true })
|
||||
|
||||
|
||||
@@ -16,6 +16,8 @@ import (
|
||||
)
|
||||
|
||||
func TestHandleNewNotifications(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
|
||||
th := SetupWithStoreMock(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -75,6 +77,7 @@ func TestHandleNewNotifications(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCheckPendingNotifications(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -194,6 +197,7 @@ func TestCheckPendingNotifications(t *testing.T) {
|
||||
* Ensures that email batch interval defaults to 15 minutes for users that haven't explicitly set this preference
|
||||
*/
|
||||
func TestCheckPendingNotificationsDefaultInterval(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -237,6 +241,7 @@ func TestCheckPendingNotificationsDefaultInterval(t *testing.T) {
|
||||
* Ensures that email batch interval defaults to 15 minutes if user preference is invalid
|
||||
*/
|
||||
func TestCheckPendingNotificationsCantParseInterval(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
package email
|
||||
|
||||
import (
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
@@ -14,6 +13,8 @@ import (
|
||||
)
|
||||
|
||||
func TestCondenseSiteURL(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
|
||||
require.Equal(t, "", condenseSiteURL(""))
|
||||
require.Equal(t, "mattermost.com", condenseSiteURL("mattermost.com"))
|
||||
require.Equal(t, "mattermost.com", condenseSiteURL("mattermost.com/"))
|
||||
@@ -35,6 +36,7 @@ func TestCondenseSiteURL(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSendInviteEmails(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
th.ConfigureInbucketMail()
|
||||
@@ -84,13 +86,14 @@ func TestSendInviteEmails(t *testing.T) {
|
||||
|
||||
t.Run("SendInviteEmails can return error when SMTP connection fails", func(t *testing.T) {
|
||||
originalPort := *th.service.config().EmailSettings.SMTPPort
|
||||
originalTimeout := *th.service.config().EmailSettings.SMTPServerTimeout
|
||||
th.UpdateConfig(func(cfg *model.Config) {
|
||||
os.Setenv("MM_EMAILSETTINGS_SMTPPORT", "5432")
|
||||
*cfg.EmailSettings.SMTPPort = "5432"
|
||||
*cfg.EmailSettings.SMTPServerTimeout = 4
|
||||
})
|
||||
defer th.UpdateConfig(func(cfg *model.Config) {
|
||||
os.Setenv("MM_EMAILSETTINGS_SMTPPORT", originalPort)
|
||||
*cfg.EmailSettings.SMTPPort = originalPort
|
||||
*cfg.EmailSettings.SMTPServerTimeout = originalTimeout
|
||||
})
|
||||
|
||||
err := th.service.SendInviteEmails(th.BasicTeam, "test-user", th.BasicUser.Id, []string{emailTo}, "http://testserver", nil, true, false, false)
|
||||
@@ -123,14 +126,15 @@ func TestSendInviteEmails(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("SendGuestInviteEmail can return error when SMTP connection fails", func(t *testing.T) {
|
||||
originalTimeout := *th.service.config().EmailSettings.SMTPServerTimeout
|
||||
originalPort := *th.service.config().EmailSettings.SMTPPort
|
||||
th.UpdateConfig(func(cfg *model.Config) {
|
||||
os.Setenv("MM_EMAILSETTINGS_SMTPPORT", "5432")
|
||||
*cfg.EmailSettings.SMTPPort = "5432"
|
||||
*cfg.EmailSettings.SMTPServerTimeout = 4
|
||||
})
|
||||
defer th.UpdateConfig(func(cfg *model.Config) {
|
||||
os.Setenv("MM_EMAILSETTINGS_SMTPPORT", originalPort)
|
||||
*cfg.EmailSettings.SMTPPort = originalPort
|
||||
*cfg.EmailSettings.SMTPServerTimeout = originalTimeout
|
||||
})
|
||||
|
||||
err := th.service.SendGuestInviteEmails(
|
||||
@@ -255,6 +259,7 @@ func TestSendInviteEmails(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSendCloudWelcomeEmail(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
th.ConfigureInbucketMail()
|
||||
@@ -294,6 +299,7 @@ func TestSendCloudWelcomeEmail(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestMailServiceConfig(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
configuredReplyTo := "feedbackexample@test.com"
|
||||
customReplyTo := "customreplyto@test.com"
|
||||
|
||||
|
||||
@@ -41,10 +41,19 @@ func Setup(tb testing.TB) *TestHelper {
|
||||
if testing.Short() {
|
||||
tb.SkipNow()
|
||||
}
|
||||
dbStore := mainHelper.GetStore()
|
||||
dbStore.DropAllTables()
|
||||
dbStore.MarkSystemRanUnitTests()
|
||||
mainHelper.PreloadMigrations()
|
||||
|
||||
var dbStore store.Store
|
||||
if mainHelper.Options.RunParallel {
|
||||
dbStore, _, _, _ = mainHelper.GetNewStores(tb)
|
||||
tb.Cleanup(func() {
|
||||
dbStore.Close()
|
||||
})
|
||||
} else {
|
||||
dbStore = mainHelper.GetStore()
|
||||
dbStore.DropAllTables()
|
||||
dbStore.MarkSystemRanUnitTests()
|
||||
mainHelper.PreloadMigrations()
|
||||
}
|
||||
|
||||
return setupTestHelper(dbStore, tb)
|
||||
}
|
||||
|
||||
@@ -5,13 +5,18 @@ package email
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"os"
|
||||
"strconv"
|
||||
"testing"
|
||||
|
||||
"github.com/mattermost/mattermost/server/public/shared/mlog"
|
||||
"github.com/mattermost/mattermost/server/v8/channels/testlib"
|
||||
)
|
||||
|
||||
var mainHelper *testlib.MainHelper
|
||||
var replicaFlag bool
|
||||
var (
|
||||
mainHelper *testlib.MainHelper
|
||||
replicaFlag bool
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
if f := flag.Lookup("mysql-replica"); f == nil {
|
||||
@@ -19,10 +24,21 @@ func TestMain(m *testing.M) {
|
||||
flag.Parse()
|
||||
}
|
||||
|
||||
var options = testlib.HelperOptions{
|
||||
var parallelism int
|
||||
if f := flag.Lookup("test.parallel"); f != nil {
|
||||
parallelism, _ = strconv.Atoi(f.Value.String())
|
||||
}
|
||||
runParallel := os.Getenv("ENABLE_FULLY_PARALLEL_TESTS") == "true" && parallelism > 1
|
||||
if runParallel {
|
||||
mlog.Info("Fully parallel tests enabled", mlog.Int("parallelism", parallelism))
|
||||
}
|
||||
|
||||
options := testlib.HelperOptions{
|
||||
EnableStore: true,
|
||||
EnableResources: true,
|
||||
WithReadReplica: replicaFlag,
|
||||
RunParallel: runParallel,
|
||||
Parallelism: parallelism,
|
||||
}
|
||||
|
||||
mainHelper = testlib.NewMainHelperWithOptions(&options)
|
||||
|
||||
@@ -12,6 +12,7 @@ import (
|
||||
)
|
||||
|
||||
func TestProcessMessageAttachments(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ import (
|
||||
)
|
||||
|
||||
func TestSendInviteEmailRateLimits(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ import (
|
||||
)
|
||||
|
||||
func TestGetMultipleEmojiByName(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
// The fact that we use mock store ensures that
|
||||
// the call to the DB does not happen. If it did, we would have needed
|
||||
// to provide the mock explicitly.
|
||||
|
||||
@@ -17,6 +17,7 @@ import (
|
||||
)
|
||||
|
||||
func TestSAMLSettings(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
tt := []struct {
|
||||
name string
|
||||
setInterface bool
|
||||
|
||||
@@ -14,6 +14,7 @@ import (
|
||||
)
|
||||
|
||||
func TestNotifySessionsExpired(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ import (
|
||||
)
|
||||
|
||||
func TestReactionsOfPost(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -58,6 +59,7 @@ func TestReactionsOfPost(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestExportUserNotifyProps(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := SetupWithStoreMock(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -85,6 +87,7 @@ func TestExportUserNotifyProps(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestExportUserChannels(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -136,6 +139,7 @@ func TestExportUserChannels(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCopyEmojiImages(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := SetupWithStoreMock(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -172,6 +176,7 @@ func TestCopyEmojiImages(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestExportCustomEmoji(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -192,6 +197,7 @@ func TestExportCustomEmoji(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestExportAllUsers(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th1 := Setup(t)
|
||||
defer th1.TearDown()
|
||||
|
||||
@@ -204,8 +210,15 @@ func TestExportAllUsers(t *testing.T) {
|
||||
err = th1.App.BulkExport(th1.Context, &b, "somePath", nil, model.BulkExportOpts{})
|
||||
require.Nil(t, err)
|
||||
|
||||
th2 := Setup(t)
|
||||
defer th2.TearDown()
|
||||
var th2 *TestHelper
|
||||
if mainHelper.Options.RunParallel {
|
||||
th1.Store.DropAllTables()
|
||||
th2 = th1
|
||||
} else {
|
||||
th2 = Setup(t)
|
||||
defer th2.TearDown()
|
||||
}
|
||||
|
||||
i, err := th2.App.BulkImport(th2.Context, &b, nil, false, 5)
|
||||
assert.Nil(t, err)
|
||||
assert.EqualValues(t, 0, i)
|
||||
@@ -241,6 +254,7 @@ func TestExportAllUsers(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestExportAllBots(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th1 := Setup(t)
|
||||
defer th1.TearDown()
|
||||
|
||||
@@ -276,6 +290,7 @@ func TestExportAllBots(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestExportDMChannel(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
t.Run("Export a DM channel to another server", func(t *testing.T) {
|
||||
th1 := Setup(t).InitBasic()
|
||||
defer th1.TearDown()
|
||||
@@ -406,6 +421,7 @@ func TestExportDMChannel(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestExportDMChannelToSelf(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th1 := Setup(t).InitBasic()
|
||||
defer th1.TearDown()
|
||||
|
||||
@@ -440,6 +456,7 @@ func TestExportDMChannelToSelf(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestExportGMChannel(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th1 := Setup(t).InitBasic()
|
||||
|
||||
user1 := th1.CreateUser()
|
||||
@@ -469,6 +486,7 @@ func TestExportGMChannel(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestExportGMandDMChannels(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th1 := Setup(t).InitBasic()
|
||||
|
||||
// DM Channel
|
||||
@@ -516,6 +534,7 @@ func TestExportGMandDMChannels(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestExportDMandGMPost(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th1 := Setup(t).InitBasic()
|
||||
|
||||
// DM Channel
|
||||
@@ -600,6 +619,7 @@ func TestExportDMandGMPost(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestExportPostWithProps(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th1 := Setup(t).InitBasic()
|
||||
|
||||
attachments := []*model.SlackAttachment{{Footer: "footer"}}
|
||||
@@ -677,6 +697,7 @@ func TestExportPostWithProps(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestExportUserCustomStatus(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th1 := Setup(t).InitBasic()
|
||||
|
||||
cs := &model.CustomStatus{
|
||||
@@ -711,6 +732,7 @@ func TestExportUserCustomStatus(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestExportDMPostWithSelf(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th1 := Setup(t).InitBasic()
|
||||
|
||||
// DM Channel with self (me channel)
|
||||
@@ -748,6 +770,7 @@ func TestExportDMPostWithSelf(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestExportPostsWithThread(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th1 := Setup(t).InitBasic()
|
||||
defer th1.TearDown()
|
||||
|
||||
@@ -985,6 +1008,7 @@ func TestExportFileWarnings(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestBulkExport(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
testsDir, _ := fileutils.FindDir("tests")
|
||||
|
||||
@@ -1039,6 +1063,7 @@ func TestBulkExport(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestBuildPostReplies(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -1103,6 +1128,7 @@ func TestBuildPostReplies(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestExportDeletedTeams(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th1 := Setup(t).InitBasic()
|
||||
defer th1.TearDown()
|
||||
|
||||
@@ -1118,8 +1144,15 @@ func TestExportDeletedTeams(t *testing.T) {
|
||||
err = th1.App.BulkExport(th1.Context, &b, "somePath", nil, model.BulkExportOpts{})
|
||||
require.Nil(t, err)
|
||||
|
||||
th2 := Setup(t)
|
||||
defer th2.TearDown()
|
||||
var th2 *TestHelper
|
||||
if mainHelper.Options.RunParallel {
|
||||
th1.Store.DropAllTables()
|
||||
th2 = th1
|
||||
} else {
|
||||
th2 = Setup(t)
|
||||
defer th2.TearDown()
|
||||
}
|
||||
|
||||
i, err := th2.App.BulkImport(th2.Context, &b, nil, false, 5)
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, 0, i)
|
||||
@@ -1144,6 +1177,7 @@ func TestExportDeletedTeams(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestExportArchivedChannels(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th1 := Setup(t).InitBasic()
|
||||
defer th1.TearDown()
|
||||
|
||||
@@ -1179,6 +1213,7 @@ func TestExportArchivedChannels(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestExportRoles(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
t.Run("defaults", func(t *testing.T) {
|
||||
th1 := Setup(t).InitBasic()
|
||||
defer th1.TearDown()
|
||||
@@ -1277,6 +1312,7 @@ func TestExportRoles(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestExportSchemes(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
t.Run("no schemes", func(t *testing.T) {
|
||||
th1 := Setup(t).InitBasic()
|
||||
defer th1.TearDown()
|
||||
|
||||
@@ -35,6 +35,7 @@ func assertDirectoryContents(t *testing.T, dir string, expectedFiles []string) {
|
||||
}
|
||||
|
||||
func TestExtractTarGz(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
makeArchive := func(t *testing.T, files []*tar.Header) bytes.Buffer {
|
||||
// Build an in-memory archive with the specified files, writing the path as each
|
||||
// file's contents when applicable.
|
||||
|
||||
@@ -13,6 +13,7 @@ import (
|
||||
)
|
||||
|
||||
func TestFilterInaccessibleFiles(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
th.App.Srv().SetLicense(model.NewTestLicense("cloud"))
|
||||
err := th.App.Srv().Store().System().Save(&model.System{
|
||||
@@ -23,7 +24,7 @@ func TestFilterInaccessibleFiles(t *testing.T) {
|
||||
|
||||
defer th.TearDown()
|
||||
|
||||
var getFileWithCreateAt = func(at int64) *model.FileInfo {
|
||||
getFileWithCreateAt := func(at int64) *model.FileInfo {
|
||||
return &model.FileInfo{CreateAt: at}
|
||||
}
|
||||
|
||||
@@ -116,6 +117,7 @@ func TestFilterInaccessibleFiles(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetFilteredAccessibleFiles(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
th.App.Srv().SetLicense(model.NewTestLicense("cloud"))
|
||||
err := th.App.Srv().Store().System().Save(&model.System{
|
||||
@@ -126,7 +128,7 @@ func TestGetFilteredAccessibleFiles(t *testing.T) {
|
||||
|
||||
defer th.TearDown()
|
||||
|
||||
var getFileWithCreateAt = func(at int64) *model.FileInfo {
|
||||
getFileWithCreateAt := func(at int64) *model.FileInfo {
|
||||
return &model.FileInfo{CreateAt: at}
|
||||
}
|
||||
|
||||
@@ -158,6 +160,7 @@ func TestGetFilteredAccessibleFiles(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIsInaccessibleFile(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
th.App.Srv().SetLicense(model.NewTestLicense("cloud"))
|
||||
err := th.App.Srv().Store().System().Save(&model.System{
|
||||
@@ -180,6 +183,7 @@ func TestIsInaccessibleFile(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestRemoveInaccessibleContentFromFilesSlice(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
th.App.Srv().SetLicense(model.NewTestLicense("cloud"))
|
||||
err := th.App.Srv().Store().System().Save(&model.System{
|
||||
@@ -190,7 +194,7 @@ func TestRemoveInaccessibleContentFromFilesSlice(t *testing.T) {
|
||||
|
||||
defer th.TearDown()
|
||||
|
||||
var getFileWithCreateAt = func(at int64) *model.FileInfo {
|
||||
getFileWithCreateAt := func(at int64) *model.FileInfo {
|
||||
return &model.FileInfo{CreateAt: at}
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ import (
|
||||
)
|
||||
|
||||
func TestGetInfoForFile(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
fakeFile := make([]byte, 1000)
|
||||
|
||||
pngFile, err := os.ReadFile("tests/test.png")
|
||||
@@ -26,7 +27,7 @@ func TestGetInfoForFile(t *testing.T) {
|
||||
animatedGifFile, err := os.ReadFile("tests/testgif.gif")
|
||||
require.NoError(t, err, "Failed to load testgif.gif")
|
||||
|
||||
var ttc = []struct {
|
||||
ttc := []struct {
|
||||
testName string
|
||||
filename string
|
||||
file []byte
|
||||
|
||||
@@ -30,6 +30,7 @@ import (
|
||||
)
|
||||
|
||||
func TestGeneratePublicLinkHash(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
filename1 := model.NewId() + "/" + model.NewRandomString(16) + ".txt"
|
||||
filename2 := model.NewId() + "/" + model.NewRandomString(16) + ".txt"
|
||||
salt1 := model.NewRandomString(32)
|
||||
@@ -48,6 +49,7 @@ func TestGeneratePublicLinkHash(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDoUploadFile(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -109,6 +111,7 @@ func TestDoUploadFile(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUploadFile(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -137,6 +140,7 @@ func TestUploadFile(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestParseOldFilenames(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -234,6 +238,7 @@ func TestParseOldFilenames(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetInfoForFilename(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -245,6 +250,7 @@ func TestGetInfoForFilename(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestFindTeamIdForFilename(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -259,6 +265,7 @@ func TestFindTeamIdForFilename(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestMigrateFilenamesToFileInfos(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -293,6 +300,7 @@ func TestMigrateFilenamesToFileInfos(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCreateZipFileAndAddFiles(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -349,6 +357,7 @@ func TestCreateZipFileAndAddFiles(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCopyFileInfos(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -380,6 +389,7 @@ func TestCopyFileInfos(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGenerateThumbnailImage(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
t.Run("test generating thumbnail image", func(t *testing.T) {
|
||||
// given
|
||||
th := Setup(t)
|
||||
@@ -409,6 +419,7 @@ func createDummyImage() *image.RGBA {
|
||||
}
|
||||
|
||||
func TestSearchFilesInTeamForUser(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
perPage := 5
|
||||
searchTerm := "searchTerm"
|
||||
|
||||
@@ -602,6 +613,7 @@ func TestSearchFilesInTeamForUser(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestExtractContentFromFileInfo(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
app := &App{}
|
||||
fi := &model.FileInfo{
|
||||
MimeType: "image/jpeg",
|
||||
@@ -612,6 +624,7 @@ func TestExtractContentFromFileInfo(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetLastAccessibleFileTime(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := SetupWithStoreMock(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -645,6 +658,7 @@ func TestGetLastAccessibleFileTime(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestComputeLastAccessibleFileTime(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
t.Run("Updates the time, if cloud limit is applicable", func(t *testing.T) {
|
||||
th := SetupWithStoreMock(t)
|
||||
defer th.TearDown()
|
||||
@@ -704,6 +718,7 @@ func TestComputeLastAccessibleFileTime(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSetFileSearchableContent(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -732,6 +747,7 @@ func TestSetFileSearchableContent(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPermanentDeleteFilesByPost(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ import (
|
||||
)
|
||||
|
||||
func TestGetGroup(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
group := th.CreateGroup()
|
||||
@@ -35,6 +36,7 @@ func TestGetGroup(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetGroupByRemoteID(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
group := th.CreateGroup()
|
||||
@@ -49,6 +51,7 @@ func TestGetGroupByRemoteID(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetGroupsByType(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
th.CreateGroup()
|
||||
@@ -65,6 +68,7 @@ func TestGetGroupsByType(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCreateGroup(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -100,6 +104,7 @@ func TestCreateGroup(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUpdateGroup(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
group := th.CreateGroup()
|
||||
@@ -117,6 +122,7 @@ func TestUpdateGroup(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDeleteGroup(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
group := th.CreateGroup()
|
||||
@@ -131,6 +137,7 @@ func TestDeleteGroup(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUndeleteGroup(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
group := th.CreateGroup()
|
||||
@@ -149,6 +156,7 @@ func TestUndeleteGroup(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCreateOrRestoreGroupMember(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
group := th.CreateGroup()
|
||||
@@ -163,6 +171,7 @@ func TestCreateOrRestoreGroupMember(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDeleteGroupMember(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
group := th.CreateGroup()
|
||||
@@ -180,6 +189,7 @@ func TestDeleteGroupMember(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUpsertGroupSyncable(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
group := th.CreateGroup()
|
||||
@@ -206,6 +216,7 @@ func TestUpsertGroupSyncable(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUpsertGroupSyncableTeamGroupConstrained(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -234,6 +245,7 @@ func TestUpsertGroupSyncableTeamGroupConstrained(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetGroupSyncable(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
group := th.CreateGroup()
|
||||
@@ -249,6 +261,7 @@ func TestGetGroupSyncable(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetGroupSyncables(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
group := th.CreateGroup()
|
||||
@@ -267,6 +280,7 @@ func TestGetGroupSyncables(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDeleteGroupSyncable(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
group := th.CreateGroup()
|
||||
@@ -286,6 +300,7 @@ func TestDeleteGroupSyncable(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetGroupsByChannel(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
group := th.CreateGroup()
|
||||
@@ -320,6 +335,7 @@ func TestGetGroupsByChannel(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetGroupsAssociatedToChannelsByTeam(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
group := th.CreateGroup()
|
||||
@@ -359,6 +375,7 @@ func TestGetGroupsAssociatedToChannelsByTeam(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetGroupsByTeam(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
group := th.CreateGroup()
|
||||
@@ -386,6 +403,7 @@ func TestGetGroupsByTeam(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetGroups(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
group := th.CreateGroup()
|
||||
@@ -396,6 +414,7 @@ func TestGetGroups(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUserIsInAdminRoleGroup(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
group1 := th.CreateGroup()
|
||||
|
||||
@@ -29,12 +29,15 @@ import (
|
||||
"github.com/mattermost/mattermost/server/v8/channels/testlib"
|
||||
"github.com/mattermost/mattermost/server/v8/config"
|
||||
"github.com/mattermost/mattermost/server/v8/einterfaces"
|
||||
"github.com/mattermost/mattermost/server/v8/platform/services/searchengine"
|
||||
)
|
||||
|
||||
type TestHelper struct {
|
||||
App *App
|
||||
Context *request.Context
|
||||
Server *Server
|
||||
Store store.Store
|
||||
SQLStore *sqlstore.SqlStore
|
||||
BasicTeam *model.Team
|
||||
BasicUser *model.User
|
||||
BasicUser2 *model.User
|
||||
@@ -54,8 +57,9 @@ type PostOptions func(*model.Post)
|
||||
|
||||
type PostPatchOptions func(patch *model.PostPatch)
|
||||
|
||||
func setupTestHelper(dbStore store.Store, enterprise bool, includeCacheLayer bool,
|
||||
updateConfig func(*model.Config), options []Option, tb testing.TB) *TestHelper {
|
||||
func setupTestHelper(dbStore store.Store, sqlStore *sqlstore.SqlStore, sqlSettings *model.SqlSettings, searchEngine *searchengine.Broker, enterprise bool, includeCacheLayer bool,
|
||||
updateConfig func(*model.Config), options []Option, tb testing.TB,
|
||||
) *TestHelper {
|
||||
tempWorkspace, err := os.MkdirTemp("", "apptest")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
@@ -63,7 +67,10 @@ func setupTestHelper(dbStore store.Store, enterprise bool, includeCacheLayer boo
|
||||
|
||||
configStore := config.NewTestMemoryStore()
|
||||
memoryConfig := configStore.Get()
|
||||
memoryConfig.SqlSettings = *mainHelper.GetSQLSettings()
|
||||
|
||||
memoryConfig.SqlSettings = model.SafeDereference(sqlSettings)
|
||||
*memoryConfig.ServiceSettings.LicenseFileLocation = filepath.Join(tempWorkspace, "license.json")
|
||||
*memoryConfig.FileSettings.Directory = filepath.Join(tempWorkspace, "data")
|
||||
*memoryConfig.PluginSettings.Directory = filepath.Join(tempWorkspace, "plugins")
|
||||
*memoryConfig.PluginSettings.ClientDirectory = filepath.Join(tempWorkspace, "webapp")
|
||||
*memoryConfig.PluginSettings.AutomaticPrepackagedPlugins = false
|
||||
@@ -71,6 +78,7 @@ func setupTestHelper(dbStore store.Store, enterprise bool, includeCacheLayer boo
|
||||
*memoryConfig.LogSettings.ConsoleLevel = mlog.LvlStdLog.Name
|
||||
*memoryConfig.AnnouncementSettings.AdminNoticesEnabled = false
|
||||
*memoryConfig.AnnouncementSettings.UserNoticesEnabled = false
|
||||
*memoryConfig.LogSettings.FileLocation = filepath.Join(tempWorkspace, "logs", "mattermost.log")
|
||||
if updateConfig != nil {
|
||||
updateConfig(memoryConfig)
|
||||
}
|
||||
@@ -111,6 +119,8 @@ func setupTestHelper(dbStore store.Store, enterprise bool, includeCacheLayer boo
|
||||
TestLogger: testLogger,
|
||||
IncludeCacheLayer: includeCacheLayer,
|
||||
ConfigStore: configStore,
|
||||
Store: dbStore,
|
||||
SQLStore: sqlStore,
|
||||
}
|
||||
|
||||
th.App.Srv().SetLicense(getLicense(enterprise, memoryConfig))
|
||||
@@ -119,6 +129,14 @@ func setupTestHelper(dbStore store.Store, enterprise bool, includeCacheLayer boo
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.RateLimitSettings.Enable = false })
|
||||
prevListenAddress := *th.App.Config().ServiceSettings.ListenAddress
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.ListenAddress = "localhost:0" })
|
||||
|
||||
// Support updating feature flags without resorting to os.Setenv which
|
||||
// isn't concurrently safe.
|
||||
if updateConfig != nil {
|
||||
configStore.SetReadOnlyFF(false)
|
||||
th.App.UpdateConfig(updateConfig)
|
||||
}
|
||||
|
||||
serverErr := th.Server.Start()
|
||||
if serverErr != nil {
|
||||
panic(serverErr)
|
||||
@@ -126,7 +144,7 @@ func setupTestHelper(dbStore store.Store, enterprise bool, includeCacheLayer boo
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.ListenAddress = prevListenAddress })
|
||||
|
||||
th.App.Srv().Platform().SearchEngine = mainHelper.SearchEngine
|
||||
th.App.Srv().Platform().SearchEngine = searchEngine
|
||||
|
||||
th.App.Srv().Store().MarkSystemRanUnitTests()
|
||||
|
||||
@@ -158,40 +176,57 @@ func getLicense(enterprise bool, cfg *model.Config) *model.License {
|
||||
return nil
|
||||
}
|
||||
|
||||
func setupStores(tb testing.TB) (store.Store, *sqlstore.SqlStore, *model.SqlSettings, *searchengine.Broker) {
|
||||
var dbStore store.Store
|
||||
var sqlStore *sqlstore.SqlStore
|
||||
var dbSettings *model.SqlSettings
|
||||
var searchEngine *searchengine.Broker
|
||||
if mainHelper.Options.RunParallel {
|
||||
dbStore, sqlStore, dbSettings, searchEngine = mainHelper.GetNewStores(tb)
|
||||
tb.Cleanup(func() {
|
||||
dbStore.Close()
|
||||
})
|
||||
} else {
|
||||
dbStore = mainHelper.GetStore()
|
||||
dbStore.DropAllTables()
|
||||
dbStore.MarkSystemRanUnitTests()
|
||||
mainHelper.PreloadMigrations()
|
||||
searchEngine = mainHelper.GetSearchEngine()
|
||||
dbSettings = mainHelper.GetSQLSettings()
|
||||
sqlStore = mainHelper.GetSQLStore()
|
||||
}
|
||||
|
||||
return dbStore, sqlStore, dbSettings, searchEngine
|
||||
}
|
||||
|
||||
func Setup(tb testing.TB, options ...Option) *TestHelper {
|
||||
if testing.Short() {
|
||||
tb.SkipNow()
|
||||
}
|
||||
dbStore := mainHelper.GetStore()
|
||||
dbStore.DropAllTables()
|
||||
dbStore.MarkSystemRanUnitTests()
|
||||
mainHelper.PreloadMigrations()
|
||||
|
||||
return setupTestHelper(dbStore, false, true, nil, options, tb)
|
||||
dbStore, sqlStore, dbSettings, searchEngine := setupStores(tb)
|
||||
|
||||
return setupTestHelper(dbStore, sqlStore, dbSettings, searchEngine, false, true, nil, options, tb)
|
||||
}
|
||||
|
||||
func SetupEnterprise(tb testing.TB, options ...Option) *TestHelper {
|
||||
if testing.Short() {
|
||||
tb.SkipNow()
|
||||
}
|
||||
dbStore := mainHelper.GetStore()
|
||||
dbStore.DropAllTables()
|
||||
dbStore.MarkSystemRanUnitTests()
|
||||
mainHelper.PreloadMigrations()
|
||||
|
||||
return setupTestHelper(dbStore, true, true, nil, options, tb)
|
||||
dbStore, sqlStore, dbSettings, searchEngine := setupStores(tb)
|
||||
|
||||
return setupTestHelper(dbStore, sqlStore, dbSettings, searchEngine, true, true, nil, options, tb)
|
||||
}
|
||||
|
||||
func SetupConfig(tb testing.TB, updateConfig func(cfg *model.Config)) *TestHelper {
|
||||
if testing.Short() {
|
||||
tb.SkipNow()
|
||||
}
|
||||
dbStore := mainHelper.GetStore()
|
||||
dbStore.DropAllTables()
|
||||
dbStore.MarkSystemRanUnitTests()
|
||||
mainHelper.PreloadMigrations()
|
||||
|
||||
return setupTestHelper(dbStore, false, true, updateConfig, nil, tb)
|
||||
dbStore, sqlStore, dbSettings, searchEngine := setupStores(tb)
|
||||
|
||||
return setupTestHelper(dbStore, sqlStore, dbSettings, searchEngine, false, true, updateConfig, nil, tb)
|
||||
}
|
||||
|
||||
func SetupWithoutPreloadMigrations(tb testing.TB) *TestHelper {
|
||||
@@ -202,12 +237,12 @@ func SetupWithoutPreloadMigrations(tb testing.TB) *TestHelper {
|
||||
dbStore.DropAllTables()
|
||||
dbStore.MarkSystemRanUnitTests()
|
||||
|
||||
return setupTestHelper(dbStore, false, true, nil, nil, tb)
|
||||
return setupTestHelper(dbStore, mainHelper.GetSQLStore(), mainHelper.GetSQLSettings(), mainHelper.GetSearchEngine(), false, true, nil, nil, tb)
|
||||
}
|
||||
|
||||
func SetupWithStoreMock(tb testing.TB) *TestHelper {
|
||||
mockStore := testlib.GetMockStoreForSetupFunctions()
|
||||
th := setupTestHelper(mockStore, false, false, nil, nil, tb)
|
||||
th := setupTestHelper(mockStore, mainHelper.GetSQLStore(), mainHelper.GetSQLSettings(), mainHelper.GetSearchEngine(), false, false, nil, nil, tb)
|
||||
statusMock := mocks.StatusStore{}
|
||||
statusMock.On("UpdateExpiredDNDStatuses").Return([]*model.Status{}, nil)
|
||||
statusMock.On("Get", "user1").Return(&model.Status{UserId: "user1", Status: model.StatusOnline}, nil)
|
||||
@@ -228,7 +263,7 @@ func SetupWithStoreMock(tb testing.TB) *TestHelper {
|
||||
|
||||
func SetupEnterpriseWithStoreMock(tb testing.TB) *TestHelper {
|
||||
mockStore := testlib.GetMockStoreForSetupFunctions()
|
||||
th := setupTestHelper(mockStore, true, false, nil, nil, tb)
|
||||
th := setupTestHelper(mockStore, mainHelper.GetSQLStore(), mainHelper.GetSQLSettings(), mainHelper.GetSearchEngine(), true, false, nil, nil, tb)
|
||||
statusMock := mocks.StatusStore{}
|
||||
statusMock.On("UpdateExpiredDNDStatuses").Return([]*model.Status{}, nil)
|
||||
statusMock.On("Get", "user1").Return(&model.Status{UserId: "user1", Status: model.StatusOnline}, nil)
|
||||
@@ -245,44 +280,56 @@ func SetupWithClusterMock(tb testing.TB, cluster einterfaces.ClusterInterface) *
|
||||
if testing.Short() {
|
||||
tb.SkipNow()
|
||||
}
|
||||
dbStore := mainHelper.GetStore()
|
||||
dbStore.DropAllTables()
|
||||
dbStore.MarkSystemRanUnitTests()
|
||||
mainHelper.PreloadMigrations()
|
||||
|
||||
return setupTestHelper(dbStore, true, true, nil, []Option{SetCluster(cluster)}, tb)
|
||||
dbStore, sqlStore, dbSettings, searchEngine := setupStores(tb)
|
||||
|
||||
return setupTestHelper(dbStore, sqlStore, dbSettings, searchEngine, true, true, nil, []Option{SetCluster(cluster)}, tb)
|
||||
}
|
||||
|
||||
var initBasicOnce sync.Once
|
||||
var userCache struct {
|
||||
SystemAdminUser *model.User
|
||||
BasicUser *model.User
|
||||
BasicUser2 *model.User
|
||||
}
|
||||
var (
|
||||
initBasicOnce sync.Once
|
||||
userCache struct {
|
||||
SystemAdminUser *model.User
|
||||
BasicUser *model.User
|
||||
BasicUser2 *model.User
|
||||
}
|
||||
)
|
||||
|
||||
func (th *TestHelper) InitBasic() *TestHelper {
|
||||
// create users once and cache them because password hashing is slow
|
||||
initBasicOnce.Do(func() {
|
||||
var err *model.AppError
|
||||
|
||||
th.SystemAdminUser = th.CreateUser()
|
||||
th.App.UpdateUserRoles(th.Context, th.SystemAdminUser.Id, model.SystemUserRoleId+" "+model.SystemAdminRoleId, false)
|
||||
th.SystemAdminUser, _ = th.App.GetUser(th.SystemAdminUser.Id)
|
||||
th.SystemAdminUser, err = th.App.GetUser(th.SystemAdminUser.Id)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
userCache.SystemAdminUser = th.SystemAdminUser.DeepCopy()
|
||||
|
||||
th.BasicUser = th.CreateUser()
|
||||
th.BasicUser, _ = th.App.GetUser(th.BasicUser.Id)
|
||||
th.BasicUser, err = th.App.GetUser(th.BasicUser.Id)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
userCache.BasicUser = th.BasicUser.DeepCopy()
|
||||
|
||||
th.BasicUser2 = th.CreateUser()
|
||||
th.BasicUser2, _ = th.App.GetUser(th.BasicUser2.Id)
|
||||
th.BasicUser2, err = th.App.GetUser(th.BasicUser2.Id)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
userCache.BasicUser2 = th.BasicUser2.DeepCopy()
|
||||
})
|
||||
|
||||
// restore cached users
|
||||
th.SystemAdminUser = userCache.SystemAdminUser.DeepCopy()
|
||||
th.BasicUser = userCache.BasicUser.DeepCopy()
|
||||
th.BasicUser2 = userCache.BasicUser2.DeepCopy()
|
||||
|
||||
users := []*model.User{th.SystemAdminUser, th.BasicUser, th.BasicUser2}
|
||||
mainHelper.GetSQLStore().User().InsertUsers(users)
|
||||
th.Store.User().InsertUsers(users)
|
||||
|
||||
th.BasicTeam = th.CreateTeam()
|
||||
|
||||
@@ -638,8 +685,8 @@ func (th *TestHelper) TearDown() {
|
||||
}
|
||||
}
|
||||
|
||||
func (*TestHelper) GetSqlStore() *sqlstore.SqlStore {
|
||||
return mainHelper.GetSQLStore()
|
||||
func (th *TestHelper) GetSqlStore() *sqlstore.SqlStore {
|
||||
return th.SQLStore
|
||||
}
|
||||
|
||||
func (th *TestHelper) ConfigureInbucketMail() {
|
||||
@@ -657,8 +704,8 @@ func (th *TestHelper) ConfigureInbucketMail() {
|
||||
})
|
||||
}
|
||||
|
||||
func (*TestHelper) ResetRoleMigration() {
|
||||
sqlStore := mainHelper.GetSQLStore()
|
||||
func (th *TestHelper) ResetRoleMigration() {
|
||||
sqlStore := th.SQLStore
|
||||
if _, err := sqlStore.GetMaster().Exec("DELETE from Roles"); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@@ -670,8 +717,8 @@ func (*TestHelper) ResetRoleMigration() {
|
||||
}
|
||||
}
|
||||
|
||||
func (*TestHelper) ResetEmojisMigration() {
|
||||
sqlStore := mainHelper.GetSQLStore()
|
||||
func (th *TestHelper) ResetEmojisMigration() {
|
||||
sqlStore := th.SQLStore
|
||||
if _, err := sqlStore.GetMaster().Exec("UPDATE Roles SET Permissions=REPLACE(Permissions, ' create_emojis', '') WHERE builtin=True"); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@@ -852,3 +899,7 @@ func decodeJSON[T any](o any, result *T) *T {
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
func (th *TestHelper) Parallel(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ import (
|
||||
)
|
||||
|
||||
func TestImportImportScheme(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -223,6 +224,7 @@ func TestImportImportScheme(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestImportImportSchemeWithoutGuestRoles(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -411,6 +413,7 @@ func TestImportImportSchemeWithoutGuestRoles(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestImportImportRole(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -502,6 +505,7 @@ func TestImportImportRole(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestImportImportTeam(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -599,6 +603,7 @@ func TestImportImportTeam(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestImportImportChannel(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -745,6 +750,7 @@ func TestImportImportChannel(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestImportImportUser(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -1741,6 +1747,7 @@ func TestImportImportUser(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestImportUserTeams(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
team2 := th.CreateTeam()
|
||||
@@ -1963,6 +1970,7 @@ func TestImportUserTeams(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestImportUserChannels(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
channel2 := th.CreateChannel(th.Context, th.BasicTeam)
|
||||
@@ -2097,6 +2105,7 @@ func TestImportUserChannels(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestImportUserDefaultNotifyProps(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -2136,6 +2145,7 @@ func TestImportUserDefaultNotifyProps(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestImportimportMultiplePostLines(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -3195,6 +3205,7 @@ func TestImportimportMultiplePostLines(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestImportImportPost(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -3802,6 +3813,7 @@ func TestImportImportPost(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestImportImportDirectChannel(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
user3 := th.CreateUser()
|
||||
@@ -4173,6 +4185,7 @@ func TestImportImportDirectChannel(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestImportImportDirectPost(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -5120,6 +5133,7 @@ func TestImportImportDirectPost(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestImportImportEmoji(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -5171,6 +5185,7 @@ func TestImportImportEmoji(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestImportAttachment(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -5193,6 +5208,7 @@ func TestImportAttachment(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestImportPostAndRepliesWithAttachments(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -5434,6 +5450,7 @@ func TestImportPostAndRepliesWithAttachments(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestImportDirectPostWithAttachments(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -5561,6 +5578,7 @@ func TestImportDirectPostWithAttachments(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestZippedImportPostAndRepliesWithAttachments(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -5762,6 +5780,7 @@ func TestZippedImportPostAndRepliesWithAttachments(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCompareFilesContent(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
t.Run("empty", func(t *testing.T) {
|
||||
ok, err := compareFilesContent(strings.NewReader(""), strings.NewReader(""), 0)
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -67,6 +67,7 @@ func AssertChannelCount(t *testing.T, a *App, channelType model.ChannelType, exp
|
||||
}
|
||||
|
||||
func TestImportImportLine(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -115,6 +116,7 @@ func TestImportImportLine(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestStopOnError(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -145,6 +147,7 @@ func TestStopOnError(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestImportBulkImport(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -282,6 +285,7 @@ func TestImportBulkImport(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestImportProcessImportDataFileVersionLine(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
data := imports.LineImportData{
|
||||
Type: "version",
|
||||
Version: model.NewPointer(1),
|
||||
@@ -451,6 +455,7 @@ func TestProcessAttachmentPaths(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestProcessAttachments(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
c := request.TestContext(t)
|
||||
|
||||
genAttachments := func() *[]imports.AttachmentImportData {
|
||||
@@ -633,6 +638,7 @@ func BenchmarkBulkImport(b *testing.B) {
|
||||
}
|
||||
|
||||
func TestImportBulkImportWithAttachments(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ import (
|
||||
)
|
||||
|
||||
func TestGeneratePassword(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
t.Run("Should be the minimum length or 4, whichever is less", func(t *testing.T) {
|
||||
password1, err := generatePassword(5)
|
||||
require.NoError(t, err)
|
||||
|
||||
@@ -21,6 +21,7 @@ import (
|
||||
|
||||
// Test for MM-13598 where an invalid integration URL was causing a crash
|
||||
func TestPostActionInvalidURL(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -71,6 +72,7 @@ func TestPostActionInvalidURL(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPostActionEmptyResponse(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -172,6 +174,7 @@ func TestPostActionEmptyResponse(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPostAction(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
testCases := []struct {
|
||||
Description string
|
||||
Channel func(th *TestHelper) *model.Channel
|
||||
@@ -463,6 +466,7 @@ func TestPostAction(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPostActionProps(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -547,6 +551,7 @@ func TestPostActionProps(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSubmitInteractiveDialog(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -669,6 +674,7 @@ func TestSubmitInteractiveDialog(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPostActionRelativeURL(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -882,6 +888,7 @@ func TestPostActionRelativeURL(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPostActionRelativePluginURL(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -891,7 +898,7 @@ func TestPostActionRelativePluginURL(t *testing.T) {
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"encoding/json"
|
||||
"encoding/json"
|
||||
|
||||
"github.com/mattermost/mattermost/server/public/plugin"
|
||||
"github.com/mattermost/mattermost/server/public/model"
|
||||
@@ -1079,6 +1086,7 @@ func TestPostActionRelativePluginURL(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDoPluginRequest(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ import (
|
||||
)
|
||||
|
||||
func TestGetJob(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -36,6 +37,7 @@ func TestGetJob(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSessionHasPermissionToCreateJob(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -132,6 +134,7 @@ func TestSessionHasPermissionToCreateJob(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSessionHasPermissionToReadJob(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -217,6 +220,7 @@ func TestSessionHasPermissionToReadJob(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetJobByType(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -262,6 +266,7 @@ func TestGetJobByType(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetJobsByTypes(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ import (
|
||||
)
|
||||
|
||||
func TestLoadLicense(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -21,6 +22,7 @@ func TestLoadLicense(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSaveLicense(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -31,6 +33,7 @@ func TestSaveLicense(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestRemoveLicense(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -39,6 +42,7 @@ func TestRemoveLicense(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSetLicense(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -60,6 +64,7 @@ func TestSetLicense(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetSanitizedClientLicense(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ import (
|
||||
)
|
||||
|
||||
func TestGetServerLimits(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
t.Run("base case", func(t *testing.T) {
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -14,10 +14,11 @@ import (
|
||||
)
|
||||
|
||||
func TestCheckForClientSideCert(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
var tests = []struct {
|
||||
tests := []struct {
|
||||
pem string
|
||||
subject string
|
||||
expectedEmail string
|
||||
@@ -40,6 +41,7 @@ func TestCheckForClientSideCert(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCWSLogin(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
license := model.NewTestLicense()
|
||||
|
||||
@@ -5,13 +5,18 @@ package app
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"os"
|
||||
"strconv"
|
||||
"testing"
|
||||
|
||||
"github.com/mattermost/mattermost/server/public/shared/mlog"
|
||||
"github.com/mattermost/mattermost/server/v8/channels/testlib"
|
||||
)
|
||||
|
||||
var mainHelper *testlib.MainHelper
|
||||
var replicaFlag bool
|
||||
var (
|
||||
mainHelper *testlib.MainHelper
|
||||
replicaFlag bool
|
||||
)
|
||||
|
||||
func TestMain(m *testing.M) {
|
||||
if f := flag.Lookup("mysql-replica"); f == nil {
|
||||
@@ -19,10 +24,21 @@ func TestMain(m *testing.M) {
|
||||
flag.Parse()
|
||||
}
|
||||
|
||||
var options = testlib.HelperOptions{
|
||||
var parallelism int
|
||||
if f := flag.Lookup("test.parallel"); f != nil {
|
||||
parallelism, _ = strconv.Atoi(f.Value.String())
|
||||
}
|
||||
runParallel := os.Getenv("ENABLE_FULLY_PARALLEL_TESTS") == "true" && parallelism > 1
|
||||
if runParallel {
|
||||
mlog.Info("Fully parallel tests enabled", mlog.Int("parallelism", parallelism))
|
||||
}
|
||||
|
||||
options := testlib.HelperOptions{
|
||||
EnableStore: true,
|
||||
EnableResources: true,
|
||||
WithReadReplica: replicaFlag,
|
||||
RunParallel: runParallel,
|
||||
Parallelism: parallelism,
|
||||
}
|
||||
|
||||
mainHelper = testlib.NewMainHelperWithOptions(&options)
|
||||
|
||||
@@ -28,6 +28,7 @@ func mapsToMentionKeywords(userKeywords map[string][]string, groups map[string]*
|
||||
}
|
||||
|
||||
func TestMentionKeywords_AddUserProfile(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
t.Run("should add @user", func(t *testing.T) {
|
||||
user := &model.User{
|
||||
Id: model.NewId(),
|
||||
|
||||
@@ -11,6 +11,7 @@ import (
|
||||
)
|
||||
|
||||
func TestIsKeywordMultibyte(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
id1 := model.NewId()
|
||||
|
||||
for name, tc := range map[string]struct {
|
||||
@@ -116,6 +117,7 @@ func TestIsKeywordMultibyte(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCheckForMentionUsers(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
id1 := model.NewId()
|
||||
id2 := model.NewId()
|
||||
|
||||
@@ -213,6 +215,7 @@ func TestCheckForMentionUsers(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCheckForMentionGroups(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
groupID1 := model.NewId()
|
||||
groupID2 := model.NewId()
|
||||
|
||||
@@ -279,6 +282,7 @@ func TestCheckForMentionGroups(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestProcessText(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
userID1 := model.NewId()
|
||||
|
||||
groupID1 := model.NewId()
|
||||
|
||||
@@ -11,6 +11,7 @@ import (
|
||||
)
|
||||
|
||||
func TestAddMention(t *testing.T) {
|
||||
mainHelper.Parallel(t)
|
||||
t.Run("should initialize Mentions and store new mentions", func(t *testing.T) {
|
||||
m := &MentionResults{}
|
||||
|
||||
|
||||
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Ссылка в новой задаче
Block a user