diff options
author | Joram Wilander <jwawilander@gmail.com> | 2017-03-03 12:25:32 -0500 |
---|---|---|
committer | Christopher Speller <crspeller@gmail.com> | 2017-03-03 12:25:32 -0500 |
commit | e739a91c94049aa62cfe76b9c6686fb18184232b (patch) | |
tree | 37d7f65f9f3fd59daea9d80473fd595eacd8c0f9 /api4/channel_test.go | |
parent | 2e911b77c3386833f8f0cea82c7b6b3e5583a08e (diff) | |
download | chat-e739a91c94049aa62cfe76b9c6686fb18184232b.tar.gz chat-e739a91c94049aa62cfe76b9c6686fb18184232b.tar.bz2 chat-e739a91c94049aa62cfe76b9c6686fb18184232b.zip |
Fix JS error when receiving reply during channel switch (#5582)
Diffstat (limited to 'api4/channel_test.go')
-rw-r--r-- | api4/channel_test.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/api4/channel_test.go b/api4/channel_test.go index 7dcc8dc96..c8faf7aa1 100644 --- a/api4/channel_test.go +++ b/api4/channel_test.go @@ -4,6 +4,7 @@ package api4 import ( + "fmt" "net/http" "strconv" "testing" @@ -504,6 +505,16 @@ func TestViewChannel(t *testing.T) { _, resp = Client.ViewChannel(th.BasicUser2.Id, view) CheckForbiddenStatus(t, resp) + if r, err := Client.DoApiPost(fmt.Sprintf("/channels/members/%v/view", th.BasicUser.Id), "garbage"); err == nil { + t.Fatal("should have errored") + } else { + if r.StatusCode != http.StatusBadRequest { + t.Log("actual: " + strconv.Itoa(r.StatusCode)) + t.Log("expected: " + strconv.Itoa(http.StatusBadRequest)) + t.Fatal("wrong status code") + } + } + Client.Logout() _, resp = Client.ViewChannel(th.BasicUser.Id, view) CheckUnauthorizedStatus(t, resp) |