diff options
author | Andrei Stanciu <andrei.stanciu@geminisols.ro> | 2017-02-28 17:47:30 +0200 |
---|---|---|
committer | George Goldberg <george@gberg.me> | 2017-02-28 15:47:30 +0000 |
commit | 25b9b7d26b8738343d269c83031ba5a5408d0d58 (patch) | |
tree | 7f70c50bfdf9fe588268426005bb6305f6a074a7 /api4/team_test.go | |
parent | b0410615b8206ea2706312a9f413785d86134f6d (diff) | |
download | chat-25b9b7d26b8738343d269c83031ba5a5408d0d58.tar.gz chat-25b9b7d26b8738343d269c83031ba5a5408d0d58.tar.bz2 chat-25b9b7d26b8738343d269c83031ba5a5408d0d58.zip |
ApiV4: GET /users/{user_id}/teams/unread (#5539)
Diffstat (limited to 'api4/team_test.go')
-rw-r--r-- | api4/team_test.go | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/api4/team_test.go b/api4/team_test.go index a4ec1a6e2..e54cf4414 100644 --- a/api4/team_test.go +++ b/api4/team_test.go @@ -463,3 +463,34 @@ func TestUpdateTeamMemberRoles(t *testing.T) { _, resp = Client.UpdateTeamMemberRoles(th.BasicTeam.Id, th.BasicUser.Id, TEAM_MEMBER) CheckNoError(t, resp) } + +func TestGetMyTeamsUnread(t *testing.T) { + th := Setup().InitBasic().InitSystemAdmin() + defer TearDown() + Client := th.Client + + user := th.BasicUser + Client.Login(user.Email, user.Password) + + teams, resp := Client.GetTeamsUnreadForUser(user.Id, "") + CheckNoError(t, resp) + if len(teams) == 0 { + t.Fatal("should have results") + } + + teams, resp = Client.GetTeamsUnreadForUser(user.Id, th.BasicTeam.Id) + CheckNoError(t, resp) + if len(teams) != 0 { + t.Fatal("should not have results") + } + + _, resp = Client.GetTeamsUnreadForUser("fail", "") + CheckBadRequestStatus(t, resp) + + _, resp = Client.GetTeamsUnreadForUser(model.NewId(), "") + CheckForbiddenStatus(t, resp) + + Client.Logout() + _, resp = Client.GetTeamsUnreadForUser(user.Id, "") + CheckUnauthorizedStatus(t, resp) +}
\ No newline at end of file |