aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/check-params/video-captions.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-01-06 13:31:37 +0100
committerChocobozzz <me@florianbigard.com>2022-01-06 13:31:37 +0100
commitc3edc5b074aa4bb1861ed0a94d3713808e87170f (patch)
tree328af78334a13d0d20ca53b0d88c13128e0f1244 /server/tests/api/check-params/video-captions.ts
parent75b7117f078461d2507572ba9da6527894e1b734 (diff)
parent795212f7acc690c88c86d0fab8772f6564d59cb8 (diff)
downloadPeerTube-c3edc5b074aa4bb1861ed0a94d3713808e87170f.tar.gz
PeerTube-c3edc5b074aa4bb1861ed0a94d3713808e87170f.tar.zst
PeerTube-c3edc5b074aa4bb1861ed0a94d3713808e87170f.zip
Merge branch 'release/4.0.0' into develop
Diffstat (limited to 'server/tests/api/check-params/video-captions.ts')
-rw-r--r--server/tests/api/check-params/video-captions.ts28
1 files changed, 27 insertions, 1 deletions
diff --git a/server/tests/api/check-params/video-captions.ts b/server/tests/api/check-params/video-captions.ts
index 8a8840793..9881df80c 100644
--- a/server/tests/api/check-params/video-captions.ts
+++ b/server/tests/api/check-params/video-captions.ts
@@ -2,7 +2,7 @@
2 2
3import 'mocha' 3import 'mocha'
4import { buildAbsoluteFixturePath } from '@shared/core-utils' 4import { buildAbsoluteFixturePath } from '@shared/core-utils'
5import { HttpStatusCode, VideoCreateResult } from '@shared/models' 5import { HttpStatusCode, VideoCreateResult, VideoPrivacy } from '@shared/models'
6import { 6import {
7 cleanupTests, 7 cleanupTests,
8 createSingleServer, 8 createSingleServer,
@@ -19,6 +19,7 @@ describe('Test video captions API validator', function () {
19 let server: PeerTubeServer 19 let server: PeerTubeServer
20 let userAccessToken: string 20 let userAccessToken: string
21 let video: VideoCreateResult 21 let video: VideoCreateResult
22 let privateVideo: VideoCreateResult
22 23
23 // --------------------------------------------------------------- 24 // ---------------------------------------------------------------
24 25
@@ -30,6 +31,7 @@ describe('Test video captions API validator', function () {
30 await setAccessTokensToServers([ server ]) 31 await setAccessTokensToServers([ server ])
31 32
32 video = await server.videos.upload() 33 video = await server.videos.upload()
34 privateVideo = await server.videos.upload({ attributes: { privacy: VideoPrivacy.PRIVATE } })
33 35
34 { 36 {
35 const user = { 37 const user = {
@@ -204,8 +206,32 @@ describe('Test video captions API validator', function () {
204 }) 206 })
205 }) 207 })
206 208
209 it('Should fail with a private video without token', async function () {
210 await makeGetRequest({
211 url: server.url,
212 path: path + privateVideo.shortUUID + '/captions',
213 expectedStatus: HttpStatusCode.UNAUTHORIZED_401
214 })
215 })
216
217 it('Should fail with another user token', async function () {
218 await makeGetRequest({
219 url: server.url,
220 token: userAccessToken,
221 path: path + privateVideo.shortUUID + '/captions',
222 expectedStatus: HttpStatusCode.FORBIDDEN_403
223 })
224 })
225
207 it('Should success with the correct parameters', async function () { 226 it('Should success with the correct parameters', async function () {
208 await makeGetRequest({ url: server.url, path: path + video.shortUUID + '/captions', expectedStatus: HttpStatusCode.OK_200 }) 227 await makeGetRequest({ url: server.url, path: path + video.shortUUID + '/captions', expectedStatus: HttpStatusCode.OK_200 })
228
229 await makeGetRequest({
230 url: server.url,
231 path: path + privateVideo.shortUUID + '/captions',
232 token: server.accessToken,
233 expectedStatus: HttpStatusCode.OK_200
234 })
209 }) 235 })
210 }) 236 })
211 237