summaryrefslogtreecommitdiffstats
path: root/store/sql_user_store_test.go
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2016-11-21 12:17:53 -0500
committerHarrison Healey <harrisonmhealey@gmail.com>2016-11-21 12:17:53 -0500
commit062f758e47cda90a9ae783cbaee6bf3bec571178 (patch)
tree8d8fe056ee50d325c3e465529f7a4a34b3a8051b /store/sql_user_store_test.go
parenta9824a3653a30779f7fd0cc62e329c988f02b519 (diff)
downloadchat-062f758e47cda90a9ae783cbaee6bf3bec571178.tar.gz
chat-062f758e47cda90a9ae783cbaee6bf3bec571178.tar.bz2
chat-062f758e47cda90a9ae783cbaee6bf3bec571178.zip
Fix user search when using an asterisk (#4586)
Diffstat (limited to 'store/sql_user_store_test.go')
-rw-r--r--store/sql_user_store_test.go26
1 files changed, 26 insertions, 0 deletions
diff --git a/store/sql_user_store_test.go b/store/sql_user_store_test.go
index e58e1fe40..acd87a036 100644
--- a/store/sql_user_store_test.go
+++ b/store/sql_user_store_test.go
@@ -981,6 +981,32 @@ func TestUserStoreSearch(t *testing.T) {
}
}
+ // * should be treated as a space
+ if r1 := <-store.User().Search(tid, "jimb*", searchOptions); r1.Err != nil {
+ t.Fatal(r1.Err)
+ } else {
+ profiles := r1.Data.([]*model.User)
+ found1 := false
+ found2 := false
+ for _, profile := range profiles {
+ if profile.Id == u1.Id {
+ found1 = true
+ }
+
+ if profile.Id == u3.Id {
+ found2 = true
+ }
+ }
+
+ if !found1 {
+ t.Fatal("should have found user")
+ }
+
+ if found2 {
+ t.Fatal("should not have found inactive user")
+ }
+ }
+
if r1 := <-store.User().Search(tid, "harol", searchOptions); r1.Err != nil {
t.Fatal(r1.Err)
} else {