From ad2ab81ee43a8652f66e89a738b5282befdd479b Mon Sep 17 00:00:00 2001 From: George Goldberg Date: Fri, 7 Apr 2017 19:49:02 +0100 Subject: PLT-6254: Search not in teams include removed members. (#6020) --- store/sql_user_store_test.go | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'store/sql_user_store_test.go') diff --git a/store/sql_user_store_test.go b/store/sql_user_store_test.go index bfd74d55a..84b7712aa 100644 --- a/store/sql_user_store_test.go +++ b/store/sql_user_store_test.go @@ -1659,6 +1659,44 @@ func TestUserStoreSearch(t *testing.T) { t.Fatal("should not have found user") } } + + // Check SearchNotInTeam finds previously deleted team members. + Must(store.Team().SaveMember(&model.TeamMember{TeamId: tid, UserId: u4.Id})) + + if r1 := <-store.User().SearchNotInTeam(tid, "simo", searchOptions); r1.Err != nil { + t.Fatal(r1.Err) + } else { + profiles := r1.Data.([]*model.User) + found := false + for _, profile := range profiles { + if profile.Id == u4.Id { + found = true + break + } + } + + if found { + t.Fatal("should not have found user") + } + } + + Must(store.Team().UpdateMember(&model.TeamMember{TeamId: tid, UserId: u4.Id, DeleteAt: model.GetMillis() - 1000})) + if r1 := <-store.User().SearchNotInTeam(tid, "simo", searchOptions); r1.Err != nil { + t.Fatal(r1.Err) + } else { + profiles := r1.Data.([]*model.User) + found := false + for _, profile := range profiles { + if profile.Id == u4.Id { + found = true + break + } + } + + if !found { + t.Fatal("should have found user") + } + } } func TestUserStoreSearchWithoutTeam(t *testing.T) { -- cgit v1.2.3-1-g7c22