Passing t to all tests setup functions (#13841)
* Passing t to all tests setup functions * Fixing build
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
3b732fe257
Коммит
1d1ab03c38
@@ -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()
|
||||
|
||||
Ссылка в новой задаче
Block a user