MM-63791: guest permissions to teams (#30789)

* improve th.CreateGuestAndClient

* test coverage for guest user access to teams

* restrict guest access to public teams unless a member
Этот коммит содержится в:
Jesse Hallam
2025-04-22 10:12:22 -03:00
коммит произвёл GitHub
родитель 79561c44c2
Коммит 701ddc896a
5 изменённых файлов: 122 добавлений и 19 удалений

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

@@ -41,7 +41,7 @@ func TestCreateChannelBookmark(t *testing.T) {
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.GuestAccountsSettings.Enable = true })
th.App.Srv().SetLicense(model.NewTestLicense())
guest, guestClient := th.CreateGuestAndClient()
guest, guestClient := th.CreateGuestAndClient(t)
t.Run("a user should be able to create a channel bookmark in a public channel", func(t *testing.T) {
channelBookmark := &model.ChannelBookmark{
@@ -297,7 +297,7 @@ func TestEditChannelBookmark(t *testing.T) {
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.GuestAccountsSettings.Enable = true })
th.App.Srv().SetLicense(model.NewTestLicense())
guest, guestClient := th.CreateGuestAndClient()
guest, guestClient := th.CreateGuestAndClient(t)
t.Run("a user editing a channel bookmark in public and private channels", func(t *testing.T) {
testCases := []struct {
@@ -732,7 +732,7 @@ func TestUpdateChannelBookmarkSortOrder(t *testing.T) {
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.GuestAccountsSettings.Enable = true })
th.App.Srv().SetLicense(model.NewTestLicense())
guest, guestClient := th.CreateGuestAndClient()
guest, guestClient := th.CreateGuestAndClient(t)
t.Run("a user updating a bookmark's order in public and private channels", func(t *testing.T) {
testCases := []struct {
@@ -1121,7 +1121,7 @@ func TestDeleteChannelBookmark(t *testing.T) {
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.GuestAccountsSettings.Enable = true })
th.App.Srv().SetLicense(model.NewTestLicense())
guest, guestClient := th.CreateGuestAndClient()
guest, guestClient := th.CreateGuestAndClient(t)
t.Run("a user deleting bookmarks in public and private channels", func(t *testing.T) {
testCases := []struct {
@@ -1494,7 +1494,7 @@ func TestListChannelBookmarksForChannel(t *testing.T) {
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.GuestAccountsSettings.Enable = true })
th.App.Srv().SetLicense(model.NewTestLicense())
guest, guestClient := th.CreateGuestAndClient()
guest, guestClient := th.CreateGuestAndClient(t)
publicBookmark1 := createBookmark("one", th.BasicChannel.Id)
publicBookmark2 := createBookmark("two", th.BasicChannel.Id)