MM-14037 Ensure deprecated image proxy settings are read correctly (#10249)

Этот коммит содержится в:
Harrison Healey
2019-02-08 10:08:36 -05:00
коммит произвёл Jesse Hallam
родитель 3a8e8739b2
Коммит 4dbeaffdf0
2 изменённых файлов: 22 добавлений и 3 удалений

Просмотреть файл

@@ -278,9 +278,9 @@ type ServiceSettings struct {
ExperimentalEnableDefaultChannelLeaveJoinMessages *bool
ExperimentalGroupUnreadChannels *string
ExperimentalChannelOrganization *bool
DEPRECATED_DO_NOT_USE_ImageProxyType *string `json:"ImageProxyType"` // This field is deprecated and must not be used.
DEPRECATED_DO_NOT_USE_ImageProxyURL *string `json:"ImageProxyURL"` // This field is deprecated and must not be used.
DEPRECATED_DO_NOT_USE_ImageProxyOptions *string `json:"ImageProxyOptions"` // This field is deprecated and must not be used.
DEPRECATED_DO_NOT_USE_ImageProxyType *string `json:"ImageProxyType" mapstructure:"ImageProxyType"` // This field is deprecated and must not be used.
DEPRECATED_DO_NOT_USE_ImageProxyURL *string `json:"ImageProxyURL" mapstructure:"ImageProxyURL"` // This field is deprecated and must not be used.
DEPRECATED_DO_NOT_USE_ImageProxyOptions *string `json:"ImageProxyOptions" mapstructure:"ImageProxyOptions"` // This field is deprecated and must not be used.
EnableAPITeamDeletion *bool
ExperimentalEnableHardenedMode *bool
ExperimentalStrictCSRFEnforcement *bool

Просмотреть файл

@@ -109,6 +109,25 @@ func TestReadConfig_PluginSettings(t *testing.T) {
}, *config.PluginSettings.PluginStates["jira"])
}
}
func TestReadConfig_ImageProxySettings(t *testing.T) {
TranslationsPreInit()
t.Run("deprecated settings should still be read properly", func(t *testing.T) {
config, _, err := ReadConfig(bytes.NewReader([]byte(`{
"ServiceSettings": {
"ImageProxyType": "OldImageProxyType",
"ImageProxyURL": "OldImageProxyURL",
"ImageProxyOptions": "OldImageProxyOptions"
}
}`)), false)
require.Nil(t, err)
assert.Equal(t, model.NewString("OldImageProxyType"), config.ServiceSettings.DEPRECATED_DO_NOT_USE_ImageProxyType)
assert.Equal(t, model.NewString("OldImageProxyURL"), config.ServiceSettings.DEPRECATED_DO_NOT_USE_ImageProxyURL)
assert.Equal(t, model.NewString("OldImageProxyOptions"), config.ServiceSettings.DEPRECATED_DO_NOT_USE_ImageProxyOptions)
})
}
func TestConfigFromEnviroVars(t *testing.T) {
TranslationsPreInit()