summaryrefslogtreecommitdiffstats
path: root/store/sql_user_store_test.go
diff options
context:
space:
mode:
authorGeorge Goldberg <george@gberg.me>2017-04-03 18:11:12 +0100
committerHarrison Healey <harrisonmhealey@gmail.com>2017-04-03 13:11:12 -0400
commit232a99f0c7b9364cb4386264f9ff7f97549a4378 (patch)
tree8f90f7e4fae36b7043e6ab360aafe9e0769060ac /store/sql_user_store_test.go
parentda5265681d42549ad9072d762fec67293d742d43 (diff)
downloadchat-232a99f0c7b9364cb4386264f9ff7f97549a4378.tar.gz
chat-232a99f0c7b9364cb4386264f9ff7f97549a4378.tar.bz2
chat-232a99f0c7b9364cb4386264f9ff7f97549a4378.zip
PLT-6162: Search for users not in a given team. (#5943)
Diffstat (limited to 'store/sql_user_store_test.go')
-rw-r--r--store/sql_user_store_test.go41
1 files changed, 41 insertions, 0 deletions
diff --git a/store/sql_user_store_test.go b/store/sql_user_store_test.go
index 6e9642b60..db1ade5f7 100644
--- a/store/sql_user_store_test.go
+++ b/store/sql_user_store_test.go
@@ -1546,6 +1546,47 @@ func TestUserStoreSearch(t *testing.T) {
t.Fatal("should have found user")
}
}
+
+ // Search Users not in Team.
+ u4 := &model.User{}
+ u4.Username = "simon" + model.NewId()
+ u4.Email = model.NewId()
+ u4.DeleteAt = 0
+ Must(store.User().Save(u4))
+
+ 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")
+ }
+ }
+
+ if r1 := <-store.User().SearchNotInTeam(tid, "jimb", searchOptions); r1.Err != nil {
+ t.Fatal(r1.Err)
+ } else {
+ profiles := r1.Data.([]*model.User)
+ found := false
+ for _, profile := range profiles {
+ if profile.Id == u1.Id {
+ found = true
+ break
+ }
+ }
+
+ if found {
+ t.Fatal("should not have found user")
+ }
+ }
}
func TestUserStoreSearchWithoutTeam(t *testing.T) {