Removing all FakeApp usages (#14174)
* Removing some other fake apps * More FakeApp removed * Removing entirely FakeApp * Fixing some tests * Fixing get Cluster id from get plugin status * Fixing failing tests * Fixing tests * Fixing test initialization for web * Fixing InitServer for server tests * Fixing InitServer for server tests * Reverting go.sum and go.mod * Removing unneded HTMLTemplates function in App layer * Moving back some functions to its old place to easy the review * Moving back some functions to its old place to easy the review * Using the last struct2interface version * Generating store layers * Fixing merge problems * Addressing PR comments * Small fix * Fixing app tests build * Fixing tests * fixing tests * Fix tests * Fixing tests * Fixing tests * Fixing tests * Moving license to server struct * Adding some fixes to the test compilation * Fixing cluster and some jobs initialization * Fixing some license tests compilation problems * Fixing recursive cache invalidation * Regenerating app layers * Fix test compilation Co-authored-by: mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
f3ac33e6dc
Коммит
f5eab1271b
@@ -337,7 +337,7 @@ func TestCreateUserWebSocketEvent(t *testing.T) {
|
||||
defer th.TearDown()
|
||||
|
||||
t.Run("guest should not received new_user event but user should", func(t *testing.T) {
|
||||
th.App.SetLicense(model.NewTestLicense("guests"))
|
||||
th.App.Srv().SetLicense(model.NewTestLicense("guests"))
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.GuestAccountsSettings.Enable = true })
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.GuestAccountsSettings.AllowEmailAccounts = true })
|
||||
|
||||
@@ -2332,7 +2332,7 @@ func TestUpdateUserMfa(t *testing.T) {
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
th.App.SetLicense(model.NewTestLicense("mfa"))
|
||||
th.App.Srv().SetLicense(model.NewTestLicense("mfa"))
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableMultifactorAuthentication = true })
|
||||
|
||||
session, _ := th.App.GetSession(th.Client.AuthToken)
|
||||
@@ -2372,7 +2372,7 @@ func TestCheckUserMfa(t *testing.T) {
|
||||
|
||||
require.False(t, required, "mfa not active")
|
||||
|
||||
th.App.SetLicense(model.NewTestLicense("mfa"))
|
||||
th.App.Srv().SetLicense(model.NewTestLicense("mfa"))
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableMultifactorAuthentication = true })
|
||||
|
||||
th.LoginBasic()
|
||||
@@ -2478,7 +2478,7 @@ func TestGenerateMfaSecret(t *testing.T) {
|
||||
_, resp = th.Client.GenerateMfaSecret("junk")
|
||||
CheckBadRequestStatus(t, resp)
|
||||
|
||||
th.App.SetLicense(model.NewTestLicense("mfa"))
|
||||
th.App.Srv().SetLicense(model.NewTestLicense("mfa"))
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableMultifactorAuthentication = true })
|
||||
|
||||
_, resp = th.Client.GenerateMfaSecret(model.NewId())
|
||||
@@ -3130,7 +3130,7 @@ func TestCBALogin(t *testing.T) {
|
||||
t.Run("primary", func(t *testing.T) {
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
th.App.SetLicense(model.NewTestLicense("saml"))
|
||||
th.App.Srv().SetLicense(model.NewTestLicense("saml"))
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) {
|
||||
*cfg.ServiceSettings.EnableBotAccountCreation = true
|
||||
@@ -3188,7 +3188,7 @@ func TestCBALogin(t *testing.T) {
|
||||
t.Run("secondary", func(t *testing.T) {
|
||||
th := Setup(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
th.App.SetLicense(model.NewTestLicense("saml"))
|
||||
th.App.Srv().SetLicense(model.NewTestLicense("saml"))
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) {
|
||||
*cfg.ServiceSettings.EnableBotAccountCreation = true
|
||||
@@ -3256,7 +3256,7 @@ func TestSwitchAccount(t *testing.T) {
|
||||
|
||||
require.NotEmpty(t, link, "bad link")
|
||||
|
||||
th.App.SetLicense(model.NewTestLicense())
|
||||
th.App.Srv().SetLicense(model.NewTestLicense())
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.ExperimentalEnableAuthenticationTransfer = false })
|
||||
|
||||
sr = &model.SwitchRequest{
|
||||
@@ -4607,10 +4607,10 @@ func TestDemoteUserToGuest(t *testing.T) {
|
||||
enableGuestAccounts := *th.App.Config().GuestAccountsSettings.Enable
|
||||
defer func() {
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.GuestAccountsSettings.Enable = enableGuestAccounts })
|
||||
th.App.RemoveLicense()
|
||||
th.App.Srv().RemoveLicense()
|
||||
}()
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.GuestAccountsSettings.Enable = true })
|
||||
th.App.SetLicense(model.NewTestLicense())
|
||||
th.App.Srv().SetLicense(model.NewTestLicense())
|
||||
_, respErr := th.SystemAdminClient.GetUser(user.Id, "")
|
||||
CheckNoError(t, respErr)
|
||||
_, respErr = th.SystemAdminClient.DemoteUserToGuest(user.Id)
|
||||
@@ -4660,10 +4660,10 @@ func TestPromoteGuestToUser(t *testing.T) {
|
||||
enableGuestAccounts := *th.App.Config().GuestAccountsSettings.Enable
|
||||
defer func() {
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.GuestAccountsSettings.Enable = enableGuestAccounts })
|
||||
th.App.RemoveLicense()
|
||||
th.App.Srv().RemoveLicense()
|
||||
}()
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.GuestAccountsSettings.Enable = true })
|
||||
th.App.SetLicense(model.NewTestLicense())
|
||||
th.App.Srv().SetLicense(model.NewTestLicense())
|
||||
_, respErr := th.SystemAdminClient.GetUser(user.Id, "")
|
||||
CheckNoError(t, respErr)
|
||||
_, respErr = th.SystemAdminClient.PromoteGuestToUser(user.Id)
|
||||
|
||||
Ссылка в новой задаче
Block a user