MM-10658 Change config fields to pointers (#9033)
* MM 10658 Change config fields to pointers (#8898) * Change fields of config structs to pointers and set defaults MM-10658 https://github.com/mattermost/mattermost-server/issues/8841 * Fix tests that go broken during switching config structs to pointers MM-10658 https://github.com/mattermost/mattermost-server/issues/8841 * Apply changes of current master while switching config structs to pointers MM-10658 https://github.com/mattermost/mattermost-server/issues/8841 * Fix new config pointer uses * Fix app tests * Fix mail test * remove debugging statement * fix TestUpdateConfig * assign config consistently * initialize AmazonS3Region in TestS3TestConnection * initialize fields for TestEmailTest * fix TestCheckMandatoryS3Fields
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
0c981aa010
Коммит
2ca222033c
@@ -20,7 +20,7 @@ func TestGetOAuthAccessTokenForImplicitFlow(t *testing.T) {
|
||||
th := Setup().InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { cfg.ServiceSettings.EnableOAuthServiceProvider = true })
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableOAuthServiceProvider = true })
|
||||
|
||||
oapp := &model.OAuthApp{
|
||||
Name: "fakeoauthapp" + model.NewRandomString(10),
|
||||
@@ -45,13 +45,13 @@ func TestGetOAuthAccessTokenForImplicitFlow(t *testing.T) {
|
||||
assert.Nil(t, err)
|
||||
assert.NotNil(t, session)
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { cfg.ServiceSettings.EnableOAuthServiceProvider = false })
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableOAuthServiceProvider = false })
|
||||
|
||||
session, err = th.App.GetOAuthAccessTokenForImplicitFlow(th.BasicUser.Id, authRequest)
|
||||
assert.NotNil(t, err, "should fail - oauth2 disabled")
|
||||
assert.Nil(t, session)
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { cfg.ServiceSettings.EnableOAuthServiceProvider = true })
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableOAuthServiceProvider = true })
|
||||
authRequest.ClientId = "junk"
|
||||
|
||||
session, err = th.App.GetOAuthAccessTokenForImplicitFlow(th.BasicUser.Id, authRequest)
|
||||
@@ -105,7 +105,7 @@ func TestOAuthDeleteApp(t *testing.T) {
|
||||
th := Setup()
|
||||
defer th.TearDown()
|
||||
|
||||
th.App.Config().ServiceSettings.EnableOAuthServiceProvider = true
|
||||
*th.App.Config().ServiceSettings.EnableOAuthServiceProvider = true
|
||||
|
||||
a1 := &model.OAuthApp{}
|
||||
a1.CreatorId = model.NewId()
|
||||
@@ -154,18 +154,18 @@ func TestAuthorizeOAuthUser(t *testing.T) {
|
||||
th := Setup()
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) {
|
||||
cfg.GitLabSettings.Enable = enable
|
||||
*cfg.GitLabSettings.Enable = enable
|
||||
|
||||
if tokenEndpoint {
|
||||
cfg.GitLabSettings.TokenEndpoint = serverURL + "/token"
|
||||
*cfg.GitLabSettings.TokenEndpoint = serverURL + "/token"
|
||||
} else {
|
||||
cfg.GitLabSettings.TokenEndpoint = ""
|
||||
*cfg.GitLabSettings.TokenEndpoint = ""
|
||||
}
|
||||
|
||||
if userEndpoint {
|
||||
cfg.GitLabSettings.UserApiEndpoint = serverURL + "/user"
|
||||
*cfg.GitLabSettings.UserApiEndpoint = serverURL + "/user"
|
||||
} else {
|
||||
cfg.GitLabSettings.UserApiEndpoint = ""
|
||||
*cfg.GitLabSettings.UserApiEndpoint = ""
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user