diff options
author | Carlos Tadeu Panato Junior <ctadeu@gmail.com> | 2016-12-20 16:55:22 +0100 |
---|---|---|
committer | Corey Hulen <corey@hulen.com> | 2016-12-20 07:55:22 -0800 |
commit | b9092ca2f56b0fa2b8ec7719c2ec5cfe5a21a6c9 (patch) | |
tree | f9d8a0aee0937acca727786db077fa38039304db /api/channel_test.go | |
parent | 92b2810d84bda78b87f23d5e3d8d04de1c3d9125 (diff) | |
download | chat-b9092ca2f56b0fa2b8ec7719c2ec5cfe5a21a6c9.tar.gz chat-b9092ca2f56b0fa2b8ec7719c2ec5cfe5a21a6c9.tar.bz2 chat-b9092ca2f56b0fa2b8ec7719c2ec5cfe5a21a6c9.zip |
Fix API Get channels for a user returns users' dm channels with blank teamid (#4748)
* fix API Get channels for a user returns users' dm channels with blank team ID
add check in the context.go
add suggestion
made adjustment per review and support from @joram
* update tests
* add check if needd user or admin permissions
* update per review
Diffstat (limited to 'api/channel_test.go')
-rw-r--r-- | api/channel_test.go | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/api/channel_test.go b/api/channel_test.go index 683deb8a9..c916a27cf 100644 --- a/api/channel_test.go +++ b/api/channel_test.go @@ -745,10 +745,21 @@ func TestGetChannel(t *testing.T) { t.Fatal("should have failed - bad channel id") } - Client.SetTeamId(team2.Id) + th.BasicClient.SetTeamId(team2.Id) if _, err := Client.GetChannel(channel2.Id, ""); err == nil { t.Fatal("should have failed - wrong team") } + + //Test if a wrong team id is supplied should return error + if _, err := Client.CreateDirectChannel(th.BasicUser2.Id); err != nil { + t.Fatal(err) + } + + th.BasicClient.SetTeamId("nonexitingteamid") + if _, err := Client.GetChannels(""); err == nil { + t.Fatal("should have failed - wrong team id") + } + } func TestGetMoreChannelsPage(t *testing.T) { |