Eliminate utils.SetLicense calls (#8217)
* eliminate utils.SetLicense calls * test fix * another test fix * more test fixes
Этот коммит содержится в:
@@ -1566,18 +1566,7 @@ func TestUpdateUserMfa(t *testing.T) {
|
||||
defer th.TearDown()
|
||||
Client := th.Client
|
||||
|
||||
isLicensed := utils.IsLicensed()
|
||||
license := utils.License()
|
||||
enableMfa := *th.App.Config().ServiceSettings.EnableMultifactorAuthentication
|
||||
defer func() {
|
||||
utils.SetIsLicensed(isLicensed)
|
||||
utils.SetLicense(license)
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableMultifactorAuthentication = enableMfa })
|
||||
}()
|
||||
utils.SetIsLicensed(true)
|
||||
utils.SetLicense(&model.License{Features: &model.Features{}})
|
||||
utils.License().Features.SetDefaults()
|
||||
*utils.License().Features.MFA = true
|
||||
th.App.SetLicense(model.NewTestLicense("mfa"))
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableMultifactorAuthentication = true })
|
||||
|
||||
session, _ := th.App.GetSession(Client.AuthToken)
|
||||
@@ -1612,18 +1601,7 @@ func TestCheckUserMfa(t *testing.T) {
|
||||
t.Fatal("should be false - mfa not active")
|
||||
}
|
||||
|
||||
isLicensed := utils.IsLicensed()
|
||||
license := utils.License()
|
||||
enableMfa := *th.App.Config().ServiceSettings.EnableMultifactorAuthentication
|
||||
defer func() {
|
||||
utils.SetIsLicensed(isLicensed)
|
||||
utils.SetLicense(license)
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableMultifactorAuthentication = enableMfa })
|
||||
}()
|
||||
utils.SetIsLicensed(true)
|
||||
utils.SetLicense(&model.License{Features: &model.Features{}})
|
||||
utils.License().Features.SetDefaults()
|
||||
*utils.License().Features.MFA = true
|
||||
th.App.SetLicense(model.NewTestLicense("mfa"))
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableMultifactorAuthentication = true })
|
||||
|
||||
th.LoginBasic()
|
||||
@@ -1659,18 +1637,7 @@ func TestGenerateMfaSecret(t *testing.T) {
|
||||
_, resp = Client.GenerateMfaSecret("junk")
|
||||
CheckBadRequestStatus(t, resp)
|
||||
|
||||
isLicensed := utils.IsLicensed()
|
||||
license := utils.License()
|
||||
enableMfa := *th.App.Config().ServiceSettings.EnableMultifactorAuthentication
|
||||
defer func() {
|
||||
utils.SetIsLicensed(isLicensed)
|
||||
utils.SetLicense(license)
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableMultifactorAuthentication = enableMfa })
|
||||
}()
|
||||
utils.SetIsLicensed(true)
|
||||
utils.SetLicense(&model.License{Features: &model.Features{}})
|
||||
utils.License().Features.SetDefaults()
|
||||
*utils.License().Features.MFA = true
|
||||
th.App.SetLicense(model.NewTestLicense("mfa"))
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableMultifactorAuthentication = true })
|
||||
|
||||
_, resp = Client.GenerateMfaSecret(model.NewId())
|
||||
@@ -2187,19 +2154,7 @@ func TestSwitchAccount(t *testing.T) {
|
||||
t.Fatal("bad link")
|
||||
}
|
||||
|
||||
isLicensed := utils.IsLicensed()
|
||||
license := utils.License()
|
||||
enableAuthenticationTransfer := *th.App.Config().ServiceSettings.ExperimentalEnableAuthenticationTransfer
|
||||
defer func() {
|
||||
utils.SetIsLicensed(isLicensed)
|
||||
utils.SetLicense(license)
|
||||
th.App.UpdateConfig(func(cfg *model.Config) {
|
||||
*cfg.ServiceSettings.ExperimentalEnableAuthenticationTransfer = enableAuthenticationTransfer
|
||||
})
|
||||
}()
|
||||
utils.SetIsLicensed(true)
|
||||
utils.SetLicense(&model.License{Features: &model.Features{}})
|
||||
utils.License().Features.SetDefaults()
|
||||
th.App.SetLicense(model.NewTestLicense())
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.ExperimentalEnableAuthenticationTransfer = false })
|
||||
|
||||
sr = &model.SwitchRequest{
|
||||
|
||||
Ссылка в новой задаче
Block a user