[MM-24337]: Fix the team and channel filtering UT to include empty team or channel (#15912)
* Fix the team and channel filtering UT to include empty team or channel * Fix tests that were failing before this change Once we've activated the team/channels filter tests for PostgreSQL and MySQL there are some tests failing so this changes fixes them * Disable team filtering tests for DBs by now We have a discrepancy between DB search and ES/Bleve on how to filter teams when you have users in both teams: - DB when filtering by one team and searching by another returns users that are in both teams - Bleve and ES returns empty Co-authored-by: Mario de Frutos <mario@defrutos.org> Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
@@ -20,7 +20,7 @@ var searchUserStoreTests = []searchTest{
|
||||
{
|
||||
Name: "Should honor channel restrictions when autocompleting users",
|
||||
Fn: testHonorChannelRestrictionsAutocompletingUsers,
|
||||
Tags: []string{ENGINE_ELASTICSEARCH, ENGINE_BLEVE},
|
||||
Tags: []string{ENGINE_ALL},
|
||||
},
|
||||
{
|
||||
Name: "Should honor team restrictions when autocompleting users",
|
||||
@@ -238,7 +238,7 @@ func testHonorChannelRestrictionsAutocompletingUsers(t *testing.T, th *SearchTes
|
||||
})
|
||||
t.Run("Autocomplete users with all channels restricted", func(t *testing.T) {
|
||||
options := createDefaultOptions(true, false, false)
|
||||
options.ViewRestrictions = &model.ViewUsersRestrictions{Channels: []string{}}
|
||||
options.ViewRestrictions = &model.ViewUsersRestrictions{Teams: []string{}, Channels: []string{}}
|
||||
users, apperr := th.Store.User().AutocompleteUsersInChannel(th.Team.Id, th.ChannelBasic.Id, "", options)
|
||||
require.Nil(t, apperr)
|
||||
th.assertUsersMatchInAnyOrder(t, []*model.User{}, users.InChannel)
|
||||
@@ -246,7 +246,7 @@ func testHonorChannelRestrictionsAutocompletingUsers(t *testing.T, th *SearchTes
|
||||
})
|
||||
t.Run("Autocomplete users with all channels restricted but with empty team", func(t *testing.T) {
|
||||
options := createDefaultOptions(true, false, false)
|
||||
options.ViewRestrictions = &model.ViewUsersRestrictions{Channels: []string{}}
|
||||
options.ViewRestrictions = &model.ViewUsersRestrictions{Teams: []string{}, Channels: []string{}}
|
||||
users, apperr := th.Store.User().AutocompleteUsersInChannel("", th.ChannelBasic.Id, "", options)
|
||||
require.Nil(t, apperr)
|
||||
th.assertUsersMatchInAnyOrder(t, []*model.User{}, users.InChannel)
|
||||
@@ -273,7 +273,7 @@ func testHonorTeamRestrictionsAutocompletingUsers(t *testing.T, th *SearchTestHe
|
||||
})
|
||||
t.Run("Should return empty because we're filtering all the teams", func(t *testing.T) {
|
||||
options := createDefaultOptions(true, false, false)
|
||||
options.ViewRestrictions = &model.ViewUsersRestrictions{Teams: []string{}}
|
||||
options.ViewRestrictions = &model.ViewUsersRestrictions{Teams: []string{}, Channels: []string{}}
|
||||
users, apperr := th.Store.User().AutocompleteUsersInChannel(th.Team.Id, th.ChannelBasic.Id, "", options)
|
||||
require.Nil(t, apperr)
|
||||
th.assertUsersMatchInAnyOrder(t, []*model.User{}, users.InChannel)
|
||||
|
||||
Ссылка в новой задаче
Block a user