summaryrefslogtreecommitdiffstats
path: root/api4/system_test.go
diff options
context:
space:
mode:
authorCarlos Tadeu Panato Junior <ctadeu@gmail.com>2017-03-20 13:37:34 +0100
committerGeorge Goldberg <george@gberg.me>2017-03-20 12:37:34 +0000
commitac8282cda1455802f52ebe6687eeeef6c950bf49 (patch)
treea0eb38c5de6c6605399f91bf35b0fc5434bd4911 /api4/system_test.go
parent9b10f3ef5450886bc2eb47fc58b649ff67109b1d (diff)
downloadchat-ac8282cda1455802f52ebe6687eeeef6c950bf49.tar.gz
chat-ac8282cda1455802f52ebe6687eeeef6c950bf49.tar.bz2
chat-ac8282cda1455802f52ebe6687eeeef6c950bf49.zip
Add updateConfig endpoint for apiV4 (#5706)
Diffstat (limited to 'api4/system_test.go')
-rw-r--r--api4/system_test.go42
1 files changed, 42 insertions, 0 deletions
diff --git a/api4/system_test.go b/api4/system_test.go
index 80b4996ca..658bb5881 100644
--- a/api4/system_test.go
+++ b/api4/system_test.go
@@ -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()