aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/check-params/videos.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-02-22 14:16:34 +0100
committerChocobozzz <me@florianbigard.com>2022-02-22 14:16:51 +0100
commit6ea9295b8f5dd7cc254202a79aad61c666cc4259 (patch)
tree0345d57eb47c5b5cd0046fee1456b0dc440ae470 /server/tests/api/check-params/videos.ts
parentfdd5da058aeffb161202124a129789a3c2bb234c (diff)
downloadPeerTube-6ea9295b8f5dd7cc254202a79aad61c666cc4259.tar.gz
PeerTube-6ea9295b8f5dd7cc254202a79aad61c666cc4259.tar.zst
PeerTube-6ea9295b8f5dd7cc254202a79aad61c666cc4259.zip
Check video privacy when creating comments/rates
Diffstat (limited to 'server/tests/api/check-params/videos.ts')
-rw-r--r--server/tests/api/check-params/videos.ts18
1 files changed, 18 insertions, 0 deletions
diff --git a/server/tests/api/check-params/videos.ts b/server/tests/api/check-params/videos.ts
index 4cc70f5cc..41064d2ff 100644
--- a/server/tests/api/check-params/videos.ts
+++ b/server/tests/api/check-params/videos.ts
@@ -28,6 +28,7 @@ describe('Test videos API validator', function () {
28 let channelId: number 28 let channelId: number
29 let channelName: string 29 let channelName: string
30 let video: VideoCreateResult 30 let video: VideoCreateResult
31 let privateVideo: VideoCreateResult
31 32
32 // --------------------------------------------------------------- 33 // ---------------------------------------------------------------
33 34
@@ -49,6 +50,10 @@ describe('Test videos API validator', function () {
49 channelName = body.videoChannels[0].name 50 channelName = body.videoChannels[0].name
50 accountName = body.account.name + '@' + body.account.host 51 accountName = body.account.name + '@' + body.account.host
51 } 52 }
53
54 {
55 privateVideo = await server.videos.quickUpload({ name: 'private video', privacy: VideoPrivacy.PRIVATE })
56 }
52 }) 57 })
53 58
54 describe('When listing videos', function () { 59 describe('When listing videos', function () {
@@ -783,6 +788,19 @@ describe('Test videos API validator', function () {
783 await makePutBodyRequest({ url: server.url, path: path + videoId + '/rate', token: server.accessToken, fields }) 788 await makePutBodyRequest({ url: server.url, path: path + videoId + '/rate', token: server.accessToken, fields })
784 }) 789 })
785 790
791 it('Should fail with a private video of another user', async function () {
792 const fields = {
793 rating: 'like'
794 }
795 await makePutBodyRequest({
796 url: server.url,
797 path: path + privateVideo.uuid + '/rate',
798 token: userAccessToken,
799 fields,
800 expectedStatus: HttpStatusCode.FORBIDDEN_403
801 })
802 })
803
786 it('Should succeed with the correct parameters', async function () { 804 it('Should succeed with the correct parameters', async function () {
787 const fields = { 805 const fields = {
788 rating: 'like' 806 rating: 'like'