* 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>
Этот коммит содержится в:
Jesús Espino
2020-06-12 13:43:50 +02:00
коммит произвёл GitHub
родитель f3ac33e6dc
Коммит f5eab1271b
88 изменённых файлов: 973 добавлений и 1177 удалений

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

@@ -1647,8 +1647,8 @@ func TestAddTeamMember(t *testing.T) {
team := th.BasicTeam
otherUser := th.CreateUser()
th.App.SetLicense(model.NewTestLicense(""))
defer th.App.SetLicense(nil)
th.App.Srv().SetLicense(model.NewTestLicense(""))
defer th.App.Srv().SetLicense(nil)
enableGuestAccounts := *th.App.Config().GuestAccountsSettings.Enable
defer func() {
@@ -1731,7 +1731,7 @@ func TestAddTeamMember(t *testing.T) {
// Update user to team admin
th.UpdateUserToTeamAdmin(th.BasicUser, th.BasicTeam)
th.App.InvalidateAllCaches()
th.App.Srv().InvalidateAllCaches()
th.LoginBasic()
// Should work as a team admin.
@@ -1745,7 +1745,7 @@ func TestAddTeamMember(t *testing.T) {
th.RemovePermissionFromRole(model.PERMISSION_ADD_USER_TO_TEAM.Id, model.TEAM_ADMIN_ROLE_ID)
th.UpdateUserToNonTeamAdmin(th.BasicUser, th.BasicTeam)
th.App.InvalidateAllCaches()
th.App.Srv().InvalidateAllCaches()
th.LoginBasic()
// Should work as a regular user.
@@ -1800,8 +1800,8 @@ func TestAddTeamMember(t *testing.T) {
th.App.DeleteToken(token)
// by invite_id
th.App.SetLicense(model.NewTestLicense(""))
defer th.App.SetLicense(nil)
th.App.Srv().SetLicense(model.NewTestLicense(""))
defer th.App.Srv().SetLicense(nil)
_, resp = Client.Login(guest.Email, guest.Password)
CheckNoError(t, resp)
@@ -2094,7 +2094,7 @@ func TestAddTeamMembers(t *testing.T) {
// Update user to team admin
th.UpdateUserToTeamAdmin(th.BasicUser, th.BasicTeam)
th.App.InvalidateAllCaches()
th.App.Srv().InvalidateAllCaches()
th.LoginBasic()
// Should work as a team admin.
@@ -2108,7 +2108,7 @@ func TestAddTeamMembers(t *testing.T) {
th.RemovePermissionFromRole(model.PERMISSION_ADD_USER_TO_TEAM.Id, model.TEAM_ADMIN_ROLE_ID)
th.UpdateUserToNonTeamAdmin(th.BasicUser, th.BasicTeam)
th.App.InvalidateAllCaches()
th.App.Srv().InvalidateAllCaches()
th.LoginBasic()
// Should work as a regular user.
@@ -2755,7 +2755,7 @@ func TestInviteGuestsToTeam(t *testing.T) {
th.App.UpdateConfig(func(cfg *model.Config) { cfg.GuestAccountsSettings.Enable = &enableGuestAccounts })
}()
th.App.SetLicense(model.NewTestLicense(""))
th.App.Srv().SetLicense(model.NewTestLicense(""))
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.GuestAccountsSettings.Enable = false })
_, resp := th.SystemAdminClient.InviteGuestsToTeam(th.BasicTeam.Id, emailList, []string{th.BasicChannel.Id}, "test-message")
@@ -2768,13 +2768,13 @@ func TestInviteGuestsToTeam(t *testing.T) {
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.EnableEmailInvitations = true })
th.App.SetLicense(nil)
th.App.Srv().SetLicense(nil)
_, resp = th.SystemAdminClient.InviteGuestsToTeam(th.BasicTeam.Id, emailList, []string{th.BasicChannel.Id}, "test-message")
require.NotNil(t, resp.Error, "Should be disabled")
th.App.SetLicense(model.NewTestLicense(""))
defer th.App.SetLicense(nil)
th.App.Srv().SetLicense(model.NewTestLicense(""))
defer th.App.Srv().SetLicense(nil)
okMsg, resp := th.SystemAdminClient.InviteGuestsToTeam(th.BasicTeam.Id, emailList, []string{th.BasicChannel.Id}, "test-message")
CheckNoError(t, resp)
@@ -2973,7 +2973,7 @@ func TestUpdateTeamScheme(t *testing.T) {
th := Setup(t).InitBasic()
defer th.TearDown()
th.App.SetLicense(model.NewTestLicense(""))
th.App.Srv().SetLicense(model.NewTestLicense(""))
th.App.SetPhase2PermissionsMigrationStatus(true)
@@ -3025,10 +3025,10 @@ func TestUpdateTeamScheme(t *testing.T) {
CheckForbiddenStatus(t, resp)
// Test that a license is required.
th.App.SetLicense(nil)
th.App.Srv().SetLicense(nil)
_, resp = th.SystemAdminClient.UpdateTeamScheme(team.Id, teamScheme.Id)
CheckNotImplementedStatus(t, resp)
th.App.SetLicense(model.NewTestLicense(""))
th.App.Srv().SetLicense(model.NewTestLicense(""))
// Test an invalid scheme scope.
_, resp = th.SystemAdminClient.UpdateTeamScheme(team.Id, channelScheme.Id)