summaryrefslogtreecommitdiffstats
path: root/api4
diff options
context:
space:
mode:
authorSaturnino Abril <saturnino.abril@gmail.com>2017-08-31 01:54:16 +0800
committerJoram Wilander <jwawilander@gmail.com>2017-08-30 13:54:16 -0400
commit651dd33b29b7b8b296cc5a12479684fa836867b1 (patch)
tree60d4f385f50ab7f6b8aa75bdb6de2d98508c8784 /api4
parent4c1f4674425ffeb430aa07f3fccbb09837f36a34 (diff)
downloadchat-651dd33b29b7b8b296cc5a12479684fa836867b1.tar.gz
chat-651dd33b29b7b8b296cc5a12479684fa836867b1.tar.bz2
chat-651dd33b29b7b8b296cc5a12479684fa836867b1.zip
set to default value with config is missing (#7320)
Diffstat (limited to 'api4')
-rw-r--r--api4/apitestlib.go12
-rw-r--r--api4/command_test.go4
-rw-r--r--api4/emoji.go4
-rw-r--r--api4/emoji_test.go8
-rw-r--r--api4/file_test.go14
-rw-r--r--api4/system_test.go4
-rw-r--r--api4/user.go2
-rw-r--r--api4/user_test.go6
8 files changed, 27 insertions, 27 deletions
diff --git a/api4/apitestlib.go b/api4/apitestlib.go
index b10e639e3..b634de0d4 100644
--- a/api4/apitestlib.go
+++ b/api4/apitestlib.go
@@ -48,7 +48,7 @@ func SetupEnterprise() *TestHelper {
utils.TranslationsPreInit()
utils.LoadConfig("config.json")
utils.InitTranslations(utils.Cfg.LocalizationSettings)
- utils.Cfg.TeamSettings.MaxUsersPerTeam = 50
+ *utils.Cfg.TeamSettings.MaxUsersPerTeam = 50
*utils.Cfg.RateLimitSettings.Enable = false
utils.Cfg.EmailSettings.SendEmailNotifications = true
utils.Cfg.EmailSettings.SMTPServer = "dockerhost"
@@ -85,7 +85,7 @@ func Setup() *TestHelper {
utils.TranslationsPreInit()
utils.LoadConfig("config.json")
utils.InitTranslations(utils.Cfg.LocalizationSettings)
- utils.Cfg.TeamSettings.MaxUsersPerTeam = 50
+ *utils.Cfg.TeamSettings.MaxUsersPerTeam = 50
*utils.Cfg.RateLimitSettings.Enable = false
utils.Cfg.EmailSettings.SendEmailNotifications = true
utils.Cfg.EmailSettings.SMTPServer = "dockerhost"
@@ -212,11 +212,11 @@ func (me *TestHelper) InitSystemAdmin() *TestHelper {
}
func (me *TestHelper) CreateClient() *model.Client4 {
- return model.NewAPIv4Client("http://localhost" + utils.Cfg.ServiceSettings.ListenAddress)
+ return model.NewAPIv4Client("http://localhost" + *utils.Cfg.ServiceSettings.ListenAddress)
}
func (me *TestHelper) CreateWebSocketClient() (*model.WebSocketClient, *model.AppError) {
- return model.NewWebSocketClient4("ws://localhost"+utils.Cfg.ServiceSettings.ListenAddress, me.Client.AuthToken)
+ return model.NewWebSocketClient4("ws://localhost"+*utils.Cfg.ServiceSettings.ListenAddress, me.Client.AuthToken)
}
func (me *TestHelper) CreateUser() *model.User {
@@ -658,7 +658,7 @@ func s3New(endpoint, accessKey, secretKey string, secure bool, signV2 bool, regi
}
func cleanupTestFile(info *model.FileInfo) error {
- if utils.Cfg.FileSettings.DriverName == model.IMAGE_DRIVER_S3 {
+ if *utils.Cfg.FileSettings.DriverName == model.IMAGE_DRIVER_S3 {
endpoint := utils.Cfg.FileSettings.AmazonS3Endpoint
accessKey := utils.Cfg.FileSettings.AmazonS3AccessKeyId
secretKey := utils.Cfg.FileSettings.AmazonS3SecretAccessKey
@@ -685,7 +685,7 @@ func cleanupTestFile(info *model.FileInfo) error {
return err
}
}
- } else if utils.Cfg.FileSettings.DriverName == model.IMAGE_DRIVER_LOCAL {
+ } else if *utils.Cfg.FileSettings.DriverName == model.IMAGE_DRIVER_LOCAL {
if err := os.Remove(utils.Cfg.FileSettings.Directory + info.Path); err != nil {
return err
}
diff --git a/api4/command_test.go b/api4/command_test.go
index b0d5f4baa..8f0303c55 100644
--- a/api4/command_test.go
+++ b/api4/command_test.go
@@ -399,7 +399,7 @@ func TestExecuteCommand(t *testing.T) {
postCmd := &model.Command{
CreatorId: th.BasicUser.Id,
TeamId: th.BasicTeam.Id,
- URL: "http://localhost" + utils.Cfg.ServiceSettings.ListenAddress + model.API_URL_SUFFIX_V4 + "/teams/command_test",
+ URL: "http://localhost" + *utils.Cfg.ServiceSettings.ListenAddress + model.API_URL_SUFFIX_V4 + "/teams/command_test",
Method: model.COMMAND_METHOD_POST,
Trigger: "postcommand",
}
@@ -423,7 +423,7 @@ func TestExecuteCommand(t *testing.T) {
getCmd := &model.Command{
CreatorId: th.BasicUser.Id,
TeamId: th.BasicTeam.Id,
- URL: "http://localhost" + utils.Cfg.ServiceSettings.ListenAddress + model.API_URL_SUFFIX_V4 + "/teams/command_test",
+ URL: "http://localhost" + *utils.Cfg.ServiceSettings.ListenAddress + model.API_URL_SUFFIX_V4 + "/teams/command_test",
Method: model.COMMAND_METHOD_GET,
Trigger: "getcommand",
}
diff --git a/api4/emoji.go b/api4/emoji.go
index f29573383..11801169d 100644
--- a/api4/emoji.go
+++ b/api4/emoji.go
@@ -37,7 +37,7 @@ func createEmoji(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
- if len(utils.Cfg.FileSettings.DriverName) == 0 {
+ if len(*utils.Cfg.FileSettings.DriverName) == 0 {
c.Err = model.NewAppError("createEmoji", "api.emoji.storage.app_error", nil, "", http.StatusNotImplemented)
return
}
@@ -147,7 +147,7 @@ func getEmojiImage(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
- if len(utils.Cfg.FileSettings.DriverName) == 0 {
+ if len(*utils.Cfg.FileSettings.DriverName) == 0 {
c.Err = model.NewAppError("getEmojiImage", "api.emoji.storage.app_error", nil, "", http.StatusNotImplemented)
return
}
diff --git a/api4/emoji_test.go b/api4/emoji_test.go
index 2ca18a9cc..067e9964e 100644
--- a/api4/emoji_test.go
+++ b/api4/emoji_test.go
@@ -313,10 +313,10 @@ func TestGetEmojiImage(t *testing.T) {
Client := th.Client
EnableCustomEmoji := *utils.Cfg.ServiceSettings.EnableCustomEmoji
- DriverName := utils.Cfg.FileSettings.DriverName
+ DriverName := *utils.Cfg.FileSettings.DriverName
defer func() {
*utils.Cfg.ServiceSettings.EnableCustomEmoji = EnableCustomEmoji
- utils.Cfg.FileSettings.DriverName = DriverName
+ *utils.Cfg.FileSettings.DriverName = DriverName
}()
*utils.Cfg.ServiceSettings.EnableCustomEmoji = true
@@ -334,14 +334,14 @@ func TestGetEmojiImage(t *testing.T) {
CheckNotImplementedStatus(t, resp)
CheckErrorMessage(t, resp, "api.emoji.disabled.app_error")
- utils.Cfg.FileSettings.DriverName = ""
+ *utils.Cfg.FileSettings.DriverName = ""
*utils.Cfg.ServiceSettings.EnableCustomEmoji = true
_, resp = Client.GetEmojiImage(emoji1.Id)
CheckNotImplementedStatus(t, resp)
CheckErrorMessage(t, resp, "api.emoji.storage.app_error")
- utils.Cfg.FileSettings.DriverName = DriverName
+ *utils.Cfg.FileSettings.DriverName = DriverName
emojiImage, resp := Client.GetEmojiImage(emoji1.Id)
CheckNoError(t, resp)
diff --git a/api4/file_test.go b/api4/file_test.go
index a2673dc8e..04c0a8569 100644
--- a/api4/file_test.go
+++ b/api4/file_test.go
@@ -124,7 +124,7 @@ func TestGetFile(t *testing.T) {
Client := th.Client
channel := th.BasicChannel
- if utils.Cfg.FileSettings.DriverName == "" {
+ if *utils.Cfg.FileSettings.DriverName == "" {
t.Skip("skipping because no file driver is enabled")
}
@@ -174,7 +174,7 @@ func TestGetFileHeaders(t *testing.T) {
Client := th.Client
channel := th.BasicChannel
- if utils.Cfg.FileSettings.DriverName == "" {
+ if *utils.Cfg.FileSettings.DriverName == "" {
t.Skip("skipping because no file driver is enabled")
}
@@ -238,7 +238,7 @@ func TestGetFileThumbnail(t *testing.T) {
Client := th.Client
channel := th.BasicChannel
- if utils.Cfg.FileSettings.DriverName == "" {
+ if *utils.Cfg.FileSettings.DriverName == "" {
t.Skip("skipping because no file driver is enabled")
}
@@ -290,7 +290,7 @@ func TestGetFileLink(t *testing.T) {
Client := th.Client
channel := th.BasicChannel
- if utils.Cfg.FileSettings.DriverName == "" {
+ if *utils.Cfg.FileSettings.DriverName == "" {
t.Skip("skipping because no file driver is enabled")
}
@@ -365,7 +365,7 @@ func TestGetFilePreview(t *testing.T) {
Client := th.Client
channel := th.BasicChannel
- if utils.Cfg.FileSettings.DriverName == "" {
+ if *utils.Cfg.FileSettings.DriverName == "" {
t.Skip("skipping because no file driver is enabled")
}
@@ -418,7 +418,7 @@ func TestGetFileInfo(t *testing.T) {
user := th.BasicUser
channel := th.BasicChannel
- if utils.Cfg.FileSettings.DriverName == "" {
+ if *utils.Cfg.FileSettings.DriverName == "" {
t.Skip("skipping because no file driver is enabled")
}
@@ -484,7 +484,7 @@ func TestGetPublicFile(t *testing.T) {
Client := th.Client
channel := th.BasicChannel
- if utils.Cfg.FileSettings.DriverName == "" {
+ if *utils.Cfg.FileSettings.DriverName == "" {
t.Skip("skipping because no file driver is enabled")
}
diff --git a/api4/system_test.go b/api4/system_test.go
index 09afa0c1c..004f94f96 100644
--- a/api4/system_test.go
+++ b/api4/system_test.go
@@ -68,7 +68,7 @@ func TestGetConfig(t *testing.T) {
if cfg.GitLabSettings.Secret != model.FAKE_SETTING && len(cfg.GitLabSettings.Secret) != 0 {
t.Fatal("did not sanitize properly")
}
- if cfg.SqlSettings.DataSource != model.FAKE_SETTING {
+ if *cfg.SqlSettings.DataSource != model.FAKE_SETTING {
t.Fatal("did not sanitize properly")
}
if cfg.SqlSettings.AtRestEncryptKey != model.FAKE_SETTING {
@@ -99,7 +99,7 @@ func TestReloadConfig(t *testing.T) {
t.Fatal("should Reload the config")
}
- utils.Cfg.TeamSettings.MaxUsersPerTeam = 50
+ *utils.Cfg.TeamSettings.MaxUsersPerTeam = 50
*utils.Cfg.TeamSettings.EnableOpenServer = true
}
diff --git a/api4/user.go b/api4/user.go
index 365248c0f..f755270cf 100644
--- a/api4/user.go
+++ b/api4/user.go
@@ -233,7 +233,7 @@ func setProfileImage(c *Context, w http.ResponseWriter, r *http.Request) {
return
}
- if len(utils.Cfg.FileSettings.DriverName) == 0 {
+ if len(*utils.Cfg.FileSettings.DriverName) == 0 {
c.Err = model.NewLocAppError("uploadProfileImage", "api.user.upload_profile_user.storage.app_error", nil, "")
c.Err.StatusCode = http.StatusNotImplemented
return
diff --git a/api4/user_test.go b/api4/user_test.go
index 894187469..e353ad7b1 100644
--- a/api4/user_test.go
+++ b/api4/user_test.go
@@ -1672,11 +1672,11 @@ func TestUpdateUserPassword(t *testing.T) {
th.LoginBasic()
// Test lockout
- passwordAttempts := utils.Cfg.ServiceSettings.MaximumLoginAttempts
+ passwordAttempts := *utils.Cfg.ServiceSettings.MaximumLoginAttempts
defer func() {
- utils.Cfg.ServiceSettings.MaximumLoginAttempts = passwordAttempts
+ *utils.Cfg.ServiceSettings.MaximumLoginAttempts = passwordAttempts
}()
- utils.Cfg.ServiceSettings.MaximumLoginAttempts = 2
+ *utils.Cfg.ServiceSettings.MaximumLoginAttempts = 2
// Fail twice
_, resp = Client.UpdateUserPassword(th.BasicUser.Id, "badpwd", "newpwd")