Passing t to all tests setup functions (#13841)
* Passing t to all tests setup functions * Fixing build
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
3b732fe257
Коммит
1d1ab03c38
@@ -147,15 +147,15 @@ func setupTestHelper(enterprise bool, updateConfig func(*model.Config)) *TestHel
|
||||
return th
|
||||
}
|
||||
|
||||
func SetupEnterprise() *TestHelper {
|
||||
func SetupEnterprise(tb testing.TB) *TestHelper {
|
||||
return setupTestHelper(true, nil)
|
||||
}
|
||||
|
||||
func Setup() *TestHelper {
|
||||
func Setup(tb testing.TB) *TestHelper {
|
||||
return setupTestHelper(false, nil)
|
||||
}
|
||||
|
||||
func SetupConfig(updateConfig func(cfg *model.Config)) *TestHelper {
|
||||
func SetupConfig(tb testing.TB, updateConfig func(cfg *model.Config)) *TestHelper {
|
||||
return setupTestHelper(false, updateConfig)
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ import (
|
||||
|
||||
func TestCreateBot(t *testing.T) {
|
||||
t.Run("create bot without permissions", func(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) {
|
||||
@@ -37,7 +37,7 @@ func TestCreateBot(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("create bot without config permissions", func(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
th.AddPermissionToRole(model.PERMISSION_CREATE_BOT.Id, model.TEAM_USER_ROLE_ID)
|
||||
@@ -54,7 +54,7 @@ func TestCreateBot(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("create bot with permissions", func(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
defer th.RestoreDefaultRolePermissions(th.SaveDefaultRolePermissions())
|
||||
|
||||
@@ -80,7 +80,7 @@ func TestCreateBot(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("create invalid bot", func(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
th.AddPermissionToRole(model.PERMISSION_CREATE_BOT.Id, model.TEAM_USER_ROLE_ID)
|
||||
@@ -99,7 +99,7 @@ func TestCreateBot(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("bot attempt to create bot fails", func(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) {
|
||||
@@ -137,7 +137,7 @@ func TestCreateBot(t *testing.T) {
|
||||
|
||||
func TestPatchBot(t *testing.T) {
|
||||
t.Run("patch non-existent bot", func(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
defer th.RestoreDefaultRolePermissions(th.SaveDefaultRolePermissions())
|
||||
|
||||
@@ -146,7 +146,7 @@ func TestPatchBot(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("patch someone else's bot without permission", func(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
defer th.RestoreDefaultRolePermissions(th.SaveDefaultRolePermissions())
|
||||
|
||||
@@ -167,7 +167,7 @@ func TestPatchBot(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("patch someone else's bot without permission, but with read others permission", func(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
defer th.RestoreDefaultRolePermissions(th.SaveDefaultRolePermissions())
|
||||
|
||||
@@ -190,7 +190,7 @@ func TestPatchBot(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("patch someone else's bot with permission", func(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
defer th.RestoreDefaultRolePermissions(th.SaveDefaultRolePermissions())
|
||||
|
||||
@@ -223,7 +223,7 @@ func TestPatchBot(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("patch my bot without permission", func(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
defer th.RestoreDefaultRolePermissions(th.SaveDefaultRolePermissions())
|
||||
|
||||
@@ -252,7 +252,7 @@ func TestPatchBot(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("patch my bot without permission, but with read permission", func(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
defer th.RestoreDefaultRolePermissions(th.SaveDefaultRolePermissions())
|
||||
|
||||
@@ -282,7 +282,7 @@ func TestPatchBot(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("patch my bot with permission", func(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
defer th.RestoreDefaultRolePermissions(th.SaveDefaultRolePermissions())
|
||||
|
||||
@@ -316,7 +316,7 @@ func TestPatchBot(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("partial patch my bot with permission", func(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
defer th.RestoreDefaultRolePermissions(th.SaveDefaultRolePermissions())
|
||||
|
||||
@@ -350,7 +350,7 @@ func TestPatchBot(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("update bot, internally managed fields ignored", func(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
defer th.RestoreDefaultRolePermissions(th.SaveDefaultRolePermissions())
|
||||
|
||||
@@ -384,7 +384,7 @@ func TestPatchBot(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetBot(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) {
|
||||
@@ -528,7 +528,7 @@ func TestGetBot(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetBots(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) {
|
||||
@@ -753,7 +753,7 @@ func TestGetBots(t *testing.T) {
|
||||
|
||||
func TestDisableBot(t *testing.T) {
|
||||
t.Run("disable non-existent bot", func(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
_, resp := th.Client.DisableBot(model.NewId())
|
||||
@@ -761,7 +761,7 @@ func TestDisableBot(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("disable bot without permission", func(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
defer th.RestoreDefaultRolePermissions(th.SaveDefaultRolePermissions())
|
||||
|
||||
@@ -785,7 +785,7 @@ func TestDisableBot(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("disable bot without permission, but with read permission", func(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
defer th.RestoreDefaultRolePermissions(th.SaveDefaultRolePermissions())
|
||||
|
||||
@@ -810,7 +810,7 @@ func TestDisableBot(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("disable bot with permission", func(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
defer th.RestoreDefaultRolePermissions(th.SaveDefaultRolePermissions())
|
||||
|
||||
@@ -847,7 +847,7 @@ func TestDisableBot(t *testing.T) {
|
||||
}
|
||||
func TestEnableBot(t *testing.T) {
|
||||
t.Run("enable non-existent bot", func(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
_, resp := th.Client.EnableBot(model.NewId())
|
||||
@@ -855,7 +855,7 @@ func TestEnableBot(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("enable bot without permission", func(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
defer th.RestoreDefaultRolePermissions(th.SaveDefaultRolePermissions())
|
||||
|
||||
@@ -882,7 +882,7 @@ func TestEnableBot(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("enable bot without permission, but with read permission", func(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
defer th.RestoreDefaultRolePermissions(th.SaveDefaultRolePermissions())
|
||||
|
||||
@@ -910,7 +910,7 @@ func TestEnableBot(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("enable bot with permission", func(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
defer th.RestoreDefaultRolePermissions(th.SaveDefaultRolePermissions())
|
||||
|
||||
@@ -950,7 +950,7 @@ func TestEnableBot(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestAssignBot(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
t.Run("claim non-existent bot", func(t *testing.T) {
|
||||
@@ -1097,7 +1097,7 @@ func TestAssignBot(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSetBotIconImage(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
user := th.BasicUser
|
||||
|
||||
@@ -1167,7 +1167,7 @@ func TestSetBotIconImage(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetBotIconImage(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
defer th.RestoreDefaultRolePermissions(th.SaveDefaultRolePermissions())
|
||||
@@ -1229,7 +1229,7 @@ func TestGetBotIconImage(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDeleteBotIconImage(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
defer th.RestoreDefaultRolePermissions(th.SaveDefaultRolePermissions())
|
||||
|
||||
@@ -12,7 +12,7 @@ import (
|
||||
)
|
||||
|
||||
func TestGetBrandImage(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -28,7 +28,7 @@ func TestGetBrandImage(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUploadBrandImage(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -55,7 +55,7 @@ func TestUploadBrandImage(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDeleteBrandImage(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
data, err := testutils.ReadTestFile("test.png")
|
||||
|
||||
@@ -19,7 +19,7 @@ import (
|
||||
)
|
||||
|
||||
func TestCreateChannel(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
team := th.BasicTeam
|
||||
@@ -126,7 +126,7 @@ func TestCreateChannel(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUpdateChannel(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
team := th.BasicTeam
|
||||
@@ -228,7 +228,7 @@ func TestUpdateChannel(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPatchChannel(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -316,7 +316,7 @@ func TestPatchChannel(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCreateDirectChannel(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
user1 := th.BasicUser
|
||||
@@ -360,7 +360,7 @@ func TestCreateDirectChannel(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCreateDirectChannelAsGuest(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
user1 := th.BasicUser
|
||||
@@ -405,7 +405,7 @@ func TestCreateDirectChannelAsGuest(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDeleteDirectChannel(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
user := th.BasicUser
|
||||
@@ -422,7 +422,7 @@ func TestDeleteDirectChannel(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCreateGroupChannel(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
user := th.BasicUser
|
||||
@@ -479,7 +479,7 @@ func TestCreateGroupChannel(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCreateGroupChannelAsGuest(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
user1 := th.BasicUser
|
||||
@@ -540,7 +540,7 @@ func TestCreateGroupChannelAsGuest(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDeleteGroupChannel(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
user := th.BasicUser
|
||||
@@ -560,7 +560,7 @@ func TestDeleteGroupChannel(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetChannel(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -603,7 +603,7 @@ func TestGetChannel(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetDeletedChannelsForTeam(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
team := th.BasicTeam
|
||||
@@ -664,7 +664,7 @@ func TestGetDeletedChannelsForTeam(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetPublicChannelsForTeam(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
team := th.BasicTeam
|
||||
@@ -725,7 +725,7 @@ func TestGetPublicChannelsForTeam(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetPublicChannelsByIdsForTeam(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
teamId := th.BasicTeam.Id
|
||||
@@ -776,7 +776,7 @@ func TestGetPublicChannelsByIdsForTeam(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetChannelsForTeamForUser(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -820,7 +820,7 @@ func TestGetChannelsForTeamForUser(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetAllChannels(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -850,7 +850,7 @@ func TestGetAllChannels(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetAllChannelsWithCount(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -881,7 +881,7 @@ func TestGetAllChannelsWithCount(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSearchChannels(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -963,7 +963,7 @@ func TestSearchChannels(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSearchArchivedChannels(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -1057,7 +1057,7 @@ func TestSearchArchivedChannels(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSearchAllChannels(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -1088,7 +1088,7 @@ func TestSearchAllChannels(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSearchAllChannelsPaged(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -1106,7 +1106,7 @@ func TestSearchAllChannelsPaged(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSearchGroupChannels(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -1164,7 +1164,7 @@ func TestSearchGroupChannels(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDeleteChannel(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
team := th.BasicTeam
|
||||
@@ -1247,7 +1247,7 @@ func TestDeleteChannel(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDeleteChannel2(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
user := th.BasicUser
|
||||
@@ -1322,7 +1322,7 @@ func TestDeleteChannel2(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestConvertChannelToPrivate(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -1384,7 +1384,7 @@ func TestConvertChannelToPrivate(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUpdateChannelPrivacy(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -1446,7 +1446,7 @@ func TestUpdateChannelPrivacy(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestRestoreChannel(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -1472,7 +1472,7 @@ func TestRestoreChannel(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetChannelByName(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -1522,7 +1522,7 @@ func TestGetChannelByName(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetChannelByNameForTeamName(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -1557,7 +1557,7 @@ func TestGetChannelByNameForTeamName(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetChannelMembers(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -1600,7 +1600,7 @@ func TestGetChannelMembers(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetChannelMembersByIds(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -1638,7 +1638,7 @@ func TestGetChannelMembersByIds(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetChannelMember(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -1679,7 +1679,7 @@ func TestGetChannelMember(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetChannelMembersForUser(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -1719,7 +1719,7 @@ func TestGetChannelMembersForUser(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestViewChannel(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -1789,7 +1789,7 @@ func TestViewChannel(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetChannelUnread(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
user := th.BasicUser
|
||||
@@ -1830,7 +1830,7 @@ func TestGetChannelUnread(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetChannelStats(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
channel := th.CreatePrivateChannel()
|
||||
@@ -1867,7 +1867,7 @@ func TestGetChannelStats(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetPinnedPosts(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
channel := th.BasicChannel
|
||||
@@ -1900,7 +1900,7 @@ func TestGetPinnedPosts(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUpdateChannelRoles(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -1973,7 +1973,7 @@ func TestUpdateChannelRoles(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUpdateChannelMemberSchemeRoles(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
SystemAdminClient := th.SystemAdminClient
|
||||
WebSocketClient, err := th.CreateWebSocketClient()
|
||||
@@ -2097,7 +2097,7 @@ func TestUpdateChannelMemberSchemeRoles(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUpdateChannelNotifyProps(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -2138,7 +2138,7 @@ func TestUpdateChannelNotifyProps(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestAddChannelMember(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
user := th.BasicUser
|
||||
@@ -2304,7 +2304,7 @@ func TestAddChannelMember(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestAddChannelMemberAddMyself(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
user := th.CreateUser()
|
||||
@@ -2380,7 +2380,7 @@ func TestAddChannelMemberAddMyself(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestRemoveChannelMember(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
user1 := th.BasicUser
|
||||
user2 := th.BasicUser2
|
||||
team := th.BasicTeam
|
||||
@@ -2598,7 +2598,7 @@ func TestRemoveChannelMember(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestAutocompleteChannels(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
// A private channel to make sure private channels are not used
|
||||
@@ -2668,7 +2668,7 @@ func TestAutocompleteChannels(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestAutocompleteChannelsForSearch(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
th.LoginSystemAdminWithClient(th.SystemAdminClient)
|
||||
@@ -2779,7 +2779,7 @@ func TestAutocompleteChannelsForSearch(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUpdateChannelScheme(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
th.App.SetLicense(model.NewTestLicense(""))
|
||||
@@ -2855,7 +2855,7 @@ func TestUpdateChannelScheme(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetChannelMembersTimezones(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -2898,7 +2898,7 @@ func TestGetChannelMembersTimezones(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestChannelMembersMinusGroupMembers(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
user1 := th.BasicUser
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
)
|
||||
|
||||
func TestGetClusterStatus(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
t.Run("as system user", func(t *testing.T) {
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
)
|
||||
|
||||
func TestHelpCommand(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
Client := th.Client
|
||||
|
||||
@@ -17,7 +17,7 @@ import (
|
||||
)
|
||||
|
||||
func TestCreateCommand(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -62,7 +62,7 @@ func TestCreateCommand(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUpdateCommand(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.SystemAdminClient
|
||||
user := th.SystemAdminUser
|
||||
@@ -136,7 +136,7 @@ func TestUpdateCommand(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestMoveCommand(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.SystemAdminClient
|
||||
user := th.SystemAdminUser
|
||||
@@ -194,7 +194,7 @@ func TestMoveCommand(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDeleteCommand(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.SystemAdminClient
|
||||
user := th.SystemAdminUser
|
||||
@@ -251,7 +251,7 @@ func TestDeleteCommand(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestListCommands(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -341,7 +341,7 @@ func TestListCommands(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestListAutocompleteCommands(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -408,7 +408,7 @@ func TestListAutocompleteCommands(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetCommand(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -467,7 +467,7 @@ func TestGetCommand(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestRegenToken(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -498,7 +498,7 @@ func TestRegenToken(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestExecuteInvalidCommand(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
channel := th.BasicChannel
|
||||
@@ -560,7 +560,7 @@ func TestExecuteInvalidCommand(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestExecuteGetCommand(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
channel := th.BasicChannel
|
||||
@@ -621,7 +621,7 @@ func TestExecuteGetCommand(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestExecutePostCommand(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
channel := th.BasicChannel
|
||||
@@ -681,7 +681,7 @@ func TestExecutePostCommand(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestExecuteCommandAgainstChannelOnAnotherTeam(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
channel := th.BasicChannel
|
||||
@@ -731,7 +731,7 @@ func TestExecuteCommandAgainstChannelOnAnotherTeam(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestExecuteCommandAgainstChannelUserIsNotIn(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
|
||||
@@ -784,7 +784,7 @@ func TestExecuteCommandAgainstChannelUserIsNotIn(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestExecuteCommandInDirectMessageChannel(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
|
||||
@@ -843,7 +843,7 @@ func TestExecuteCommandInDirectMessageChannel(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestExecuteCommandInTeamUserIsNotOn(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ import (
|
||||
)
|
||||
|
||||
func TestEchoCommand(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
Client := th.Client
|
||||
@@ -34,7 +34,7 @@ func TestEchoCommand(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGroupmsgCommands(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
Client := th.Client
|
||||
@@ -74,7 +74,7 @@ func TestGroupmsgCommands(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestInvitePeopleCommand(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
Client := th.Client
|
||||
@@ -92,7 +92,7 @@ func TestInvitePeopleCommand(t *testing.T) {
|
||||
|
||||
// also used to test /open (see command_open_test.go)
|
||||
func testJoinCommands(t *testing.T, alias string) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
Client := th.Client
|
||||
@@ -134,7 +134,7 @@ func TestJoinCommands(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestLoadTestHelpCommands(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
Client := th.Client
|
||||
@@ -154,7 +154,7 @@ func TestLoadTestHelpCommands(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestLoadTestSetupCommands(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
Client := th.Client
|
||||
@@ -174,7 +174,7 @@ func TestLoadTestSetupCommands(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestLoadTestUsersCommands(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
Client := th.Client
|
||||
@@ -194,7 +194,7 @@ func TestLoadTestUsersCommands(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestLoadTestChannelsCommands(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
Client := th.Client
|
||||
@@ -214,7 +214,7 @@ func TestLoadTestChannelsCommands(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestLoadTestPostsCommands(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
Client := th.Client
|
||||
@@ -234,7 +234,7 @@ func TestLoadTestPostsCommands(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestLeaveCommands(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
Client := th.Client
|
||||
@@ -281,14 +281,14 @@ func TestLeaveCommands(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestLogoutTestCommand(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
th.Client.Must(th.Client.ExecuteCommand(th.BasicChannel.Id, "/logout"))
|
||||
}
|
||||
|
||||
func TestMeCommand(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
Client := th.Client
|
||||
@@ -313,7 +313,7 @@ func TestMeCommand(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestMsgCommands(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
Client := th.Client
|
||||
@@ -356,28 +356,28 @@ func TestOpenCommands(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSearchCommand(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
th.Client.Must(th.Client.ExecuteCommand(th.BasicChannel.Id, "/search"))
|
||||
}
|
||||
|
||||
func TestSettingsCommand(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
th.Client.Must(th.Client.ExecuteCommand(th.BasicChannel.Id, "/settings"))
|
||||
}
|
||||
|
||||
func TestShortcutsCommand(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
th.Client.Must(th.Client.ExecuteCommand(th.BasicChannel.Id, "/shortcuts"))
|
||||
}
|
||||
|
||||
func TestShrugCommand(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
Client := th.Client
|
||||
@@ -396,7 +396,7 @@ func TestShrugCommand(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestStatusCommands(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
commandAndTest(t, th, "away")
|
||||
|
||||
@@ -15,7 +15,7 @@ import (
|
||||
)
|
||||
|
||||
func TestGetConfig(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -52,7 +52,7 @@ func TestGetConfig(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestReloadConfig(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -78,7 +78,7 @@ func TestReloadConfig(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUpdateConfig(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -147,7 +147,7 @@ func TestUpdateConfig(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUpdateConfigMessageExportSpecialHandling(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
messageExportEnabled := *th.App.Config().MessageExportSettings.EnableExport
|
||||
@@ -215,7 +215,7 @@ func TestUpdateConfigMessageExportSpecialHandling(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUpdateConfigRestrictSystemAdmin(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ExperimentalSettings.RestrictSystemAdmin = true })
|
||||
|
||||
@@ -244,7 +244,7 @@ func TestGetEnvironmentConfig(t *testing.T) {
|
||||
defer os.Unsetenv("MM_SERVICESETTINGS_SITEURL")
|
||||
defer os.Unsetenv("MM_SERVICESETTINGS_ENABLECUSTOMEMOJI")
|
||||
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
t.Run("as system admin", func(t *testing.T) {
|
||||
@@ -301,7 +301,7 @@ func TestGetEnvironmentConfig(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetOldClientConfig(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
testKey := "supersecretkey"
|
||||
@@ -363,7 +363,7 @@ func TestGetOldClientConfig(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPatchConfig(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.Client
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@ func TestCORSRequestHandling(t *testing.T) {
|
||||
},
|
||||
} {
|
||||
t.Run(name, func(t *testing.T) {
|
||||
th := SetupConfig(func(cfg *model.Config) {
|
||||
th := SetupConfig(t, func(cfg *model.Config) {
|
||||
*cfg.ServiceSettings.AllowCorsFrom = testcase.AllowCorsFrom
|
||||
*cfg.ServiceSettings.CorsExposedHeaders = testcase.CorsExposedHeaders
|
||||
*cfg.ServiceSettings.CorsAllowCredentials = testcase.CorsAllowCredentials
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
)
|
||||
|
||||
func TestDataRetentionGetPolicy(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
_, resp := th.Client.GetDataRetentionPolicy()
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
)
|
||||
|
||||
func TestElasticsearchTest(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
t.Run("as system user", func(t *testing.T) {
|
||||
@@ -32,7 +32,7 @@ func TestElasticsearchTest(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestElasticsearchPurgeIndexes(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
t.Run("as system user", func(t *testing.T) {
|
||||
|
||||
@@ -18,7 +18,7 @@ import (
|
||||
)
|
||||
|
||||
func TestCreateEmoji(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -167,7 +167,7 @@ func TestCreateEmoji(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetEmojiList(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -236,7 +236,7 @@ func TestGetEmojiList(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDeleteEmoji(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -397,7 +397,7 @@ func TestDeleteEmoji(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetEmoji(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -424,7 +424,7 @@ func TestGetEmoji(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetEmojiByName(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -451,7 +451,7 @@ func TestGetEmojiByName(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetEmojiImage(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -542,7 +542,7 @@ func TestGetEmojiImage(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSearchEmoji(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -621,7 +621,7 @@ func TestSearchEmoji(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestAutocompleteEmoji(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
|
||||
@@ -182,7 +182,7 @@ func testUploadFilesMultipart(
|
||||
}
|
||||
|
||||
func TestUploadFiles(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
if *th.App.Config().FileSettings.DriverName == "" {
|
||||
t.Skip("skipping because no file driver is enabled")
|
||||
@@ -637,7 +637,7 @@ func TestUploadFiles(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetFile(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
channel := th.BasicChannel
|
||||
@@ -677,7 +677,7 @@ func TestGetFile(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetFileHeaders(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
Client := th.Client
|
||||
@@ -732,7 +732,7 @@ func TestGetFileHeaders(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetFileThumbnail(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
channel := th.BasicChannel
|
||||
@@ -777,7 +777,7 @@ func TestGetFileThumbnail(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetFileLink(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
channel := th.BasicChannel
|
||||
@@ -841,7 +841,7 @@ func TestGetFileLink(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetFilePreview(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
channel := th.BasicChannel
|
||||
@@ -885,7 +885,7 @@ func TestGetFilePreview(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetFileInfo(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
user := th.BasicUser
|
||||
@@ -938,7 +938,7 @@ func TestGetFileInfo(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetPublicFile(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
channel := th.BasicChannel
|
||||
|
||||
@@ -14,7 +14,7 @@ import (
|
||||
)
|
||||
|
||||
func TestGetGroup(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
id := model.NewId()
|
||||
@@ -59,7 +59,7 @@ func TestGetGroup(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPatchGroup(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
id := model.NewId()
|
||||
@@ -125,7 +125,7 @@ func TestPatchGroup(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestLinkGroupTeam(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
id := model.NewId()
|
||||
@@ -163,7 +163,7 @@ func TestLinkGroupTeam(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestLinkGroupChannel(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
id := model.NewId()
|
||||
@@ -202,7 +202,7 @@ func TestLinkGroupChannel(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUnlinkGroupTeam(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
id := model.NewId()
|
||||
@@ -246,7 +246,7 @@ func TestUnlinkGroupTeam(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUnlinkGroupChannel(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
id := model.NewId()
|
||||
@@ -296,7 +296,7 @@ func TestUnlinkGroupChannel(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetGroupTeam(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
id := model.NewId()
|
||||
@@ -350,7 +350,7 @@ func TestGetGroupTeam(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetGroupChannel(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
id := model.NewId()
|
||||
@@ -404,7 +404,7 @@ func TestGetGroupChannel(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetGroupTeams(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
id := model.NewId()
|
||||
@@ -453,7 +453,7 @@ func TestGetGroupTeams(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetGroupChannels(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
id := model.NewId()
|
||||
@@ -502,7 +502,7 @@ func TestGetGroupChannels(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPatchGroupTeam(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
id := model.NewId()
|
||||
@@ -567,7 +567,7 @@ func TestPatchGroupTeam(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPatchGroupChannel(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
id := model.NewId()
|
||||
@@ -641,7 +641,7 @@ func TestPatchGroupChannel(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetGroupsByChannel(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
id := model.NewId()
|
||||
@@ -708,7 +708,7 @@ func TestGetGroupsByChannel(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetGroupsByTeam(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
id := model.NewId()
|
||||
@@ -773,7 +773,7 @@ func TestGetGroupsByTeam(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetGroups(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
id := model.NewId()
|
||||
|
||||
@@ -65,7 +65,7 @@ func testAPIHandlerNoGzipMode(t *testing.T, name string, h http.Handler, token s
|
||||
}
|
||||
|
||||
func TestAPIHandlersWithGzip(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
api := Init(th.Server, th.Server.AppOptions, th.Server.Router)
|
||||
|
||||
@@ -17,7 +17,7 @@ import (
|
||||
)
|
||||
|
||||
func TestGetImage(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
// Prevent the test client from following a redirect
|
||||
|
||||
@@ -41,7 +41,7 @@ func (th *testHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func TestPostActionCookies(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -144,7 +144,7 @@ func TestPostActionCookies(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestOpenDialog(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -217,7 +217,7 @@ func TestOpenDialog(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSubmitDialog(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ import (
|
||||
)
|
||||
|
||||
func TestCreateJob(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
job := &model.Job{
|
||||
@@ -39,7 +39,7 @@ func TestCreateJob(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetJob(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
job := &model.Job{
|
||||
@@ -68,7 +68,7 @@ func TestGetJob(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetJobs(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
jobType := model.NewId()
|
||||
@@ -115,7 +115,7 @@ func TestGetJobs(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetJobsByType(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
jobType := model.NewId()
|
||||
@@ -173,7 +173,7 @@ func TestGetJobsByType(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCancelJob(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
jobs := []*model.Job{
|
||||
|
||||
@@ -12,7 +12,7 @@ import (
|
||||
)
|
||||
|
||||
func TestTestLdap(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
_, resp := th.SystemAdminClient.TestLdap()
|
||||
@@ -34,7 +34,7 @@ func TestTestLdap(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSyncLdap(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
_, resp := th.SystemAdminClient.SyncLdap()
|
||||
@@ -52,7 +52,7 @@ func TestSyncLdap(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetLdapGroups(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
_, resp := th.Client.GetLdapGroups()
|
||||
@@ -65,7 +65,7 @@ func TestGetLdapGroups(t *testing.T) {
|
||||
func TestLinkLdapGroup(t *testing.T) {
|
||||
const entryUUID string = "foo"
|
||||
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
_, resp := th.Client.LinkLdapGroup(entryUUID)
|
||||
@@ -78,7 +78,7 @@ func TestLinkLdapGroup(t *testing.T) {
|
||||
func TestUnlinkLdapGroup(t *testing.T) {
|
||||
const entryUUID string = "foo"
|
||||
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
_, resp := th.Client.UnlinkLdapGroup(entryUUID)
|
||||
|
||||
@@ -13,7 +13,7 @@ import (
|
||||
)
|
||||
|
||||
func TestGetOldClientLicense(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -46,7 +46,7 @@ func TestGetOldClientLicense(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUploadLicenseFile(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -78,7 +78,7 @@ func TestUploadLicenseFile(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestRemoveLicenseFile(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ import (
|
||||
)
|
||||
|
||||
func TestCreateOAuthApp(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
AdminClient := th.SystemAdminClient
|
||||
@@ -72,7 +72,7 @@ func TestCreateOAuthApp(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUpdateOAuthApp(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
AdminClient := th.SystemAdminClient
|
||||
@@ -188,7 +188,7 @@ func TestUpdateOAuthApp(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetOAuthApps(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
AdminClient := th.SystemAdminClient
|
||||
@@ -254,7 +254,7 @@ func TestGetOAuthApps(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetOAuthApp(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
AdminClient := th.SystemAdminClient
|
||||
@@ -318,7 +318,7 @@ func TestGetOAuthApp(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetOAuthAppInfo(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
AdminClient := th.SystemAdminClient
|
||||
@@ -382,7 +382,7 @@ func TestGetOAuthAppInfo(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDeleteOAuthApp(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
AdminClient := th.SystemAdminClient
|
||||
@@ -449,7 +449,7 @@ func TestDeleteOAuthApp(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestRegenerateOAuthAppSecret(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
AdminClient := th.SystemAdminClient
|
||||
@@ -517,7 +517,7 @@ func TestRegenerateOAuthAppSecret(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetAuthorizedOAuthAppsForUser(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
AdminClient := th.SystemAdminClient
|
||||
|
||||
@@ -15,7 +15,7 @@ import (
|
||||
)
|
||||
|
||||
func TestGetOpenGraphMetadata(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
Client := th.Client
|
||||
|
||||
@@ -30,7 +30,7 @@ import (
|
||||
)
|
||||
|
||||
func TestPlugin(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
statesJson, _ := json.Marshal(th.App.Config().PluginSettings.PluginStates)
|
||||
@@ -270,7 +270,7 @@ func TestPlugin(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestNotifyClusterPluginEvent(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
testCluster := &testlib.FakeClusterInterface{}
|
||||
@@ -383,7 +383,7 @@ func TestDisableOnRemove(t *testing.T) {
|
||||
|
||||
for _, tc := range testCases {
|
||||
t.Run(tc.Description, func(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) {
|
||||
@@ -465,7 +465,7 @@ func TestDisableOnRemove(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetMarketplacePlugins(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) {
|
||||
@@ -582,7 +582,7 @@ func TestGetInstalledMarketplacePlugins(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
|
||||
t.Run("marketplace client returns not-installed plugin", func(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
testServer := httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) {
|
||||
@@ -644,7 +644,7 @@ func TestGetInstalledMarketplacePlugins(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("marketplace client returns installed plugin", func(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) {
|
||||
@@ -728,7 +728,7 @@ func TestSearchGetMarketplacePlugins(t *testing.T) {
|
||||
testIconData := fmt.Sprintf("data:image/svg+xml;base64,%s", base64.StdEncoding.EncodeToString(testIcon))
|
||||
|
||||
t.Run("search installed plugin", func(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
testServer := httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) {
|
||||
@@ -824,7 +824,7 @@ func TestSearchGetMarketplacePlugins(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetLocalPluginInMarketplace(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
samplePlugins := []*model.MarketplacePlugin{
|
||||
@@ -988,7 +988,7 @@ func TestGetLocalPluginInMarketplace(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetPrepackagedPluginInMarketplace(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
marketplacePlugins := []*model.MarketplacePlugin{
|
||||
@@ -1095,7 +1095,7 @@ func TestGetPrepackagedPluginInMarketplace(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestInstallMarketplacePlugin(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) {
|
||||
@@ -1303,7 +1303,7 @@ func TestInstallMarketplacePlugin(t *testing.T) {
|
||||
err = utils.CopyFile(filepath.Join(path, "testplugin.tar.gz.asc"), filepath.Join(prepackagedPluginsDir, "testplugin.tar.gz.sig"))
|
||||
require.NoError(t, err)
|
||||
|
||||
th := SetupConfig(func(cfg *model.Config) {
|
||||
th := SetupConfig(t, func(cfg *model.Config) {
|
||||
// Disable auto-installing prepackaged plugins
|
||||
*cfg.PluginSettings.AutomaticPrepackagedPlugins = false
|
||||
}).InitBasic()
|
||||
@@ -1434,7 +1434,7 @@ func TestInstallMarketplacePlugin(t *testing.T) {
|
||||
err = utils.CopyFile(filepath.Join(path, "testplugin.tar.gz"), filepath.Join(prepackagedPluginsDir, "testplugin.tar.gz"))
|
||||
require.NoError(t, err)
|
||||
|
||||
th := SetupConfig(func(cfg *model.Config) {
|
||||
th := SetupConfig(t, func(cfg *model.Config) {
|
||||
// Disable auto-installing prepackged plugins
|
||||
*cfg.PluginSettings.AutomaticPrepackagedPlugins = false
|
||||
}).InitBasic()
|
||||
|
||||
@@ -25,7 +25,7 @@ import (
|
||||
)
|
||||
|
||||
func TestCreatePost(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -150,7 +150,7 @@ func TestCreatePost(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCreatePostEphemeral(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.SystemAdminClient
|
||||
|
||||
@@ -185,7 +185,7 @@ func testCreatePostWithOutgoingHook(
|
||||
triggerWhen int,
|
||||
commentPostType bool,
|
||||
) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
user := th.SystemAdminUser
|
||||
team := th.BasicTeam
|
||||
@@ -365,7 +365,7 @@ func TestCreatePostWithOutgoingHook_no_content_type(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCreatePostPublic(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -410,7 +410,7 @@ func TestCreatePostPublic(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCreatePostAll(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -465,7 +465,7 @@ func TestCreatePostAll(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCreatePostSendOutOfChannelMentions(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -526,7 +526,7 @@ func TestCreatePostSendOutOfChannelMentions(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCreatePostCheckOnlineStatus(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
api := Init(th.Server, th.Server.AppOptions, th.Server.Router)
|
||||
@@ -561,7 +561,7 @@ func TestCreatePostCheckOnlineStatus(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUpdatePost(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
channel := th.BasicChannel
|
||||
@@ -722,7 +722,7 @@ func TestUpdateOthersPostInDirectMessageChannel(t *testing.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.
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
dmChannel := th.CreateDmChannel(th.SystemAdminUser)
|
||||
@@ -744,7 +744,7 @@ func TestUpdateOthersPostInDirectMessageChannel(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPatchPost(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
channel := th.BasicChannel
|
||||
@@ -853,7 +853,7 @@ func TestPatchPost(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPinPost(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -898,7 +898,7 @@ func TestPinPost(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUnpinPost(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -927,7 +927,7 @@ func TestUnpinPost(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetPostsForChannel(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -1076,7 +1076,7 @@ func TestGetPostsForChannel(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetFlaggedPostsForUser(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
user := th.BasicUser
|
||||
@@ -1247,7 +1247,7 @@ func TestGetFlaggedPostsForUser(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetPostsBefore(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -1389,7 +1389,7 @@ func TestGetPostsBefore(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetPostsAfter(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -1512,7 +1512,7 @@ func TestGetPostsAfter(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetPostsForChannelAroundLastUnread(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
userId := th.BasicUser.Id
|
||||
@@ -1759,7 +1759,7 @@ func TestGetPostsForChannelAroundLastUnread(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetPost(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -1806,7 +1806,7 @@ func TestGetPost(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDeletePost(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -1842,7 +1842,7 @@ func TestDeletePost(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetPostThread(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -1895,7 +1895,7 @@ func TestGetPostThread(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSearchPosts(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
experimentalViewArchivedChannels := *th.App.Config().TeamSettings.ExperimentalViewArchivedChannels
|
||||
defer func() {
|
||||
@@ -2024,7 +2024,7 @@ func TestSearchPosts(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSearchHashtagPosts(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
th.LoginBasic()
|
||||
Client := th.Client
|
||||
@@ -2048,7 +2048,7 @@ func TestSearchHashtagPosts(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSearchPostsInChannel(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
th.LoginBasic()
|
||||
Client := th.Client
|
||||
@@ -2102,7 +2102,7 @@ func TestSearchPostsInChannel(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSearchPostsFromUser(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -2158,7 +2158,7 @@ func TestSearchPostsFromUser(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSearchPostsWithDateFlags(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
th.LoginBasic()
|
||||
Client := th.Client
|
||||
@@ -2210,7 +2210,7 @@ func TestSearchPostsWithDateFlags(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetFileInfosForPost(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -2262,7 +2262,7 @@ func TestGetFileInfosForPost(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSetChannelUnread(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
u1 := th.BasicUser
|
||||
|
||||
@@ -14,7 +14,7 @@ import (
|
||||
)
|
||||
|
||||
func TestGetPreferences(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -66,7 +66,7 @@ func TestGetPreferences(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetPreferencesByCategory(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -121,7 +121,7 @@ func TestGetPreferencesByCategory(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetPreferenceByCategoryAndName(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -176,7 +176,7 @@ func TestGetPreferenceByCategoryAndName(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUpdatePreferences(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -235,7 +235,7 @@ func TestUpdatePreferences(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUpdatePreferencesWebsocket(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
WebSocketClient, err := th.CreateWebSocketClient()
|
||||
@@ -291,7 +291,7 @@ func TestUpdatePreferencesWebsocket(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDeletePreferences(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -338,7 +338,7 @@ func TestDeletePreferences(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDeletePreferencesWebsocket(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
userId := th.BasicUser.Id
|
||||
|
||||
@@ -13,7 +13,7 @@ import (
|
||||
)
|
||||
|
||||
func TestSaveReaction(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
userId := th.BasicUser.Id
|
||||
@@ -206,7 +206,7 @@ func TestSaveReaction(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetReactions(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
userId := th.BasicUser.Id
|
||||
@@ -285,7 +285,7 @@ func TestGetReactions(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDeleteReaction(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
userId := th.BasicUser.Id
|
||||
@@ -546,7 +546,7 @@ func TestDeleteReaction(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetBulkReactions(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
userId := th.BasicUser.Id
|
||||
|
||||
@@ -14,7 +14,7 @@ import (
|
||||
)
|
||||
|
||||
func TestGetRole(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
role := &model.Role{
|
||||
@@ -47,7 +47,7 @@ func TestGetRole(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetRoleByName(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
role := &model.Role{
|
||||
@@ -80,7 +80,7 @@ func TestGetRoleByName(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetRolesByNames(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
role1 := &model.Role{
|
||||
@@ -143,7 +143,7 @@ func TestGetRolesByNames(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPatchRole(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
role := &model.Role{
|
||||
|
||||
@@ -13,7 +13,7 @@ import (
|
||||
)
|
||||
|
||||
func TestGetSamlMetadata(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -24,7 +24,7 @@ func TestGetSamlMetadata(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSamlCompleteCSRFPass(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
url := th.Client.Url + "/login/sso/saml"
|
||||
|
||||
@@ -14,7 +14,7 @@ import (
|
||||
)
|
||||
|
||||
func TestCreateScheme(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
th.App.SetLicense(model.NewTestLicense("custom_permissions_schemes"))
|
||||
@@ -161,7 +161,7 @@ func TestCreateScheme(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetScheme(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
th.App.SetLicense(model.NewTestLicense("custom_permissions_schemes"))
|
||||
@@ -223,7 +223,7 @@ func TestGetScheme(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetSchemes(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
th.App.SetLicense(model.NewTestLicense("custom_permissions_schemes"))
|
||||
@@ -286,7 +286,7 @@ func TestGetSchemes(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetTeamsForScheme(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
th.App.SetLicense(model.NewTestLicense("custom_permissions_schemes"))
|
||||
@@ -378,7 +378,7 @@ func TestGetTeamsForScheme(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetChannelsForScheme(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
th.App.SetLicense(model.NewTestLicense("custom_permissions_schemes"))
|
||||
@@ -472,7 +472,7 @@ func TestGetChannelsForScheme(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPatchScheme(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
th.App.SetLicense(model.NewTestLicense("custom_permissions_schemes"))
|
||||
@@ -579,7 +579,7 @@ func TestPatchScheme(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDeleteScheme(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
t.Run("ValidTeamScheme", func(t *testing.T) {
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
)
|
||||
|
||||
func TestGetUserStatus(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -56,7 +56,7 @@ func TestGetUserStatus(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetUsersStatusesByIds(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -99,7 +99,7 @@ func TestGetUsersStatusesByIds(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUpdateUserStatus(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ import (
|
||||
)
|
||||
|
||||
func TestGetPing(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
t.Run("basic ping", func(t *testing.T) {
|
||||
@@ -66,7 +66,7 @@ func TestGetPing(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetAudits(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -94,7 +94,7 @@ func TestGetAudits(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestEmailTest(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -148,7 +148,7 @@ func TestEmailTest(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSiteURLTest(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -189,7 +189,7 @@ func TestSiteURLTest(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDatabaseRecycle(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -212,7 +212,7 @@ func TestDatabaseRecycle(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestInvalidateCaches(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -238,7 +238,7 @@ func TestInvalidateCaches(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetLogs(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -271,7 +271,7 @@ func TestGetLogs(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPostLog(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -312,7 +312,7 @@ func TestPostLog(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetAnalyticsOld(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -380,7 +380,7 @@ func TestGetAnalyticsOld(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestS3TestConnection(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -447,7 +447,7 @@ func TestS3TestConnection(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSupportedTimezones(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -470,7 +470,7 @@ func TestRedirectLocation(t *testing.T) {
|
||||
|
||||
mockBitlyLink := testServer.URL
|
||||
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
enableLinkPreviews := *th.App.Config().ServiceSettings.EnableLinkPreviews
|
||||
@@ -515,7 +515,7 @@ func TestRedirectLocation(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSetServerBusy(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
const secs = 30
|
||||
@@ -536,7 +536,7 @@ func TestSetServerBusy(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSetServerBusyInvalidParam(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
t.Run("as system admin, invalid param", func(t *testing.T) {
|
||||
@@ -551,7 +551,7 @@ func TestSetServerBusyInvalidParam(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestClearServerBusy(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
th.App.Srv.Busy.Set(time.Second * 30)
|
||||
@@ -572,7 +572,7 @@ func TestClearServerBusy(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetServerBusyExpires(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
th.App.Srv.Busy.Set(time.Second * 30)
|
||||
@@ -590,7 +590,7 @@ func TestGetServerBusyExpires(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestServerBusy503(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
th.App.Srv.Busy.Set(time.Second * 30)
|
||||
@@ -629,7 +629,7 @@ func TestServerBusy503(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPushNotificationAck(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
api := Init(th.Server, th.Server.AppOptions, th.Server.Router)
|
||||
session, _ := th.App.GetSession(th.Client.AuthToken)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -22,7 +22,7 @@ import (
|
||||
)
|
||||
|
||||
func TestCreateTeam(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -84,7 +84,7 @@ func TestCreateTeam(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCreateTeamSanitization(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
// Non-admin users can create a team, but they become a team admin by doing so
|
||||
@@ -121,7 +121,7 @@ func TestCreateTeamSanitization(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetTeam(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
team := th.BasicTeam
|
||||
@@ -166,7 +166,7 @@ func TestGetTeam(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetTeamSanitization(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
team, resp := th.Client.CreateTeam(&model.Team{
|
||||
@@ -223,7 +223,7 @@ func TestGetTeamSanitization(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetTeamUnread(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -253,7 +253,7 @@ func TestGetTeamUnread(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUpdateTeam(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -340,7 +340,7 @@ func TestUpdateTeam(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUpdateTeamSanitization(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
team, resp := th.Client.CreateTeam(&model.Team{
|
||||
@@ -372,7 +372,7 @@ func TestUpdateTeamSanitization(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPatchTeam(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -428,7 +428,7 @@ func TestPatchTeam(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPatchTeamSanitization(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
team, resp := th.Client.CreateTeam(&model.Team{
|
||||
@@ -460,7 +460,7 @@ func TestPatchTeamSanitization(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestRegenerateTeamInviteId(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -478,7 +478,7 @@ func TestRegenerateTeamInviteId(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSoftDeleteTeam(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -512,7 +512,7 @@ func TestSoftDeleteTeam(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPermanentDeleteTeam(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -551,7 +551,7 @@ func TestPermanentDeleteTeam(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetAllTeams(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -696,7 +696,7 @@ func TestGetAllTeams(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetAllTeamsSanitization(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
team, resp := th.Client.CreateTeam(&model.Team{
|
||||
@@ -757,7 +757,7 @@ func TestGetAllTeamsSanitization(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetTeamByName(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
team := th.BasicTeam
|
||||
@@ -802,7 +802,7 @@ func TestGetTeamByName(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetTeamByNameSanitization(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
team, resp := th.Client.CreateTeam(&model.Team{
|
||||
@@ -860,7 +860,7 @@ func TestGetTeamByNameSanitization(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSearchAllTeams(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
oTeam := th.BasicTeam
|
||||
@@ -922,7 +922,7 @@ func TestSearchAllTeams(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSearchAllTeamsPaged(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
commonRandom := model.NewId()
|
||||
teams := [3]*model.Team{}
|
||||
@@ -995,7 +995,7 @@ func TestSearchAllTeamsPaged(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSearchAllTeamsSanitization(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
team, resp := th.Client.CreateTeam(&model.Team{
|
||||
@@ -1065,7 +1065,7 @@ func TestSearchAllTeamsSanitization(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetTeamsForUser(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -1104,7 +1104,7 @@ func TestGetTeamsForUser(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetTeamsForUserSanitization(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
team, resp := th.Client.CreateTeam(&model.Team{
|
||||
@@ -1191,7 +1191,7 @@ func TestGetTeamsForUserSanitization(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetTeamMember(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
team := th.BasicTeam
|
||||
@@ -1224,7 +1224,7 @@ func TestGetTeamMember(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetTeamMembers(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
team := th.BasicTeam
|
||||
@@ -1280,7 +1280,7 @@ func TestGetTeamMembers(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetTeamMembersForUser(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -1316,7 +1316,7 @@ func TestGetTeamMembersForUser(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetTeamMembersByIds(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -1348,7 +1348,7 @@ func TestGetTeamMembersByIds(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestAddTeamMember(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
team := th.BasicTeam
|
||||
@@ -1562,7 +1562,7 @@ func TestAddTeamMember(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestAddTeamMemberMyself(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -1652,7 +1652,7 @@ func TestAddTeamMemberMyself(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestAddTeamMembersDomainConstrained(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
client := th.SystemAdminClient
|
||||
team := th.BasicTeam
|
||||
@@ -1712,7 +1712,7 @@ func TestAddTeamMembersDomainConstrained(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestAddTeamMembers(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
team := th.BasicTeam
|
||||
@@ -1839,7 +1839,7 @@ func TestAddTeamMembers(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestRemoveTeamMember(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -1894,7 +1894,7 @@ func TestRemoveTeamMember(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetTeamStats(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
team := th.BasicTeam
|
||||
@@ -1939,7 +1939,7 @@ func TestGetTeamStats(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUpdateTeamMemberRoles(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
SystemAdminClient := th.SystemAdminClient
|
||||
@@ -2013,7 +2013,7 @@ func TestUpdateTeamMemberRoles(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUpdateTeamMemberSchemeRoles(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
SystemAdminClient := th.SystemAdminClient
|
||||
th.LoginBasic()
|
||||
@@ -2118,7 +2118,7 @@ func TestUpdateTeamMemberSchemeRoles(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetMyTeamsUnread(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -2145,7 +2145,7 @@ func TestGetMyTeamsUnread(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestTeamExists(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
public_member_team := th.BasicTeam
|
||||
@@ -2239,7 +2239,7 @@ func TestTeamExists(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestImportTeam(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
t.Run("ImportTeam", func(t *testing.T) {
|
||||
@@ -2300,7 +2300,7 @@ func TestImportTeam(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestInviteUsersToTeam(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
user1 := th.GenerateTestEmail()
|
||||
@@ -2401,7 +2401,7 @@ func TestInviteUsersToTeam(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestInviteGuestsToTeam(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
guest1 := th.GenerateTestEmail()
|
||||
@@ -2510,7 +2510,7 @@ func TestInviteGuestsToTeam(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetTeamInviteInfo(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
team := th.BasicTeam
|
||||
@@ -2534,7 +2534,7 @@ func TestGetTeamInviteInfo(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSetTeamIcon(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
team := th.BasicTeam
|
||||
@@ -2592,7 +2592,7 @@ func TestSetTeamIcon(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetTeamIcon(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
team := th.BasicTeam
|
||||
@@ -2608,7 +2608,7 @@ func TestGetTeamIcon(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestRemoveTeamIcon(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
team := th.BasicTeam
|
||||
@@ -2641,7 +2641,7 @@ func TestRemoveTeamIcon(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUpdateTeamScheme(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
th.App.SetLicense(model.NewTestLicense(""))
|
||||
@@ -2712,7 +2712,7 @@ func TestUpdateTeamScheme(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestTeamMembersMinusGroupMembers(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
user1 := th.BasicUser
|
||||
|
||||
@@ -12,7 +12,7 @@ import (
|
||||
)
|
||||
|
||||
func TestGetTermsOfService(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -29,7 +29,7 @@ func TestGetTermsOfService(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCreateTermsOfService(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -38,7 +38,7 @@ func TestCreateTermsOfService(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCreateTermsOfServiceAdminUser(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.SystemAdminClient
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ import (
|
||||
)
|
||||
|
||||
func TestCreateUser(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
user := model.User{Email: th.GenerateTestEmail(), Nickname: "Corey Hulen", Password: "hello1", Username: GenerateTestUsername(), Roles: model.SYSTEM_ADMIN_ROLE_ID + " " + model.SYSTEM_USER_ROLE_ID}
|
||||
@@ -77,7 +77,7 @@ func TestCreateUser(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCreateUserInputFilter(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
t.Run("DomainRestriction", func(t *testing.T) {
|
||||
@@ -146,7 +146,7 @@ func TestCreateUserInputFilter(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCreateUserWithToken(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
t.Run("CreateWithTokenHappyPath", func(t *testing.T) {
|
||||
@@ -267,7 +267,7 @@ func TestCreateUserWithToken(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCreateUserWebSocketEvent(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
t.Run("guest should not received new_user event but user should", func(t *testing.T) {
|
||||
@@ -343,7 +343,7 @@ func TestCreateUserWebSocketEvent(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCreateUserWithInviteId(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
t.Run("CreateWithInviteIdHappyPath", func(t *testing.T) {
|
||||
@@ -454,7 +454,7 @@ func TestCreateUserWithInviteId(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetMe(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
ruser, resp := th.Client.GetMe("")
|
||||
@@ -468,7 +468,7 @@ func TestGetMe(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetUser(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
user := th.CreateUser()
|
||||
@@ -518,7 +518,7 @@ func TestGetUser(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetUserWithAcceptedTermsOfServiceForOtherUser(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
user := th.CreateUser()
|
||||
@@ -548,7 +548,7 @@ func TestGetUserWithAcceptedTermsOfServiceForOtherUser(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetUserWithAcceptedTermsOfService(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
user := th.BasicUser
|
||||
@@ -576,7 +576,7 @@ func TestGetUserWithAcceptedTermsOfService(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetUserWithAcceptedTermsOfServiceWithAdminUser(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
th.LoginSystemAdmin()
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -605,7 +605,7 @@ func TestGetUserWithAcceptedTermsOfServiceWithAdminUser(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetBotUser(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
defer th.RestoreDefaultRolePermissions(th.SaveDefaultRolePermissions())
|
||||
@@ -634,7 +634,7 @@ func TestGetBotUser(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetUserByUsername(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
user := th.BasicUser
|
||||
@@ -678,7 +678,7 @@ func TestGetUserByUsername(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetUserByUsernameWithAcceptedTermsOfService(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
user := th.BasicUser
|
||||
@@ -702,7 +702,7 @@ func TestGetUserByUsernameWithAcceptedTermsOfService(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetUserByEmail(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
user := th.CreateUser()
|
||||
@@ -817,7 +817,7 @@ func TestGetUserByEmail(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSearchUsers(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
search := &model.UserSearch{Term: th.BasicUser.Username}
|
||||
@@ -969,7 +969,7 @@ func findUserInList(id string, users []*model.User) bool {
|
||||
}
|
||||
|
||||
func TestAutocompleteUsersInChannel(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
teamId := th.BasicTeam.Id
|
||||
channelId := th.BasicChannel.Id
|
||||
@@ -1091,7 +1091,7 @@ func TestAutocompleteUsersInChannel(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestAutocompleteUsersInTeam(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
teamId := th.BasicTeam.Id
|
||||
username := th.BasicUser.Username
|
||||
@@ -1160,7 +1160,7 @@ func TestAutocompleteUsersInTeam(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestAutocompleteUsers(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
username := th.BasicUser.Username
|
||||
newUser := th.CreateUser()
|
||||
@@ -1225,7 +1225,7 @@ func TestAutocompleteUsers(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetProfileImage(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
user := th.BasicUser
|
||||
|
||||
@@ -1255,7 +1255,7 @@ func TestGetProfileImage(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetUsersByIds(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
t.Run("should return the user", func(t *testing.T) {
|
||||
@@ -1298,7 +1298,7 @@ func TestGetUsersByIds(t *testing.T) {
|
||||
|
||||
func TestGetUsersByIdsWithOptions(t *testing.T) {
|
||||
t.Run("should only return specified users that have been updated since the given time", func(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
// Users before the timestamp shouldn't be returned
|
||||
@@ -1323,7 +1323,7 @@ func TestGetUsersByIdsWithOptions(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetUsersByGroupChannelIds(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
gc1, err := th.App.CreateGroupChannel([]string{th.BasicUser.Id, th.SystemAdminUser.Id, th.TeamAdminUser.Id}, th.BasicUser.Id)
|
||||
@@ -1354,7 +1354,7 @@ func TestGetUsersByGroupChannelIds(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetUsersByUsernames(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
users, resp := th.Client.GetUsersByUsernames([]string{th.BasicUser.Username})
|
||||
@@ -1380,7 +1380,7 @@ func TestGetUsersByUsernames(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetTotalUsersStat(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
total, _ := th.Server.Store.User().Count(model.UserCountOptions{
|
||||
@@ -1395,7 +1395,7 @@ func TestGetTotalUsersStat(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUpdateUser(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
user := th.CreateUser()
|
||||
@@ -1456,7 +1456,7 @@ func TestUpdateUser(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPatchUser(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
user := th.CreateUser()
|
||||
@@ -1550,7 +1550,7 @@ func TestPatchUser(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUpdateUserAuth(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
team := th.CreateTeamWithClient(th.SystemAdminClient)
|
||||
@@ -1604,7 +1604,7 @@ func TestUpdateUserAuth(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDeleteUser(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
user := th.BasicUser
|
||||
@@ -1649,7 +1649,7 @@ func TestDeleteUser(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUpdateUserRoles(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
_, resp := th.Client.UpdateUserRoles(th.SystemAdminUser.Id, model.SYSTEM_USER_ROLE_ID)
|
||||
@@ -1696,7 +1696,7 @@ func assertWebsocketEventUserUpdatedWithEmail(t *testing.T, client *model.WebSoc
|
||||
|
||||
func TestUpdateUserActive(t *testing.T) {
|
||||
t.Run("basic tests", func(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
user := th.BasicUser
|
||||
@@ -1750,7 +1750,7 @@ func TestUpdateUserActive(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("websocket events", func(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
user := th.BasicUser2
|
||||
@@ -1795,7 +1795,7 @@ func TestUpdateUserActive(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("activate guest should fail when guests feature is disable", func(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
id := model.NewId()
|
||||
@@ -1817,7 +1817,7 @@ func TestUpdateUserActive(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("activate guest should work when guests feature is enabled", func(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
id := model.NewId()
|
||||
@@ -1839,7 +1839,7 @@ func TestUpdateUserActive(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetUsers(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
rusers, resp := th.Client.GetUsers(0, 60, "")
|
||||
@@ -1870,7 +1870,7 @@ func TestGetUsers(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetNewUsersInTeam(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
teamId := th.BasicTeam.Id
|
||||
|
||||
@@ -1894,7 +1894,7 @@ func TestGetNewUsersInTeam(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetRecentlyActiveUsersInTeam(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
teamId := th.BasicTeam.Id
|
||||
|
||||
@@ -1918,7 +1918,7 @@ func TestGetRecentlyActiveUsersInTeam(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetUsersWithoutTeam(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
_, resp := th.Client.GetUsersWithoutTeam(0, 100, "")
|
||||
@@ -1962,7 +1962,7 @@ func TestGetUsersWithoutTeam(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetUsersInTeam(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
teamId := th.BasicTeam.Id
|
||||
|
||||
@@ -2001,7 +2001,7 @@ func TestGetUsersInTeam(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetUsersNotInTeam(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
teamId := th.BasicTeam.Id
|
||||
|
||||
@@ -2041,7 +2041,7 @@ func TestGetUsersNotInTeam(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetUsersInChannel(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
channelId := th.BasicChannel.Id
|
||||
|
||||
@@ -2077,7 +2077,7 @@ func TestGetUsersInChannel(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetUsersNotInChannel(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
teamId := th.BasicTeam.Id
|
||||
channelId := th.BasicChannel.Id
|
||||
@@ -2112,7 +2112,7 @@ func TestGetUsersNotInChannel(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUpdateUserMfa(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
th.App.SetLicense(model.NewTestLicense("mfa"))
|
||||
@@ -2128,7 +2128,7 @@ func TestUpdateUserMfa(t *testing.T) {
|
||||
|
||||
// CheckUserMfa is deprecated and should not be used anymore, it will be disabled by default in version 6.0
|
||||
func TestCheckUserMfa(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
th.App.UpdateConfig(func(c *model.Config) {
|
||||
@@ -2176,7 +2176,7 @@ func TestCheckUserMfa(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUserLoginMFAFlow(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
th.App.UpdateConfig(func(c *model.Config) {
|
||||
@@ -2242,7 +2242,7 @@ func TestUserLoginMFAFlow(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGenerateMfaSecret(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableMultifactorAuthentication = false })
|
||||
@@ -2276,7 +2276,7 @@ func TestGenerateMfaSecret(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUpdateUserPassword(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
password := "newpassword1"
|
||||
@@ -2341,7 +2341,7 @@ func TestUpdateUserPassword(t *testing.T) {
|
||||
func TestResetPassword(t *testing.T) {
|
||||
t.Skip("test disabled during old build server changes, should be investigated")
|
||||
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
th.Client.Logout()
|
||||
user := th.BasicUser
|
||||
@@ -2409,7 +2409,7 @@ func TestResetPassword(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetSessions(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
user := th.BasicUser
|
||||
@@ -2446,7 +2446,7 @@ func TestGetSessions(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestRevokeSessions(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
user := th.BasicUser
|
||||
@@ -2498,7 +2498,7 @@ func TestRevokeSessions(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestRevokeAllSessions(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
user := th.BasicUser
|
||||
@@ -2534,7 +2534,7 @@ func TestRevokeAllSessions(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestRevokeSessionsFromAllUsers(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
user := th.BasicUser
|
||||
@@ -2574,7 +2574,7 @@ func TestRevokeSessionsFromAllUsers(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestAttachDeviceId(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
deviceId := model.PUSH_NOTIFY_APPLE + ":1234567890"
|
||||
@@ -2624,7 +2624,7 @@ func TestAttachDeviceId(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetUserAudits(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
user := th.BasicUser
|
||||
|
||||
@@ -2646,7 +2646,7 @@ func TestGetUserAudits(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestVerifyUserEmail(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
email := th.GenerateTestEmail()
|
||||
@@ -2668,7 +2668,7 @@ func TestVerifyUserEmail(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSendVerificationEmail(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
pass, resp := th.Client.SendVerificationEmail(th.BasicUser.Email)
|
||||
@@ -2689,7 +2689,7 @@ func TestSendVerificationEmail(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSetProfileImage(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
user := th.BasicUser
|
||||
|
||||
@@ -2732,7 +2732,7 @@ func TestSetProfileImage(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSetDefaultProfileImage(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
user := th.BasicUser
|
||||
|
||||
@@ -2769,7 +2769,7 @@ func TestSetDefaultProfileImage(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestLogin(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
th.Client.Logout()
|
||||
|
||||
@@ -2831,7 +2831,7 @@ func TestLogin(t *testing.T) {
|
||||
|
||||
func TestLoginCookies(t *testing.T) {
|
||||
t.Run("should return cookies with X-Requested-With header", func(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
th.Client.HttpHeader[model.HEADER_REQUESTED_WITH] = model.HEADER_REQUESTED_WITH_XML
|
||||
@@ -2860,7 +2860,7 @@ func TestLoginCookies(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("should not return cookies without X-Requested-With header", func(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
_, resp := th.Client.Login(th.BasicUser.Email, th.BasicUser.Password)
|
||||
@@ -2869,7 +2869,7 @@ func TestLoginCookies(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("should include subpath in path", func(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
th.Client.HttpHeader[model.HEADER_REQUESTED_WITH] = model.HEADER_REQUESTED_WITH_XML
|
||||
@@ -2902,7 +2902,7 @@ func TestLoginCookies(t *testing.T) {
|
||||
|
||||
func TestCBALogin(t *testing.T) {
|
||||
t.Run("primary", func(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
th.App.SetLicense(model.NewTestLicense("saml"))
|
||||
|
||||
@@ -2960,7 +2960,7 @@ func TestCBALogin(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("secondary", func(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
th.App.SetLicense(model.NewTestLicense("saml"))
|
||||
|
||||
@@ -3011,7 +3011,7 @@ func TestCBALogin(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSwitchAccount(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.GitLabSettings.Enable = true })
|
||||
@@ -3157,7 +3157,7 @@ func assertInvalidToken(t *testing.T, th *TestHelper, token *model.UserAccessTok
|
||||
|
||||
func TestCreateUserAccessToken(t *testing.T) {
|
||||
t.Run("create token without permission", func(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableUserAccessTokens = true })
|
||||
@@ -3167,7 +3167,7 @@ func TestCreateUserAccessToken(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("create token for invalid user id", func(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableUserAccessTokens = true })
|
||||
@@ -3177,7 +3177,7 @@ func TestCreateUserAccessToken(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("create token with invalid value", func(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableUserAccessTokens = true })
|
||||
@@ -3187,7 +3187,7 @@ func TestCreateUserAccessToken(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("create token with user access tokens disabled", func(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableUserAccessTokens = false })
|
||||
@@ -3198,7 +3198,7 @@ func TestCreateUserAccessToken(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("create user access token", func(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableUserAccessTokens = true })
|
||||
@@ -3217,7 +3217,7 @@ func TestCreateUserAccessToken(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("create user access token as second user, without permission", func(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableUserAccessTokens = true })
|
||||
@@ -3227,7 +3227,7 @@ func TestCreateUserAccessToken(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("create user access token for basic user as as system admin", func(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableUserAccessTokens = true })
|
||||
@@ -3243,7 +3243,7 @@ func TestCreateUserAccessToken(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("create access token as oauth session", func(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableUserAccessTokens = true })
|
||||
@@ -3257,7 +3257,7 @@ func TestCreateUserAccessToken(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("create access token for bot created by user", func(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableUserAccessTokens = true })
|
||||
@@ -3296,7 +3296,7 @@ func TestCreateUserAccessToken(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("create access token for bot created by another user, only having MANAGE_BOTS permission", func(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableUserAccessTokens = true })
|
||||
@@ -3337,7 +3337,7 @@ func TestCreateUserAccessToken(t *testing.T) {
|
||||
|
||||
func TestGetUserAccessToken(t *testing.T) {
|
||||
t.Run("get for invalid user id", func(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableUserAccessTokens = true })
|
||||
@@ -3347,7 +3347,7 @@ func TestGetUserAccessToken(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("get for unknown user id", func(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableUserAccessTokens = true })
|
||||
@@ -3357,7 +3357,7 @@ func TestGetUserAccessToken(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("get my token", func(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableUserAccessTokens = true })
|
||||
@@ -3376,7 +3376,7 @@ func TestGetUserAccessToken(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("get user token as system admin", func(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableUserAccessTokens = true })
|
||||
@@ -3396,7 +3396,7 @@ func TestGetUserAccessToken(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("get token for bot created by user", func(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableUserAccessTokens = true })
|
||||
@@ -3442,7 +3442,7 @@ func TestGetUserAccessToken(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("get token for bot created by another user", func(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableUserAccessTokens = true })
|
||||
@@ -3488,7 +3488,7 @@ func TestGetUserAccessToken(t *testing.T) {
|
||||
|
||||
func TestGetUserAccessTokensForUser(t *testing.T) {
|
||||
t.Run("multiple tokens, offset 0, limit 100", func(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableUserAccessTokens = true })
|
||||
@@ -3511,7 +3511,7 @@ func TestGetUserAccessTokensForUser(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("multiple tokens as system admin, offset 0, limit 100", func(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableUserAccessTokens = true })
|
||||
@@ -3534,7 +3534,7 @@ func TestGetUserAccessTokensForUser(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("multiple tokens, offset 1, limit 1", func(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableUserAccessTokens = true })
|
||||
@@ -3559,7 +3559,7 @@ func TestGetUserAccessTokensForUser(t *testing.T) {
|
||||
|
||||
func TestGetUserAccessTokens(t *testing.T) {
|
||||
t.Run("GetUserAccessTokens, not a system admin", func(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableUserAccessTokens = true })
|
||||
@@ -3571,7 +3571,7 @@ func TestGetUserAccessTokens(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("GetUserAccessTokens, as a system admin, page 1, perPage 1", func(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableUserAccessTokens = true })
|
||||
@@ -3591,7 +3591,7 @@ func TestGetUserAccessTokens(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("GetUserAccessTokens, as a system admin, page 0, perPage 2", func(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableUserAccessTokens = true })
|
||||
@@ -3612,7 +3612,7 @@ func TestGetUserAccessTokens(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSearchUserAccessToken(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
testDescription := "test token"
|
||||
@@ -3649,7 +3649,7 @@ func TestSearchUserAccessToken(t *testing.T) {
|
||||
|
||||
func TestRevokeUserAccessToken(t *testing.T) {
|
||||
t.Run("revoke user token", func(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableUserAccessTokens = true })
|
||||
@@ -3667,7 +3667,7 @@ func TestRevokeUserAccessToken(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("revoke token belonging to another user", func(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableUserAccessTokens = true })
|
||||
@@ -3681,7 +3681,7 @@ func TestRevokeUserAccessToken(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("revoke token for bot created by user", func(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableUserAccessTokens = true })
|
||||
@@ -3724,7 +3724,7 @@ func TestRevokeUserAccessToken(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("revoke token for bot created by another user", func(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableUserAccessTokens = true })
|
||||
@@ -3767,7 +3767,7 @@ func TestRevokeUserAccessToken(t *testing.T) {
|
||||
|
||||
func TestDisableUserAccessToken(t *testing.T) {
|
||||
t.Run("disable user token", func(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableUserAccessTokens = true })
|
||||
@@ -3785,7 +3785,7 @@ func TestDisableUserAccessToken(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("disable token belonging to another user", func(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableUserAccessTokens = true })
|
||||
@@ -3799,7 +3799,7 @@ func TestDisableUserAccessToken(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("disable token for bot created by user", func(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableUserAccessTokens = true })
|
||||
@@ -3842,7 +3842,7 @@ func TestDisableUserAccessToken(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("disable token for bot created by another user", func(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableUserAccessTokens = true })
|
||||
@@ -3885,7 +3885,7 @@ func TestDisableUserAccessToken(t *testing.T) {
|
||||
|
||||
func TestEnableUserAccessToken(t *testing.T) {
|
||||
t.Run("enable user token", func(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableUserAccessTokens = true })
|
||||
@@ -3909,7 +3909,7 @@ func TestEnableUserAccessToken(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("enable token belonging to another user", func(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableUserAccessTokens = true })
|
||||
@@ -3927,7 +3927,7 @@ func TestEnableUserAccessToken(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("enable token for bot created by user", func(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableUserAccessTokens = true })
|
||||
@@ -3974,7 +3974,7 @@ func TestEnableUserAccessToken(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("enable token for bot created by another user", func(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableUserAccessTokens = true })
|
||||
@@ -4020,7 +4020,7 @@ func TestEnableUserAccessToken(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUserAccessTokenInactiveUser(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
testDescription := "test token"
|
||||
@@ -4042,7 +4042,7 @@ func TestUserAccessTokenInactiveUser(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUserAccessTokenDisableConfig(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
testDescription := "test token"
|
||||
@@ -4069,7 +4069,7 @@ func TestUserAccessTokenDisableConfig(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUserAccessTokenDisableConfigBotsExcluded(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) {
|
||||
@@ -4093,7 +4093,7 @@ func TestUserAccessTokenDisableConfigBotsExcluded(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetUsersByStatus(t *testing.T) {
|
||||
th := Setup()
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
team, err := th.App.CreateTeam(&model.Team{
|
||||
@@ -4200,7 +4200,7 @@ func TestGetUsersByStatus(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestRegisterTermsOfServiceAction(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
success, resp := th.Client.RegisterTermsOfServiceAction(th.BasicUser.Id, "st_1", true)
|
||||
@@ -4219,7 +4219,7 @@ func TestRegisterTermsOfServiceAction(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetUserTermsOfService(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
_, resp := th.Client.GetUserTermsOfService(th.BasicUser.Id, "")
|
||||
@@ -4241,7 +4241,7 @@ func TestGetUserTermsOfService(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestLoginErrorMessage(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
_, resp := th.Client.Logout()
|
||||
@@ -4296,7 +4296,7 @@ func TestLoginErrorMessage(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestLoginLockout(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
_, resp := th.Client.Logout()
|
||||
@@ -4345,7 +4345,7 @@ func TestLoginLockout(t *testing.T) {
|
||||
|
||||
func TestDemoteUserToGuest(t *testing.T) {
|
||||
t.Run("websocket update user event", func(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
th.Server.Store = localcachelayer.NewLocalCacheLayer(th.Server.Store,
|
||||
th.Server.Metrics, th.Server.Cluster, th.Server.CacheProvider)
|
||||
defer th.TearDown()
|
||||
@@ -4400,7 +4400,7 @@ func TestDemoteUserToGuest(t *testing.T) {
|
||||
|
||||
func TestPromoteGuestToUser(t *testing.T) {
|
||||
t.Run("websocket update user event", func(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
th.Server.Store = localcachelayer.NewLocalCacheLayer(th.Server.Store,
|
||||
th.Server.Metrics, th.Server.Cluster, th.Server.CacheProvider)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
)
|
||||
|
||||
func TestApiResctrictedViewMembers(t *testing.T) {
|
||||
th := Setup()
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
// Create first account for system admin
|
||||
|
||||
@@ -13,7 +13,7 @@ import (
|
||||
)
|
||||
|
||||
func TestCreateIncomingWebhook(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -67,7 +67,7 @@ func TestCreateIncomingWebhook(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCreateIncomingWebhook_BypassTeamPermissions(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableIncomingWebhooks = true })
|
||||
@@ -101,7 +101,7 @@ func TestCreateIncomingWebhook_BypassTeamPermissions(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetIncomingWebhooks(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -172,7 +172,7 @@ func TestGetIncomingWebhooks(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetIncomingWebhooksListByUser(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
BasicClient := th.Client
|
||||
th.LoginBasic()
|
||||
@@ -213,7 +213,7 @@ func TestGetIncomingWebhooksListByUser(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetIncomingWebhooksByTeam(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
BasicClient := th.Client
|
||||
|
||||
@@ -254,7 +254,7 @@ func TestGetIncomingWebhooksByTeam(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetIncomingWebhook(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.SystemAdminClient
|
||||
|
||||
@@ -293,7 +293,7 @@ func TestGetIncomingWebhook(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDeleteIncomingWebhook(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.SystemAdminClient
|
||||
|
||||
@@ -343,7 +343,7 @@ func TestDeleteIncomingWebhook(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCreateOutgoingWebhook(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -389,7 +389,7 @@ func TestCreateOutgoingWebhook(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetOutgoingWebhooks(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -480,7 +480,7 @@ func TestGetOutgoingWebhooks(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetOutgoingWebhooksByTeam(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
BasicClient := th.Client
|
||||
|
||||
@@ -521,7 +521,7 @@ func TestGetOutgoingWebhooksByTeam(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetOutgoingWebhooksByChannel(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
BasicClient := th.Client
|
||||
|
||||
@@ -562,7 +562,7 @@ func TestGetOutgoingWebhooksByChannel(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetOutgoingWebhooksListByUser(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
BasicClient := th.Client
|
||||
th.LoginBasic()
|
||||
@@ -603,7 +603,7 @@ func TestGetOutgoingWebhooksListByUser(t *testing.T) {
|
||||
|
||||
}
|
||||
func TestGetOutgoingWebhook(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -632,7 +632,7 @@ func TestGetOutgoingWebhook(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUpdateIncomingHook(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -808,7 +808,7 @@ func TestUpdateIncomingHook(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUpdateIncomingWebhook_BypassTeamPermissions(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableIncomingWebhooks = true })
|
||||
@@ -842,7 +842,7 @@ func TestUpdateIncomingWebhook_BypassTeamPermissions(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestRegenOutgoingHookToken(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -872,7 +872,7 @@ func TestRegenOutgoingHookToken(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUpdateOutgoingHook(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
@@ -1025,7 +1025,7 @@ func TestUpdateOutgoingHook(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestUpdateOutgoingWebhook_BypassTeamPermissions(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableOutgoingWebhooks = true })
|
||||
@@ -1057,7 +1057,7 @@ func TestUpdateOutgoingWebhook_BypassTeamPermissions(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDeleteOutgoingHook(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
Client := th.SystemAdminClient
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ import (
|
||||
)
|
||||
|
||||
func TestWebSocket(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
WebSocketClient, err := th.CreateWebSocketClient()
|
||||
require.Nil(t, err)
|
||||
@@ -78,7 +78,7 @@ func TestWebSocket(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestWebSocketTrailingSlash(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
url := fmt.Sprintf("ws://localhost:%v", th.App.Srv.ListenAddr.Port)
|
||||
@@ -87,7 +87,7 @@ func TestWebSocketTrailingSlash(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestWebSocketEvent(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
WebSocketClient, err := th.CreateWebSocketClient()
|
||||
@@ -157,7 +157,7 @@ func TestWebSocketEvent(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCreateDirectChannelWithSocket(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
Client := th.Client
|
||||
@@ -213,7 +213,7 @@ func TestCreateDirectChannelWithSocket(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestWebsocketOriginSecurity(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
url := fmt.Sprintf("ws://localhost:%v", th.App.Srv.ListenAddr.Port)
|
||||
@@ -263,7 +263,7 @@ func TestWebsocketOriginSecurity(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestWebSocketStatuses(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
Client := th.Client
|
||||
|
||||
@@ -34,11 +34,11 @@ func TestUpdateConfig(t *testing.T) {
|
||||
|
||||
th.App.AddConfigListener(func(old, current *model.Config) {
|
||||
assert.Equal(t, prev, *old.ServiceSettings.SiteURL)
|
||||
assert.Equal(t, "foo", *current.ServiceSettings.SiteURL)
|
||||
assert.Equal(t, "http://foo.com", *current.ServiceSettings.SiteURL)
|
||||
})
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) {
|
||||
*cfg.ServiceSettings.SiteURL = "foo"
|
||||
*cfg.ServiceSettings.SiteURL = "http://foo.com"
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -4,14 +4,15 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"github.com/mattermost/mattermost-server/v5/model"
|
||||
)
|
||||
|
||||
func TestCheckIfRolesGrantPermission(t *testing.T) {
|
||||
th := Setup(t).InitBasic()
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
cases := []struct {
|
||||
|
||||
@@ -23,10 +23,10 @@ func TestBusySet(t *testing.T) {
|
||||
|
||||
require.False(t, busy.IsBusy())
|
||||
|
||||
busy.Set(time.Second * 3)
|
||||
busy.Set(time.Millisecond * 100)
|
||||
require.True(t, busy.IsBusy())
|
||||
require.True(t, compareBusyState(t, busy, cluster.Busy))
|
||||
// should automatically expire after 3s.
|
||||
// should automatically expire after 100ms.
|
||||
require.Eventually(t, isNotBusy, time.Second*15, time.Millisecond*20)
|
||||
// allow a moment for cluster to sync.
|
||||
require.Eventually(t, func() bool { return compareBusyState(t, busy, cluster.Busy) }, time.Second*15, time.Millisecond*20)
|
||||
|
||||
@@ -51,20 +51,20 @@ func TestConfigListener(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestAsymmetricSigningKey(t *testing.T) {
|
||||
th := Setup(t).InitBasic()
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
assert.NotNil(t, th.App.AsymmetricSigningKey())
|
||||
assert.NotEmpty(t, th.App.ClientConfig()["AsymmetricSigningPublicKey"])
|
||||
}
|
||||
|
||||
func TestPostActionCookieSecret(t *testing.T) {
|
||||
th := Setup(t).InitBasic()
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
assert.Equal(t, 32, len(th.App.PostActionCookieSecret()))
|
||||
}
|
||||
|
||||
func TestClientConfigWithComputed(t *testing.T) {
|
||||
th := Setup(t).InitBasic()
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
config := th.App.ClientConfigWithComputed()
|
||||
|
||||
@@ -68,7 +68,7 @@ func TestDiagnostics(t *testing.T) {
|
||||
t.SkipNow()
|
||||
}
|
||||
|
||||
th := Setup(t).InitBasic()
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
type payload struct {
|
||||
|
||||
@@ -93,7 +93,7 @@ func TestSAMLSettings(t *testing.T) {
|
||||
RegisterNewSamlInterface(nil)
|
||||
}
|
||||
|
||||
th := SetupEnterprise(t).InitBasic()
|
||||
th := SetupEnterprise(t)
|
||||
defer th.TearDown()
|
||||
|
||||
if tc.useNewSAMLLibrary {
|
||||
|
||||
@@ -44,8 +44,7 @@ func TestReactionsOfPost(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestExportUserNotifyProps(t *testing.T) {
|
||||
|
||||
th := Setup(t).InitBasic()
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
userNotifyProps := model.StringMap{
|
||||
@@ -113,7 +112,7 @@ func TestExportUserChannels(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDirCreationForEmoji(t *testing.T) {
|
||||
th := Setup(t).InitBasic()
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
pathToDir := th.App.createDirForEmoji("test.json", "exported_emoji_test")
|
||||
@@ -123,11 +122,11 @@ func TestDirCreationForEmoji(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCopyEmojiImages(t *testing.T) {
|
||||
th := Setup(t).InitBasic()
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
emoji := &model.Emoji{
|
||||
Id: th.BasicUser.Id,
|
||||
Id: model.NewId(),
|
||||
}
|
||||
|
||||
// Creating a dir named `exported_emoji_test` in the root of the repo
|
||||
|
||||
@@ -141,7 +141,7 @@ func TestOAuthDeleteApp(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestAuthorizeOAuthUser(t *testing.T) {
|
||||
setup := func(enable, tokenEndpoint, userEndpoint bool, serverURL string) *TestHelper {
|
||||
setup := func(t *testing.T, enable, tokenEndpoint, userEndpoint bool, serverURL string) *TestHelper {
|
||||
th := Setup(t)
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) {
|
||||
@@ -188,7 +188,7 @@ func TestAuthorizeOAuthUser(t *testing.T) {
|
||||
}
|
||||
|
||||
t.Run("not enabled", func(t *testing.T) {
|
||||
th := setup(false, true, true, "")
|
||||
th := setup(t, false, true, true, "")
|
||||
defer th.TearDown()
|
||||
|
||||
_, _, _, err := th.App.AuthorizeOAuthUser(nil, nil, model.SERVICE_GITLAB, "", "", "")
|
||||
@@ -197,7 +197,7 @@ func TestAuthorizeOAuthUser(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("with an improperly encoded state", func(t *testing.T) {
|
||||
th := setup(true, true, true, "")
|
||||
th := setup(t, true, true, true, "")
|
||||
defer th.TearDown()
|
||||
|
||||
state := "!"
|
||||
@@ -208,7 +208,7 @@ func TestAuthorizeOAuthUser(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("without a stored token", func(t *testing.T) {
|
||||
th := setup(true, true, true, "")
|
||||
th := setup(t, true, true, true, "")
|
||||
defer th.TearDown()
|
||||
|
||||
state := base64.StdEncoding.EncodeToString([]byte(model.MapToJson(map[string]string{
|
||||
@@ -222,7 +222,7 @@ func TestAuthorizeOAuthUser(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("with a stored token of the wrong type", func(t *testing.T) {
|
||||
th := setup(true, true, true, "")
|
||||
th := setup(t, true, true, true, "")
|
||||
defer th.TearDown()
|
||||
|
||||
token := model.NewToken("invalid", "")
|
||||
@@ -237,7 +237,7 @@ func TestAuthorizeOAuthUser(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("with email missing when changing login types", func(t *testing.T) {
|
||||
th := setup(true, true, true, "")
|
||||
th := setup(t, true, true, true, "")
|
||||
defer th.TearDown()
|
||||
|
||||
email := ""
|
||||
@@ -259,7 +259,7 @@ func TestAuthorizeOAuthUser(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("without an OAuth cookie", func(t *testing.T) {
|
||||
th := setup(true, true, true, "")
|
||||
th := setup(t, true, true, true, "")
|
||||
defer th.TearDown()
|
||||
|
||||
cookie := model.NewId()
|
||||
@@ -272,7 +272,7 @@ func TestAuthorizeOAuthUser(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("with an invalid token", func(t *testing.T) {
|
||||
th := setup(true, true, true, "")
|
||||
th := setup(t, true, true, true, "")
|
||||
defer th.TearDown()
|
||||
|
||||
cookie := model.NewId()
|
||||
@@ -289,7 +289,7 @@ func TestAuthorizeOAuthUser(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("with an incorrect token endpoint", func(t *testing.T) {
|
||||
th := setup(true, false, true, "")
|
||||
th := setup(t, true, false, true, "")
|
||||
defer th.TearDown()
|
||||
|
||||
cookie := model.NewId()
|
||||
@@ -307,7 +307,7 @@ func TestAuthorizeOAuthUser(t *testing.T) {
|
||||
}))
|
||||
defer server.Close()
|
||||
|
||||
th := setup(true, true, true, server.URL)
|
||||
th := setup(t, true, true, true, server.URL)
|
||||
defer th.TearDown()
|
||||
|
||||
cookie := model.NewId()
|
||||
@@ -326,7 +326,7 @@ func TestAuthorizeOAuthUser(t *testing.T) {
|
||||
}))
|
||||
defer server.Close()
|
||||
|
||||
th := setup(true, true, true, server.URL)
|
||||
th := setup(t, true, true, true, server.URL)
|
||||
defer th.TearDown()
|
||||
|
||||
cookie := model.NewId()
|
||||
@@ -348,7 +348,7 @@ func TestAuthorizeOAuthUser(t *testing.T) {
|
||||
}))
|
||||
defer server.Close()
|
||||
|
||||
th := setup(true, true, true, server.URL)
|
||||
th := setup(t, true, true, true, server.URL)
|
||||
defer th.TearDown()
|
||||
|
||||
cookie := model.NewId()
|
||||
@@ -369,7 +369,7 @@ func TestAuthorizeOAuthUser(t *testing.T) {
|
||||
}))
|
||||
defer server.Close()
|
||||
|
||||
th := setup(true, true, true, server.URL)
|
||||
th := setup(t, true, true, true, server.URL)
|
||||
defer th.TearDown()
|
||||
|
||||
cookie := model.NewId()
|
||||
@@ -390,7 +390,7 @@ func TestAuthorizeOAuthUser(t *testing.T) {
|
||||
}))
|
||||
defer server.Close()
|
||||
|
||||
th := setup(true, true, false, server.URL)
|
||||
th := setup(t, true, true, false, server.URL)
|
||||
defer th.TearDown()
|
||||
|
||||
cookie := model.NewId()
|
||||
@@ -418,7 +418,7 @@ func TestAuthorizeOAuthUser(t *testing.T) {
|
||||
}))
|
||||
defer server.Close()
|
||||
|
||||
th := setup(true, true, true, server.URL)
|
||||
th := setup(t, true, true, true, server.URL)
|
||||
defer th.TearDown()
|
||||
|
||||
cookie := model.NewId()
|
||||
@@ -447,7 +447,7 @@ func TestAuthorizeOAuthUser(t *testing.T) {
|
||||
}))
|
||||
defer server.Close()
|
||||
|
||||
th := setup(true, true, true, server.URL)
|
||||
th := setup(t, true, true, true, server.URL)
|
||||
defer th.TearDown()
|
||||
|
||||
cookie := model.NewId()
|
||||
@@ -487,7 +487,7 @@ func TestAuthorizeOAuthUser(t *testing.T) {
|
||||
}))
|
||||
defer server.Close()
|
||||
|
||||
th := setup(true, true, true, server.URL)
|
||||
th := setup(t, true, true, true, server.URL)
|
||||
defer th.TearDown()
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) {
|
||||
|
||||
@@ -100,7 +100,7 @@ func setupPluginApiTest(t *testing.T, pluginCode string, pluginManifest string,
|
||||
}
|
||||
|
||||
func TestPublicFilesPathConfiguration(t *testing.T) {
|
||||
th := Setup(t).InitBasic()
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
pluginID := "com.mattermost.sample"
|
||||
@@ -351,7 +351,7 @@ func TestPluginAPIGetFile(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPluginAPISavePluginConfig(t *testing.T) {
|
||||
th := Setup(t).InitBasic()
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
manifest := &model.Manifest{
|
||||
@@ -394,7 +394,7 @@ func TestPluginAPISavePluginConfig(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPluginAPIGetPluginConfig(t *testing.T) {
|
||||
th := Setup(t).InitBasic()
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
manifest := &model.Manifest{
|
||||
@@ -425,7 +425,7 @@ func TestPluginAPIGetPluginConfig(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPluginAPILoadPluginConfiguration(t *testing.T) {
|
||||
th := Setup(t).InitBasic()
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
var pluginJson map[string]interface{}
|
||||
@@ -461,7 +461,7 @@ func TestPluginAPILoadPluginConfiguration(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPluginAPILoadPluginConfigurationDefaults(t *testing.T) {
|
||||
th := Setup(t).InitBasic()
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
var pluginJson map[string]interface{}
|
||||
@@ -501,7 +501,7 @@ func TestPluginAPILoadPluginConfigurationDefaults(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPluginAPIGetPlugins(t *testing.T) {
|
||||
th := Setup(t).InitBasic()
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
api := th.SetupPluginAPI()
|
||||
|
||||
@@ -559,7 +559,7 @@ func TestPluginAPIGetPlugins(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPluginAPIInstallPlugin(t *testing.T) {
|
||||
th := Setup(t).InitBasic()
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
api := th.SetupPluginAPI()
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ import (
|
||||
)
|
||||
|
||||
func TestPluginPublicKeys(t *testing.T) {
|
||||
th := Setup(t).InitBasic()
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
path, _ := fileutils.FindDir("tests")
|
||||
|
||||
@@ -99,7 +99,7 @@ func TestPreparePostForClient(t *testing.T) {
|
||||
serverURL = server.URL
|
||||
defer server.Close()
|
||||
|
||||
setup := func() *TestHelper {
|
||||
setup := func(t *testing.T) *TestHelper {
|
||||
th := Setup(t).InitBasic()
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) {
|
||||
@@ -112,7 +112,7 @@ func TestPreparePostForClient(t *testing.T) {
|
||||
}
|
||||
|
||||
t.Run("no metadata needed", func(t *testing.T) {
|
||||
th := setup()
|
||||
th := setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
message := model.NewId()
|
||||
@@ -141,7 +141,7 @@ func TestPreparePostForClient(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("metadata already set", func(t *testing.T) {
|
||||
th := setup()
|
||||
th := setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
post := th.CreatePost(th.BasicChannel)
|
||||
@@ -153,7 +153,7 @@ func TestPreparePostForClient(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("reactions", func(t *testing.T) {
|
||||
th := setup()
|
||||
th := setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
post := th.CreatePost(th.BasicChannel)
|
||||
@@ -171,7 +171,7 @@ func TestPreparePostForClient(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("files", func(t *testing.T) {
|
||||
th := setup()
|
||||
th := setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
fileInfo, err := th.App.DoUploadFile(time.Now(), th.BasicTeam.Id, th.BasicChannel.Id, th.BasicUser.Id, "test.txt", []byte("test"))
|
||||
@@ -192,7 +192,7 @@ func TestPreparePostForClient(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("emojis without custom emojis enabled", func(t *testing.T) {
|
||||
th := setup()
|
||||
th := setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) {
|
||||
@@ -233,7 +233,7 @@ func TestPreparePostForClient(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("emojis with custom emojis enabled", func(t *testing.T) {
|
||||
th := setup()
|
||||
th := setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) {
|
||||
@@ -278,7 +278,7 @@ func TestPreparePostForClient(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("emojis overriding profile icon", func(t *testing.T) {
|
||||
th := setup()
|
||||
th := setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
prepare := func(override bool, url, emoji string) *model.Post {
|
||||
@@ -329,7 +329,7 @@ func TestPreparePostForClient(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("markdown image dimensions", func(t *testing.T) {
|
||||
th := setup()
|
||||
th := setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
post, err := th.App.CreatePost(&model.Post{
|
||||
@@ -358,21 +358,21 @@ func TestPreparePostForClient(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("proxy linked images", func(t *testing.T) {
|
||||
th := setup()
|
||||
th := setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
testProxyLinkedImage(t, th, false)
|
||||
})
|
||||
|
||||
t.Run("proxy opengraph images", func(t *testing.T) {
|
||||
th := setup()
|
||||
th := setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
testProxyOpenGraphImage(t, th, false)
|
||||
})
|
||||
|
||||
t.Run("image embed", func(t *testing.T) {
|
||||
th := setup()
|
||||
th := setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
post, err := th.App.CreatePost(&model.Post{
|
||||
@@ -408,7 +408,7 @@ func TestPreparePostForClient(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("opengraph embed", func(t *testing.T) {
|
||||
th := setup()
|
||||
th := setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
post, err := th.App.CreatePost(&model.Post{
|
||||
@@ -445,7 +445,7 @@ func TestPreparePostForClient(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("message attachment embed", func(t *testing.T) {
|
||||
th := setup()
|
||||
th := setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
post, err := th.App.CreatePost(&model.Post{
|
||||
@@ -483,7 +483,7 @@ func TestPreparePostForClient(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("no metadata for deleted posts", func(t *testing.T) {
|
||||
th := setup()
|
||||
th := setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
fileInfo, err := th.App.DoUploadFile(time.Now(), th.BasicTeam.Id, th.BasicChannel.Id, th.BasicUser.Id, "test.txt", []byte("test"))
|
||||
@@ -514,7 +514,7 @@ func TestPreparePostForClient(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPreparePostForClientWithImageProxy(t *testing.T) {
|
||||
setup := func() *TestHelper {
|
||||
setup := func(t *testing.T) *TestHelper {
|
||||
th := Setup(t).InitBasic()
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) {
|
||||
@@ -531,14 +531,14 @@ func TestPreparePostForClientWithImageProxy(t *testing.T) {
|
||||
}
|
||||
|
||||
t.Run("proxy linked images", func(t *testing.T) {
|
||||
th := setup()
|
||||
th := setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
testProxyLinkedImage(t, th, true)
|
||||
})
|
||||
|
||||
t.Run("proxy opengraph images", func(t *testing.T) {
|
||||
th := setup()
|
||||
th := setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
testProxyOpenGraphImage(t, th, true)
|
||||
@@ -1489,7 +1489,7 @@ func TestGetImagesInMessageAttachments(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestGetLinkMetadata(t *testing.T) {
|
||||
setup := func() *TestHelper {
|
||||
setup := func(t *testing.T) *TestHelper {
|
||||
th := Setup(t).InitBasic()
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) {
|
||||
@@ -1561,7 +1561,7 @@ func TestGetLinkMetadata(t *testing.T) {
|
||||
defer server.Close()
|
||||
|
||||
t.Run("in-memory cache", func(t *testing.T) {
|
||||
th := setup()
|
||||
th := setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
requestURL := server.URL + "/cached"
|
||||
@@ -1634,7 +1634,7 @@ func TestGetLinkMetadata(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("database cache", func(t *testing.T) {
|
||||
th := setup()
|
||||
th := setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
requestURL := server.URL
|
||||
@@ -1715,7 +1715,7 @@ func TestGetLinkMetadata(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("should get data from remote source", func(t *testing.T) {
|
||||
th := setup()
|
||||
th := setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
requestURL := server.URL + "/opengraph?title=Remote&name=" + t.Name()
|
||||
@@ -1735,7 +1735,7 @@ func TestGetLinkMetadata(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("should cache OpenGraph results", func(t *testing.T) {
|
||||
th := setup()
|
||||
th := setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
requestURL := server.URL + "/opengraph?title=Remote&name=" + t.Name()
|
||||
@@ -1763,7 +1763,7 @@ func TestGetLinkMetadata(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("should cache image results", func(t *testing.T) {
|
||||
th := setup()
|
||||
th := setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
requestURL := server.URL + "/image?height=300&width=400&name=" + t.Name()
|
||||
@@ -1791,7 +1791,7 @@ func TestGetLinkMetadata(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("should cache general errors", func(t *testing.T) {
|
||||
th := setup()
|
||||
th := setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
requestURL := server.URL + "/error"
|
||||
@@ -1821,7 +1821,7 @@ func TestGetLinkMetadata(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("should cache invalid URL errors", func(t *testing.T) {
|
||||
th := setup()
|
||||
th := setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
requestURL := "http://notarealdomainthatactuallyexists.ca/?name=" + t.Name()
|
||||
@@ -1851,7 +1851,7 @@ func TestGetLinkMetadata(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("should cache timeout errors", func(t *testing.T) {
|
||||
th := setup()
|
||||
th := setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) {
|
||||
@@ -1886,7 +1886,7 @@ func TestGetLinkMetadata(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("should cache database results in memory", func(t *testing.T) {
|
||||
th := setup()
|
||||
th := setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
requestURL := server.URL + "/image?height=300&width=400&name=" + t.Name()
|
||||
@@ -1914,7 +1914,7 @@ func TestGetLinkMetadata(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("should reject non-html, non-image response", func(t *testing.T) {
|
||||
th := setup()
|
||||
th := setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
requestURL := server.URL + "/json?name=" + t.Name()
|
||||
@@ -1927,7 +1927,7 @@ func TestGetLinkMetadata(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("should check in-memory cache for new post", func(t *testing.T) {
|
||||
th := setup()
|
||||
th := setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
requestURL := server.URL + "/error?name=" + t.Name()
|
||||
@@ -1942,7 +1942,7 @@ func TestGetLinkMetadata(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("should skip database cache for new post", func(t *testing.T) {
|
||||
th := setup()
|
||||
th := setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
requestURL := server.URL + "/error?name=" + t.Name()
|
||||
@@ -1957,7 +1957,7 @@ func TestGetLinkMetadata(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("should resolve relative URL", func(t *testing.T) {
|
||||
th := setup()
|
||||
th := setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
// Fake the SiteURL to have the relative URL resolve to the external server
|
||||
@@ -1980,7 +1980,7 @@ func TestGetLinkMetadata(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("should error on local addresses other than the image proxy", func(t *testing.T) {
|
||||
th := setup()
|
||||
th := setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
// Disable AllowedUntrustedInternalConnections since it's turned on for the previous tests
|
||||
@@ -2019,7 +2019,7 @@ func TestGetLinkMetadata(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("should prefer images for mixed content", func(t *testing.T) {
|
||||
th := setup()
|
||||
th := setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
requestURL := server.URL + "/mixed?name=" + t.Name()
|
||||
|
||||
@@ -445,7 +445,7 @@ func TestPostChannelMentions(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestImageProxy(t *testing.T) {
|
||||
th := Setup(t).InitBasic()
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) {
|
||||
|
||||
@@ -15,7 +15,7 @@ import (
|
||||
)
|
||||
|
||||
func TestJoinChannel(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
channel := th.CreatePublicChannel()
|
||||
@@ -30,7 +30,7 @@ func TestJoinChannel(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestRemoveChannel(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
channel := th.CreatePublicChannel()
|
||||
@@ -51,7 +51,7 @@ func TestRemoveChannel(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestMoveChannel(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
team1 := th.BasicTeam
|
||||
@@ -77,7 +77,7 @@ func TestMoveChannel(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestListChannels(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
channel := th.CreatePublicChannel()
|
||||
@@ -100,7 +100,7 @@ func TestListChannels(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestRestoreChannel(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
channel := th.CreatePublicChannel()
|
||||
@@ -113,7 +113,7 @@ func TestRestoreChannel(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCreateChannel(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
id := model.NewId()
|
||||
@@ -126,7 +126,7 @@ func TestCreateChannel(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestRenameChannel(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
channel := th.CreatePublicChannel()
|
||||
@@ -139,7 +139,7 @@ func TestRenameChannel(t *testing.T) {
|
||||
}
|
||||
|
||||
func Test_searchChannelCmdF(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
channel := th.CreatePublicChannel()
|
||||
@@ -229,7 +229,7 @@ func Test_searchChannelCmdF(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestModifyChannel(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
channel1 := th.CreatePrivateChannel()
|
||||
|
||||
@@ -36,13 +36,13 @@ type testHelper struct {
|
||||
}
|
||||
|
||||
// Setup creates an instance of testHelper.
|
||||
func Setup() *testHelper {
|
||||
func Setup(t testing.TB) *testHelper {
|
||||
dir, err := ioutil.TempDir("", "testHelper")
|
||||
if err != nil {
|
||||
panic("failed to create temporary directory: " + err.Error())
|
||||
}
|
||||
|
||||
api4TestHelper := api4.Setup()
|
||||
api4TestHelper := api4.Setup(t)
|
||||
|
||||
testHelper := &testHelper{
|
||||
TestHelper: api4TestHelper,
|
||||
|
||||
@@ -12,7 +12,7 @@ import (
|
||||
)
|
||||
|
||||
func TestCreateCommand(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
config := th.Config()
|
||||
@@ -131,7 +131,7 @@ func TestCreateCommand(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestShowCommand(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
url := "http://localhost:8000/test-command"
|
||||
@@ -179,7 +179,7 @@ func TestDeleteCommand(t *testing.T) {
|
||||
// Skipped due to v5.6 RC build issues.
|
||||
t.Skip()
|
||||
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
url := "http://localhost:8000/test-command"
|
||||
team := th.BasicTeam
|
||||
@@ -215,7 +215,7 @@ func TestDeleteCommand(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestModifyCommand(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
// set config
|
||||
|
||||
@@ -15,7 +15,7 @@ import (
|
||||
)
|
||||
|
||||
func TestConfigFlag(t *testing.T) {
|
||||
th := Setup()
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
dir := th.TemporaryDirectory()
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ func getDsn(driver string, source string) string {
|
||||
}
|
||||
|
||||
func TestConfigValidate(t *testing.T) {
|
||||
th := Setup()
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
tempFile, err := ioutil.TempFile("", "TestConfigValidate")
|
||||
@@ -100,7 +100,7 @@ func TestConfigValidate(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestConfigGet(t *testing.T) {
|
||||
th := Setup()
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
t.Run("Error when no arguments are given", func(t *testing.T) {
|
||||
@@ -132,7 +132,7 @@ func TestConfigGet(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestConfigSet(t *testing.T) {
|
||||
th := Setup()
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
t.Run("Error when no arguments are given", func(t *testing.T) {
|
||||
@@ -182,7 +182,7 @@ func TestConfigSet(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestConfigReset(t *testing.T) {
|
||||
th := Setup()
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
t.Run("No Error when no arguments are given (reset all the configurations)", func(t *testing.T) {
|
||||
@@ -401,7 +401,7 @@ func TestPrintConfigValues(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestConfigShow(t *testing.T) {
|
||||
th := Setup()
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
t.Run("error with unknown subcommand", func(t *testing.T) {
|
||||
@@ -438,7 +438,7 @@ func TestConfigShow(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSetConfig(t *testing.T) {
|
||||
th := Setup()
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
// Error when no argument is given
|
||||
@@ -535,7 +535,7 @@ func TestUpdateMap(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestConfigMigrate(t *testing.T) {
|
||||
th := Setup()
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
sqlSettings := mainHelper.GetSQLSettings()
|
||||
|
||||
@@ -16,7 +16,7 @@ import (
|
||||
// fails fast if invalid flags are supplied
|
||||
|
||||
func TestMessageExportNotEnabled(t *testing.T) {
|
||||
th := Setup()
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
config := th.Config()
|
||||
@@ -28,7 +28,7 @@ func TestMessageExportNotEnabled(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestMessageExportInvalidFormat(t *testing.T) {
|
||||
th := Setup()
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
config := th.Config()
|
||||
@@ -40,7 +40,7 @@ func TestMessageExportInvalidFormat(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestMessageExportNegativeExportFrom(t *testing.T) {
|
||||
th := Setup()
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
config := th.Config()
|
||||
@@ -52,7 +52,7 @@ func TestMessageExportNegativeExportFrom(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestMessageExportNegativeTimeoutSeconds(t *testing.T) {
|
||||
th := Setup()
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
config := th.Config()
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
)
|
||||
|
||||
func TestChannelGroupEnable(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
// create public channel
|
||||
@@ -56,7 +56,7 @@ func TestChannelGroupEnable(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestChannelGroupDisable(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
// create private channel
|
||||
@@ -106,7 +106,7 @@ func TestChannelGroupDisable(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestChannelGroupStatus(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
// create private channel
|
||||
@@ -150,7 +150,7 @@ func TestChannelGroupStatus(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestChannelGroupList(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
// create private channel
|
||||
@@ -212,7 +212,7 @@ func TestChannelGroupList(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestTeamGroupEnable(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
// try to enable, should fail because team has no groups
|
||||
@@ -249,7 +249,7 @@ func TestTeamGroupEnable(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestTeamGroupDisable(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
// try to disable, should work
|
||||
@@ -296,7 +296,7 @@ func TestTeamGroupDisable(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestTeamGroupStatus(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
// get status, should be Disabled
|
||||
@@ -337,7 +337,7 @@ func TestTeamGroupStatus(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestTeamGroupList(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
// list groups for a team with none, should work
|
||||
|
||||
@@ -12,7 +12,7 @@ import (
|
||||
)
|
||||
|
||||
func TestPermissionsExport_rejectsUnlicensed(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
actual, _ := th.RunCommandWithOutput(t, "permissions", "export")
|
||||
@@ -20,7 +20,7 @@ func TestPermissionsExport_rejectsUnlicensed(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPermissionsImport_rejectsUnlicensed(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
actual, _ := th.RunCommandWithOutput(t, "permissions", "import")
|
||||
|
||||
@@ -14,7 +14,7 @@ import (
|
||||
)
|
||||
|
||||
func TestPlugin(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
cfg := th.Config()
|
||||
@@ -48,7 +48,7 @@ func TestPlugin(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPluginPublicKeys(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
cfg := th.Config()
|
||||
@@ -61,7 +61,7 @@ func TestPluginPublicKeys(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPluginPublicKeyDetails(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
cfg := th.Config()
|
||||
@@ -76,7 +76,7 @@ func TestPluginPublicKeyDetails(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestAddPluginPublicKeys(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
cfg := th.Config()
|
||||
@@ -88,7 +88,7 @@ func TestAddPluginPublicKeys(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDeletePluginPublicKeys(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
cfg := th.Config()
|
||||
@@ -100,7 +100,7 @@ func TestDeletePluginPublicKeys(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPluginPublicKeysFlow(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
path, _ := fileutils.FindDir("tests")
|
||||
|
||||
@@ -4,13 +4,14 @@
|
||||
package commands
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestAssignRole(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
th.CheckCommand(t, "roles", "system_admin", th.BasicUser.Email)
|
||||
|
||||
@@ -10,7 +10,7 @@ import (
|
||||
)
|
||||
|
||||
func TestSampledataBadParameters(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
// should fail because you need at least 1 worker
|
||||
|
||||
@@ -21,7 +21,7 @@ type ServerTestHelper struct {
|
||||
originalInterval int
|
||||
}
|
||||
|
||||
func SetupServerTest() *ServerTestHelper {
|
||||
func SetupServerTest(t testing.TB) *ServerTestHelper {
|
||||
// Build a channel that will be used by the server to receive system signals...
|
||||
interruptChan := make(chan os.Signal, 1)
|
||||
// ...and sent it immediately a SIGINT value.
|
||||
@@ -47,7 +47,7 @@ func (th *ServerTestHelper) TearDownServerTest() {
|
||||
}
|
||||
|
||||
func TestRunServerSuccess(t *testing.T) {
|
||||
th := SetupServerTest()
|
||||
th := SetupServerTest(t)
|
||||
defer th.TearDownServerTest()
|
||||
|
||||
configStore, err := config.NewMemoryStore()
|
||||
@@ -58,7 +58,7 @@ func TestRunServerSuccess(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestRunServerSystemdNotification(t *testing.T) {
|
||||
th := SetupServerTest()
|
||||
th := SetupServerTest(t)
|
||||
defer th.TearDownServerTest()
|
||||
|
||||
// Get a random temporary filename for using as a mock systemd socket
|
||||
@@ -111,7 +111,7 @@ func TestRunServerSystemdNotification(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestRunServerNoSystemd(t *testing.T) {
|
||||
th := SetupServerTest()
|
||||
th := SetupServerTest(t)
|
||||
defer th.TearDownServerTest()
|
||||
|
||||
// Temporarily remove any Systemd socket defined in the environment
|
||||
|
||||
@@ -12,7 +12,7 @@ import (
|
||||
)
|
||||
|
||||
func TestCreateTeam(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
id := model.NewId()
|
||||
@@ -27,7 +27,7 @@ func TestCreateTeam(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestJoinTeam(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
th.CheckCommand(t, "team", "add", th.BasicTeam.Name, th.BasicUser.Email)
|
||||
@@ -47,7 +47,7 @@ func TestJoinTeam(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestLeaveTeam(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
th.CheckCommand(t, "team", "remove", th.BasicTeam.Name, th.BasicUser.Email)
|
||||
@@ -71,7 +71,7 @@ func TestLeaveTeam(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestListTeams(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
id := model.NewId()
|
||||
@@ -86,7 +86,7 @@ func TestListTeams(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestListArchivedTeams(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
id := model.NewId()
|
||||
@@ -103,7 +103,7 @@ func TestListArchivedTeams(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSearchTeamsByName(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
id := model.NewId()
|
||||
@@ -118,7 +118,7 @@ func TestSearchTeamsByName(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSearchTeamsByDisplayName(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
id := model.NewId()
|
||||
@@ -133,7 +133,7 @@ func TestSearchTeamsByDisplayName(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestSearchArchivedTeamsByName(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
id := model.NewId()
|
||||
@@ -150,7 +150,7 @@ func TestSearchArchivedTeamsByName(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestArchiveTeams(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
id := model.NewId()
|
||||
@@ -167,7 +167,7 @@ func TestArchiveTeams(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestRestoreTeams(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
id := model.NewId()
|
||||
@@ -186,7 +186,7 @@ func TestRestoreTeams(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestRenameTeam(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
team := th.CreateTeam()
|
||||
@@ -235,7 +235,7 @@ func TestRenameTeam(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestModifyTeam(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
team := th.CreateTeam()
|
||||
|
||||
@@ -11,7 +11,7 @@ import (
|
||||
)
|
||||
|
||||
func TestCreateUserWithTeam(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
id := model.NewId()
|
||||
@@ -37,7 +37,7 @@ func TestCreateUserWithTeam(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCreateUserWithoutTeam(t *testing.T) {
|
||||
th := Setup()
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
id := model.NewId()
|
||||
@@ -53,7 +53,7 @@ func TestCreateUserWithoutTeam(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestResetPassword(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
th.CheckCommand(t, "user", "password", th.BasicUser.Email, "password2")
|
||||
@@ -64,7 +64,7 @@ func TestResetPassword(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestMakeUserActiveAndInactive(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
// first inactivate the user
|
||||
@@ -75,7 +75,7 @@ func TestMakeUserActiveAndInactive(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestChangeUserEmail(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
newEmail := model.NewId() + "@mattermost-test.com"
|
||||
@@ -110,7 +110,7 @@ func TestChangeUserEmail(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDeleteUserBotUser(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
th.CheckCommand(t, "user", "delete", th.BasicUser.Username, "--confirm")
|
||||
@@ -137,7 +137,7 @@ func TestDeleteUserBotUser(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestConvertUser(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
t.Run("Invalid command line input", func(t *testing.T) {
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
)
|
||||
|
||||
func TestVersion(t *testing.T) {
|
||||
th := Setup()
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
th.CheckCommand(t, "version")
|
||||
|
||||
@@ -4,11 +4,12 @@
|
||||
package commands
|
||||
|
||||
import (
|
||||
"github.com/stretchr/testify/assert"
|
||||
"strconv"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/mattermost/mattermost-server/v5/api4"
|
||||
@@ -16,7 +17,7 @@ import (
|
||||
)
|
||||
|
||||
func TestListWebhooks(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
adminClient := th.SystemAdminClient
|
||||
|
||||
@@ -59,7 +60,7 @@ func TestListWebhooks(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestShowWebhook(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
adminClient := th.SystemAdminClient
|
||||
|
||||
@@ -125,7 +126,7 @@ func TestShowWebhook(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCreateIncomingWebhook(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
config := th.Config()
|
||||
@@ -173,7 +174,7 @@ func TestCreateIncomingWebhook(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestModifyIncomingWebhook(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
config := th.Config()
|
||||
@@ -237,7 +238,7 @@ func TestModifyIncomingWebhook(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCreateOutgoingWebhook(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
config := th.Config()
|
||||
@@ -302,7 +303,7 @@ func TestCreateOutgoingWebhook(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestModifyOutgoingWebhook(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
config := th.Config()
|
||||
@@ -396,7 +397,7 @@ func TestModifyOutgoingWebhook(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDeleteWebhooks(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
adminClient := th.SystemAdminClient
|
||||
|
||||
@@ -447,7 +448,7 @@ func TestDeleteWebhooks(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestMoveOutgoingWebhook(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
config := th.Config()
|
||||
|
||||
@@ -20,6 +20,9 @@ func getDsn(driver string, source string) string {
|
||||
}
|
||||
|
||||
func TestMigrateDatabaseToFile(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.SkipNow()
|
||||
}
|
||||
helper := testlib.NewMainHelper()
|
||||
sqlSettings := helper.GetSQLSettings()
|
||||
fileDSN := "config.json"
|
||||
@@ -62,6 +65,9 @@ func TestMigrateDatabaseToFile(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestMigrateFileToDatabaseWhenFilePathIsNotSpecified(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.SkipNow()
|
||||
}
|
||||
helper := testlib.NewMainHelper()
|
||||
sqlSettings := helper.GetSQLSettings()
|
||||
fileDSN := "config.json"
|
||||
|
||||
@@ -14,6 +14,9 @@ import (
|
||||
)
|
||||
|
||||
func TestNewStore(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.SkipNow()
|
||||
}
|
||||
sqlSettings := mainHelper.GetSQLSettings()
|
||||
|
||||
tempDir, err := ioutil.TempDir("", "TestNewStore")
|
||||
|
||||
@@ -13,6 +13,9 @@ import (
|
||||
)
|
||||
|
||||
func TestGetMigrationState(t *testing.T) {
|
||||
if testing.Short() {
|
||||
t.SkipNow()
|
||||
}
|
||||
th := Setup()
|
||||
defer th.TearDown()
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ func handlerForHTTPErrors(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func TestHandlerServeHTTPErrors(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
web := New(th.Server, th.Server.AppOptions, th.Server.Router)
|
||||
@@ -59,7 +59,7 @@ func handlerForHTTPSecureTransport(c *Context, w http.ResponseWriter, r *http.Re
|
||||
}
|
||||
|
||||
func TestHandlerServeHTTPSecureTransport(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
th.App.UpdateConfig(func(config *model.Config) {
|
||||
@@ -103,7 +103,7 @@ func handlerForCSRFToken(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func TestHandlerServeCSRFToken(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
session := &model.Session{
|
||||
@@ -243,7 +243,7 @@ func handlerForCSPHeader(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
func TestHandlerServeCSPHeader(t *testing.T) {
|
||||
t.Run("non-static", func(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
web := New(th.Server, th.Server.AppOptions, th.Server.Router)
|
||||
@@ -265,7 +265,7 @@ func TestHandlerServeCSPHeader(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("static, without subpath", func(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
web := New(th.Server, th.Server.AppOptions, th.Server.Router)
|
||||
@@ -287,7 +287,7 @@ func TestHandlerServeCSPHeader(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("static, with subpath", func(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) {
|
||||
@@ -342,7 +342,7 @@ func TestHandlerServeInvalidToken(t *testing.T) {
|
||||
|
||||
for _, tc := range testCases {
|
||||
t.Run(tc.Description, func(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) {
|
||||
@@ -379,7 +379,7 @@ func TestHandlerServeInvalidToken(t *testing.T) {
|
||||
|
||||
func TestCheckCSRFToken(t *testing.T) {
|
||||
t.Run("should allow a POST request with a valid CSRF token header", func(t *testing.T) {
|
||||
th := Setup()
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
h := &Handler{
|
||||
@@ -409,7 +409,7 @@ func TestCheckCSRFToken(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("should allow a POST request with an X-Requested-With header", func(t *testing.T) {
|
||||
th := Setup()
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
h := &Handler{
|
||||
@@ -440,7 +440,7 @@ func TestCheckCSRFToken(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("should not allow a POST request with an X-Requested-With header with strict CSRF enforcement enabled", func(t *testing.T) {
|
||||
th := Setup()
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) {
|
||||
@@ -475,7 +475,7 @@ func TestCheckCSRFToken(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("should not allow a POST request without either header", func(t *testing.T) {
|
||||
th := Setup()
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
h := &Handler{
|
||||
@@ -504,7 +504,7 @@ func TestCheckCSRFToken(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("should not check GET requests", func(t *testing.T) {
|
||||
th := Setup()
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
h := &Handler{
|
||||
@@ -533,7 +533,7 @@ func TestCheckCSRFToken(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("should not check a request passing the auth token in a header", func(t *testing.T) {
|
||||
th := Setup()
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
h := &Handler{
|
||||
@@ -562,7 +562,7 @@ func TestCheckCSRFToken(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("should not check a request passing a nil session", func(t *testing.T) {
|
||||
th := Setup()
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
h := &Handler{
|
||||
@@ -587,7 +587,7 @@ func TestCheckCSRFToken(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("should check requests for handlers that don't require a session but have one", func(t *testing.T) {
|
||||
th := Setup()
|
||||
th := Setup(t)
|
||||
defer th.TearDown()
|
||||
|
||||
h := &Handler{
|
||||
|
||||
@@ -21,7 +21,7 @@ import (
|
||||
)
|
||||
|
||||
func TestOAuthComplete_AccessDenied(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
c := &Context{
|
||||
@@ -45,7 +45,7 @@ func TestOAuthComplete_AccessDenied(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestAuthorizeOAuthApp(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
th.Login(ApiClient, th.SystemAdminUser)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -130,7 +130,7 @@ func TestAuthorizeOAuthApp(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestDeauthorizeOAuthApp(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
th.Login(ApiClient, th.SystemAdminUser)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -183,7 +183,7 @@ func TestOAuthAccessToken(t *testing.T) {
|
||||
t.SkipNow()
|
||||
}
|
||||
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
th.Login(ApiClient, th.SystemAdminUser)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -356,7 +356,7 @@ func TestOAuthComplete(t *testing.T) {
|
||||
t.SkipNow()
|
||||
}
|
||||
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
th.Login(ApiClient, th.SystemAdminUser)
|
||||
defer th.TearDown()
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ type TestHelper struct {
|
||||
tempWorkspace string
|
||||
}
|
||||
|
||||
func Setup() *TestHelper {
|
||||
func Setup(tb testing.TB) *TestHelper {
|
||||
store := mainHelper.GetStore()
|
||||
store.DropAllTables()
|
||||
|
||||
@@ -130,7 +130,7 @@ func (th *TestHelper) TearDown() {
|
||||
}
|
||||
|
||||
func TestStaticFilesRequest(t *testing.T) {
|
||||
th := Setup().InitPlugins()
|
||||
th := Setup(t).InitPlugins()
|
||||
defer th.TearDown()
|
||||
|
||||
pluginID := "com.mattermost.sample"
|
||||
@@ -216,7 +216,7 @@ func TestStaticFilesRequest(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPublicFilesRequest(t *testing.T) {
|
||||
th := Setup().InitPlugins()
|
||||
th := Setup(t).InitPlugins()
|
||||
defer th.TearDown()
|
||||
|
||||
pluginDir, err := ioutil.TempDir("", "")
|
||||
|
||||
@@ -17,7 +17,7 @@ import (
|
||||
)
|
||||
|
||||
func TestIncomingWebhook(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
if !*th.App.Config().ServiceSettings.EnableIncomingWebhooks {
|
||||
@@ -232,7 +232,7 @@ func TestIncomingWebhook(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCommandWebhooks(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
cmd, appErr := th.App.CreateCommand(&model.Command{
|
||||
|
||||
Ссылка в новой задаче
Block a user