Minor model/config.go coverage improvements (#14094)
* add TestConfigEnableDeveloper * remove dead code
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
911e636ec3
Коммит
b718618fbc
@@ -415,10 +415,6 @@ func (s *ServiceSettings) SetDefaults(isUpdate bool) {
|
|||||||
s.EnableIncomingWebhooks = NewBool(true)
|
s.EnableIncomingWebhooks = NewBool(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
if s.EnableIncomingWebhooks == nil {
|
|
||||||
s.EnableIncomingWebhooks = NewBool(true)
|
|
||||||
}
|
|
||||||
|
|
||||||
if s.EnableOutgoingWebhooks == nil {
|
if s.EnableOutgoingWebhooks == nil {
|
||||||
s.EnableOutgoingWebhooks = NewBool(true)
|
s.EnableOutgoingWebhooks = NewBool(true)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,6 +66,31 @@ func TestConfigEmptySiteName(t *testing.T) {
|
|||||||
require.Equal(t, *c1.TeamSettings.SiteName, TEAM_SETTINGS_DEFAULT_SITE_NAME)
|
require.Equal(t, *c1.TeamSettings.SiteName, TEAM_SETTINGS_DEFAULT_SITE_NAME)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestConfigEnableDeveloper(t *testing.T) {
|
||||||
|
testCases := []struct {
|
||||||
|
Description string
|
||||||
|
EnableDeveloper *bool
|
||||||
|
ExpectedSiteURL string
|
||||||
|
}{
|
||||||
|
{"enable developer is true", NewBool(true), SERVICE_SETTINGS_DEFAULT_SITE_URL},
|
||||||
|
{"enable developer is false", NewBool(false), ""},
|
||||||
|
{"enable developer is nil", nil, ""},
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, testCase := range testCases {
|
||||||
|
t.Run(testCase.Description, func(t *testing.T) {
|
||||||
|
c1 := Config{
|
||||||
|
ServiceSettings: ServiceSettings{
|
||||||
|
EnableDeveloper: testCase.EnableDeveloper,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
c1.SetDefaults()
|
||||||
|
|
||||||
|
require.Equal(t, testCase.ExpectedSiteURL, *c1.ServiceSettings.SiteURL)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestConfigDefaultFileSettingsDirectory(t *testing.T) {
|
func TestConfigDefaultFileSettingsDirectory(t *testing.T) {
|
||||||
c1 := Config{}
|
c1 := Config{}
|
||||||
c1.SetDefaults()
|
c1.SetDefaults()
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user