diff options
author | Joram Wilander <jwawilander@gmail.com> | 2016-11-29 10:12:59 -0500 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2016-11-29 10:12:59 -0500 |
commit | 02d581c1599c5d50cc507bd2633f1e3c34b1cc84 (patch) | |
tree | 73437f73a8031b8c792e4b6652d1eb2428c6f2d7 /api/user_test.go | |
parent | ad52183248512b9aafa59b4429364c75e024cf6f (diff) | |
download | chat-02d581c1599c5d50cc507bd2633f1e3c34b1cc84.tar.gz chat-02d581c1599c5d50cc507bd2633f1e3c34b1cc84.tar.bz2 chat-02d581c1599c5d50cc507bd2633f1e3c34b1cc84.zip |
PLT-4697 Update channel switcher to autocomplete all users on the system (#4624)
* Add autocomplete API for system-wide users
* Update channel switcher to autocomplete all users on the system
Diffstat (limited to 'api/user_test.go')
-rw-r--r-- | api/user_test.go | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/api/user_test.go b/api/user_test.go index a10cee961..02ea71c83 100644 --- a/api/user_test.go +++ b/api/user_test.go @@ -2275,6 +2275,44 @@ func TestAutocompleteUsers(t *testing.T) { th := Setup().InitBasic() Client := th.BasicClient + if result, err := Client.AutocompleteUsers(th.BasicUser.Username); err != nil { + t.Fatal(err) + } else { + users := result.Data.([]*model.User) + if len(users) != 1 { + t.Fatal("should have returned 1 user in") + } + } + + if result, err := Client.AutocompleteUsers(""); err != nil { + t.Fatal(err) + } else { + users := result.Data.([]*model.User) + if len(users) == 0 { + t.Fatal("should have many users") + } + } + + notInTeamUser := th.CreateUser(Client) + + if result, err := Client.AutocompleteUsers(notInTeamUser.Username); err != nil { + t.Fatal(err) + } else { + users := result.Data.([]*model.User) + if len(users) != 1 { + t.Fatal("should have returned 1 user in") + } + } + + if result, err := Client.AutocompleteUsersInTeam(notInTeamUser.Username); err != nil { + t.Fatal(err) + } else { + autocomplete := result.Data.(*model.UserAutocompleteInTeam) + if len(autocomplete.InTeam) != 0 { + t.Fatal("should have returned 0 users") + } + } + if result, err := Client.AutocompleteUsersInTeam(th.BasicUser.Username); err != nil { t.Fatal(err) } else { |