PLT-6162: Search for users not in a given team. (#5943)

Этот коммит содержится в:
George Goldberg
2017-04-03 18:11:12 +01:00
коммит произвёл Harrison Healey
родитель da5265681d
Коммит 232a99f0c7
7 изменённых файлов: 130 добавлений и 0 удалений

Просмотреть файл

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