From 23ccfc845ca2350075f6027e16c6206fc7b71716 Mon Sep 17 00:00:00 2001 From: Joram Wilander Date: Mon, 26 Jun 2017 08:16:57 -0400 Subject: Move remaining actions over to use redux and v4 endpoints (#6720) --- api4/post_test.go | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'api4/post_test.go') diff --git a/api4/post_test.go b/api4/post_test.go index bfc0c286a..abfd83989 100644 --- a/api4/post_test.go +++ b/api4/post_test.go @@ -752,6 +752,23 @@ func TestGetPost(t *testing.T) { CheckBadRequestStatus(t, resp) _, resp = Client.GetPost(model.NewId(), "") + CheckNotFoundStatus(t, resp) + + Client.RemoveUserFromChannel(th.BasicChannel.Id, th.BasicUser.Id) + + // Channel is public, should be able to read post + post, resp = Client.GetPost(th.BasicPost.Id, "") + CheckNoError(t, resp) + + privatePost := th.CreatePostWithClient(Client, th.BasicPrivateChannel) + + post, resp = Client.GetPost(privatePost.Id, "") + CheckNoError(t, resp) + + Client.RemoveUserFromChannel(th.BasicPrivateChannel.Id, th.BasicUser.Id) + + // Channel is private, should not be able to read post + post, resp = Client.GetPost(privatePost.Id, "") CheckForbiddenStatus(t, resp) Client.Logout() @@ -831,6 +848,23 @@ func TestGetPostThread(t *testing.T) { CheckBadRequestStatus(t, resp) _, resp = Client.GetPostThread(model.NewId(), "") + CheckNotFoundStatus(t, resp) + + Client.RemoveUserFromChannel(th.BasicChannel.Id, th.BasicUser.Id) + + // Channel is public, should be able to read post + _, resp = Client.GetPostThread(th.BasicPost.Id, "") + CheckNoError(t, resp) + + privatePost := th.CreatePostWithClient(Client, th.BasicPrivateChannel) + + _, resp = Client.GetPostThread(privatePost.Id, "") + CheckNoError(t, resp) + + Client.RemoveUserFromChannel(th.BasicPrivateChannel.Id, th.BasicUser.Id) + + // Channel is private, should not be able to read post + _, resp = Client.GetPostThread(privatePost.Id, "") CheckForbiddenStatus(t, resp) Client.Logout() -- cgit v1.2.3-1-g7c22