A user should not be able to vote on own content

This should be hidden in the UI as well, but the backend should support this too.
We also want to set initial rating of 1 for contents that need it.

This commit includes a new unittest for this case.

Reviewers: sybren

Differential Revision: https://developer.blender.org/D2825
This commit is contained in:
Dalai Felinto
2017-09-04 21:27:30 +02:00
parent eb467474f8
commit 216b9278af
2 changed files with 19 additions and 1 deletions

View File

@@ -48,6 +48,20 @@ class AbstractPatchCommentTest(AbstractPillarTest):
class VoteCommentTest(AbstractPatchCommentTest):
def test_upvote_self_comment(self):
# It should fail since we don't allow users to vote on own comment.
self.patch(self.node_url,
json={'op': 'upvote'},
auth_token='owner-token',
expected_status=403)
def test_downvote_self_comment(self):
# It should fail since we don't allow users to vote on own comment.
self.patch(self.node_url,
json={'op': 'downvote'},
auth_token='owner-token',
expected_status=403)
def test_upvote_other_comment(self):
# Patch the node
res = self.patch(self.node_url,