From e739a91c94049aa62cfe76b9c6686fb18184232b Mon Sep 17 00:00:00 2001 From: Joram Wilander Date: Fri, 3 Mar 2017 12:25:32 -0500 Subject: Fix JS error when receiving reply during channel switch (#5582) --- api4/channel_test.go | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'api4/channel_test.go') 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) -- cgit v1.2.3-1-g7c22