PLT-4935 Fix searching for full email (#4947)

* Fix searching for full email

* Fix unit test
This commit is contained in:
Joram Wilander
2017-01-03 17:11:44 -05:00
committed by Harrison Healey
parent 3ae8e9789e
commit 3df8f33437
2 changed files with 58 additions and 10 deletions

View File

@@ -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)