Restore config after finisht the test case (#9085)

Этот коммит содержится в:
Carlos Tadeu Panato Junior
2018-07-11 12:58:16 +02:00
коммит произвёл GitHub
родитель 7c08ff9986
Коммит 7ed712f938
6 изменённых файлов: 152 добавлений и 5 удалений

Просмотреть файл

@@ -163,6 +163,11 @@ func TestLoadTestHelpCommands(t *testing.T) {
Client := th.Client
channel := th.BasicChannel
enableTesting := th.App.Config().ServiceSettings.EnableTesting
defer func() {
th.App.UpdateConfig(func(cfg *model.Config) { cfg.ServiceSettings.EnableTesting = enableTesting })
}()
th.App.UpdateConfig(func(cfg *model.Config) { cfg.ServiceSettings.EnableTesting = true })
rs := Client.Must(Client.ExecuteCommand(channel.Id, "/test help")).(*model.CommandResponse)
@@ -180,6 +185,11 @@ func TestLoadTestSetupCommands(t *testing.T) {
Client := th.Client
channel := th.BasicChannel
enableTesting := th.App.Config().ServiceSettings.EnableTesting
defer func() {
th.App.UpdateConfig(func(cfg *model.Config) { cfg.ServiceSettings.EnableTesting = enableTesting })
}()
th.App.UpdateConfig(func(cfg *model.Config) { cfg.ServiceSettings.EnableTesting = true })
rs := Client.Must(Client.ExecuteCommand(channel.Id, "/test setup fuzz 1 1 1")).(*model.CommandResponse)
@@ -197,6 +207,11 @@ func TestLoadTestUsersCommands(t *testing.T) {
Client := th.Client
channel := th.BasicChannel
enableTesting := th.App.Config().ServiceSettings.EnableTesting
defer func() {
th.App.UpdateConfig(func(cfg *model.Config) { cfg.ServiceSettings.EnableTesting = enableTesting })
}()
th.App.UpdateConfig(func(cfg *model.Config) { cfg.ServiceSettings.EnableTesting = true })
rs := Client.Must(Client.ExecuteCommand(channel.Id, "/test users fuzz 1 2")).(*model.CommandResponse)
@@ -214,6 +229,11 @@ func TestLoadTestChannelsCommands(t *testing.T) {
Client := th.Client
channel := th.BasicChannel
enableTesting := th.App.Config().ServiceSettings.EnableTesting
defer func() {
th.App.UpdateConfig(func(cfg *model.Config) { cfg.ServiceSettings.EnableTesting = enableTesting })
}()
th.App.UpdateConfig(func(cfg *model.Config) { cfg.ServiceSettings.EnableTesting = true })
rs := Client.Must(Client.ExecuteCommand(channel.Id, "/test channels fuzz 1 2")).(*model.CommandResponse)
@@ -231,6 +251,11 @@ func TestLoadTestPostsCommands(t *testing.T) {
Client := th.Client
channel := th.BasicChannel
enableTesting := th.App.Config().ServiceSettings.EnableTesting
defer func() {
th.App.UpdateConfig(func(cfg *model.Config) { cfg.ServiceSettings.EnableTesting = enableTesting })
}()
th.App.UpdateConfig(func(cfg *model.Config) { cfg.ServiceSettings.EnableTesting = true })
rs := Client.Must(Client.ExecuteCommand(channel.Id, "/test posts fuzz 2 3 2")).(*model.CommandResponse)