X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftests%2Fapi%2Fcheck-params%2Fvideos.ts;h=41064d2ffdc5aeb94a0731e09d36a8f818b725df;hb=0c9a83546687d2ae80b3f5299a8ee59d741f894f;hp=4cc70f5cc460745c2c629a0b8a073f05dae99fe8;hpb=c55e3d7227fe1453869e309025996b9d75256d5d;p=github%2FChocobozzz%2FPeerTube.git 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 () { let channelId: number let channelName: string let video: VideoCreateResult + let privateVideo: VideoCreateResult // --------------------------------------------------------------- @@ -49,6 +50,10 @@ describe('Test videos API validator', function () { channelName = body.videoChannels[0].name accountName = body.account.name + '@' + body.account.host } + + { + privateVideo = await server.videos.quickUpload({ name: 'private video', privacy: VideoPrivacy.PRIVATE }) + } }) describe('When listing videos', function () { @@ -783,6 +788,19 @@ describe('Test videos API validator', function () { await makePutBodyRequest({ url: server.url, path: path + videoId + '/rate', token: server.accessToken, fields }) }) + it('Should fail with a private video of another user', async function () { + const fields = { + rating: 'like' + } + await makePutBodyRequest({ + url: server.url, + path: path + privateVideo.uuid + '/rate', + token: userAccessToken, + fields, + expectedStatus: HttpStatusCode.FORBIDDEN_403 + }) + }) + it('Should succeed with the correct parameters', async function () { const fields = { rating: 'like'