summaryrefslogtreecommitdiffstats
path: root/api4/post_test.go
diff options
context:
space:
mode:
authorJoram Wilander <jwawilander@gmail.com>2017-06-26 08:16:57 -0400
committerGitHub <noreply@github.com>2017-06-26 08:16:57 -0400
commit23ccfc845ca2350075f6027e16c6206fc7b71716 (patch)
tree3fd1f896a5a24b43913be03b21c85638dd7c356e /api4/post_test.go
parentfe7e9d95b30ae2195fcba68db960866db91ce045 (diff)
downloadchat-23ccfc845ca2350075f6027e16c6206fc7b71716.tar.gz
chat-23ccfc845ca2350075f6027e16c6206fc7b71716.tar.bz2
chat-23ccfc845ca2350075f6027e16c6206fc7b71716.zip
Move remaining actions over to use redux and v4 endpoints (#6720)
Diffstat (limited to 'api4/post_test.go')
-rw-r--r--api4/post_test.go34
1 files changed, 34 insertions, 0 deletions
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()