summaryrefslogtreecommitdiffstats
path: root/store/sql_user_store_test.go
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2017-01-03 17:11:44 -0500
committerHarrison Healey <harrisonmhealey@gmail.com>2017-01-03 17:11:44 -0500
commit3df8f334379f1977b3122fb78d0c742309e91a3b (patch)
tree2b4fa764242f5d35c1f1262e2b7c1d8869ab009a /store/sql_user_store_test.go
parent3ae8e9789e8c4408f1ec8fef195210e339ea17a4 (diff)
downloadchat-3df8f334379f1977b3122fb78d0c742309e91a3b.tar.gz
chat-3df8f334379f1977b3122fb78d0c742309e91a3b.tar.bz2
chat-3df8f334379f1977b3122fb78d0c742309e91a3b.zip
PLT-4935 Fix searching for full email (#4947)
* Fix searching for full email * Fix unit test
Diffstat (limited to 'store/sql_user_store_test.go')
-rw-r--r--store/sql_user_store_test.go22
1 files changed, 21 insertions, 1 deletions
diff --git a/store/sql_user_store_test.go b/store/sql_user_store_test.go
index 765a164e3..fb04e95c9 100644
--- a/store/sql_user_store_test.go
+++ b/store/sql_user_store_test.go
@@ -986,7 +986,7 @@ func TestUserStoreSearch(t *testing.T) {
u1.FirstName = "Tim"
u1.LastName = "Bill"
u1.Nickname = "Rob"
- u1.Email = "harold" + model.NewId()
+ u1.Email = "harold" + model.NewId() + "@simulator.amazonses.com"
Must(store.User().Save(u1))
u2 := &model.User{}
@@ -1033,6 +1033,26 @@ func TestUserStoreSearch(t *testing.T) {
}
}
+ searchOptions[USER_SEARCH_OPTION_NAMES_ONLY] = false
+
+ if r1 := <-store.User().Search(tid, u1.Email, searchOptions); r1.Err != nil {
+ t.Fatal(r1.Err)
+ } else {
+ profiles := r1.Data.([]*model.User)
+ found1 := false
+ for _, profile := range profiles {
+ if profile.Id == u1.Id {
+ found1 = true
+ }
+ }
+
+ if !found1 {
+ t.Fatal("should have found user")
+ }
+ }
+
+ searchOptions[USER_SEARCH_OPTION_NAMES_ONLY] = true
+
// * should be treated as a space
if r1 := <-store.User().Search(tid, "jimb*", searchOptions); r1.Err != nil {
t.Fatal(r1.Err)