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:
Corey Hulen
2016-05-24 14:31:30 -07:00
parent 4ae7128ecb
commit 09863c0b80
11 changed files with 597 additions and 310 deletions

View File

@@ -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()