MM-10640 Set EnableUserCreation to true by default (#8815)

* Set EnableUserCreation to true by default

* Fix argument type to FormatBool

* Convert EnableUserCreation instances to pointer

* Convert to boolean in tests also

* Set value of pointer to be false

* Convert remaining EnableUserCreation instances to pointer
This commit is contained in:
Balasankar C
2018-05-18 19:27:30 +05:30
committed by Harrison Healey
parent c6cbce6100
commit d3ead7dc85
8 changed files with 19 additions and 14 deletions

View File

@@ -63,7 +63,7 @@ func TestCreateUser(t *testing.T) {
CheckBadRequestStatus(t, resp)
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.TeamSettings.EnableOpenServer = false })
th.App.UpdateConfig(func(cfg *model.Config) { cfg.TeamSettings.EnableUserCreation = false })
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.TeamSettings.EnableUserCreation = false })
user2 := &model.User{Email: th.GenerateTestEmail(), Password: "Password1", Username: GenerateTestUsername()}
_, resp = AdminClient.CreateUser(user2)
@@ -170,13 +170,13 @@ func TestCreateUserWithToken(t *testing.T) {
<-th.App.Srv.Store.Token().Save(token)
defer th.App.DeleteToken(token)
th.App.UpdateConfig(func(cfg *model.Config) { cfg.TeamSettings.EnableUserCreation = false })
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.TeamSettings.EnableUserCreation = false })
_, resp := Client.CreateUserWithToken(&user, token.Token)
CheckNotImplementedStatus(t, resp)
CheckErrorMessage(t, resp, "api.user.create_user.signup_email_disabled.app_error")
th.App.UpdateConfig(func(cfg *model.Config) { cfg.TeamSettings.EnableUserCreation = true })
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.TeamSettings.EnableUserCreation = true })
})
t.Run("EnableOpenServerDisable", func(t *testing.T) {
@@ -270,7 +270,7 @@ func TestCreateUserWithInviteId(t *testing.T) {
t.Run("EnableUserCreationDisable", func(t *testing.T) {
user := model.User{Email: th.GenerateTestEmail(), Nickname: "Corey Hulen", Password: "hello1", Username: GenerateTestUsername(), Roles: model.SYSTEM_ADMIN_ROLE_ID + " " + model.SYSTEM_USER_ROLE_ID}
th.App.UpdateConfig(func(cfg *model.Config) { cfg.TeamSettings.EnableUserCreation = false })
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.TeamSettings.EnableUserCreation = false })
inviteId := th.BasicTeam.InviteId
@@ -278,7 +278,7 @@ func TestCreateUserWithInviteId(t *testing.T) {
CheckNotImplementedStatus(t, resp)
CheckErrorMessage(t, resp, "api.user.create_user.signup_email_disabled.app_error")
th.App.UpdateConfig(func(cfg *model.Config) { cfg.TeamSettings.EnableUserCreation = true })
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.TeamSettings.EnableUserCreation = true })
})
t.Run("EnableOpenServerDisable", func(t *testing.T) {