mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
Add updateConfig endpoint for apiV4 (#5706)
This commit is contained in:
committed by
George Goldberg
parent
9b10f3ef54
commit
ac8282cda1
@@ -5,6 +5,7 @@ import (
|
||||
"testing"
|
||||
|
||||
l4g "github.com/alecthomas/log4go"
|
||||
"github.com/mattermost/platform/app"
|
||||
"github.com/mattermost/platform/model"
|
||||
"github.com/mattermost/platform/utils"
|
||||
)
|
||||
@@ -88,6 +89,47 @@ func TestReloadConfig(t *testing.T) {
|
||||
*utils.Cfg.TeamSettings.EnableOpenServer = true
|
||||
}
|
||||
|
||||
func TestUpdateConfig(t *testing.T) {
|
||||
th := Setup().InitBasic().InitSystemAdmin()
|
||||
defer TearDown()
|
||||
Client := th.Client
|
||||
|
||||
cfg := app.GetConfig()
|
||||
|
||||
_, resp := Client.UpdateConfig(cfg)
|
||||
CheckForbiddenStatus(t, resp)
|
||||
|
||||
SiteName := utils.Cfg.TeamSettings.SiteName
|
||||
|
||||
cfg.TeamSettings.SiteName = "MyFancyName"
|
||||
cfg, resp = th.SystemAdminClient.UpdateConfig(cfg)
|
||||
CheckNoError(t, resp)
|
||||
|
||||
if len(cfg.TeamSettings.SiteName) == 0 {
|
||||
t.Fatal()
|
||||
} else {
|
||||
if cfg.TeamSettings.SiteName != "MyFancyName" {
|
||||
t.Log("It should update the SiteName")
|
||||
t.Fatal()
|
||||
}
|
||||
}
|
||||
|
||||
//Revert the change
|
||||
cfg.TeamSettings.SiteName = SiteName
|
||||
cfg, resp = th.SystemAdminClient.UpdateConfig(cfg)
|
||||
CheckNoError(t, resp)
|
||||
|
||||
if len(cfg.TeamSettings.SiteName) == 0 {
|
||||
t.Fatal()
|
||||
} else {
|
||||
if cfg.TeamSettings.SiteName != SiteName {
|
||||
t.Log("It should update the SiteName")
|
||||
t.Fatal()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func TestEmailTest(t *testing.T) {
|
||||
th := Setup().InitBasic().InitSystemAdmin()
|
||||
defer TearDown()
|
||||
|
||||
Reference in New Issue
Block a user