mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
Adding APIs to reload config, recycle db connections and ping server (#3096)
* Adding APIs to reload config, recycle db connections and ping server * Fixing unit test * Adding unit tests
This commit is contained in:
@@ -39,20 +39,6 @@ func TestGetAllAudits(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetClientProperties(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
|
||||
if result, err := th.BasicClient.GetClientProperties(); err != nil {
|
||||
t.Fatal(err)
|
||||
} else {
|
||||
props := result.Data.(map[string]string)
|
||||
|
||||
if len(props["Version"]) == 0 {
|
||||
t.Fatal()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetConfig(t *testing.T) {
|
||||
th := Setup().InitBasic().InitSystemAdmin()
|
||||
|
||||
@@ -102,6 +88,21 @@ func TestGetConfig(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestReloadConfig(t *testing.T) {
|
||||
th := Setup().InitBasic().InitSystemAdmin()
|
||||
|
||||
if _, err := th.BasicClient.ReloadConfig(); err == nil {
|
||||
t.Fatal("Shouldn't have permissions")
|
||||
}
|
||||
|
||||
if _, err := th.SystemAdminClient.ReloadConfig(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
utils.Cfg.TeamSettings.MaxUsersPerTeam = 50
|
||||
*utils.Cfg.TeamSettings.EnableOpenServer = true
|
||||
}
|
||||
|
||||
func TestSaveConfig(t *testing.T) {
|
||||
th := Setup().InitBasic().InitSystemAdmin()
|
||||
|
||||
@@ -118,6 +119,18 @@ func TestSaveConfig(t *testing.T) {
|
||||
*utils.Cfg.TeamSettings.EnableOpenServer = true
|
||||
}
|
||||
|
||||
func TestRecycleDatabaseConnection(t *testing.T) {
|
||||
th := Setup().InitBasic().InitSystemAdmin()
|
||||
|
||||
if _, err := th.BasicClient.RecycleDatabaseConnection(); err == nil {
|
||||
t.Fatal("Shouldn't have permissions")
|
||||
}
|
||||
|
||||
if _, err := th.SystemAdminClient.RecycleDatabaseConnection(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestEmailTest(t *testing.T) {
|
||||
th := Setup().InitBasic().InitSystemAdmin()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user