aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/check-params/video-captions.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api/check-params/video-captions.ts')
-rw-r--r--server/tests/api/check-params/video-captions.ts38
1 files changed, 19 insertions, 19 deletions
diff --git a/server/tests/api/check-params/video-captions.ts b/server/tests/api/check-params/video-captions.ts
index 1ce2202d2..c0595c04d 100644
--- a/server/tests/api/check-params/video-captions.ts
+++ b/server/tests/api/check-params/video-captions.ts
@@ -1,7 +1,7 @@
1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ 1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
2 2
3import 'mocha' 3import 'mocha'
4 4import { VideoCreateResult } from '@shared/models'
5import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' 5import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
6import { 6import {
7 buildAbsoluteFixturePath, 7 buildAbsoluteFixturePath,
@@ -23,7 +23,7 @@ describe('Test video captions API validator', function () {
23 23
24 let server: ServerInfo 24 let server: ServerInfo
25 let userAccessToken: string 25 let userAccessToken: string
26 let videoUUID: string 26 let video: VideoCreateResult
27 27
28 // --------------------------------------------------------------- 28 // ---------------------------------------------------------------
29 29
@@ -36,7 +36,7 @@ describe('Test video captions API validator', function () {
36 36
37 { 37 {
38 const res = await uploadVideo(server.url, server.accessToken, {}) 38 const res = await uploadVideo(server.url, server.accessToken, {})
39 videoUUID = res.body.video.uuid 39 video = res.body.video
40 } 40 }
41 41
42 { 42 {
@@ -79,7 +79,7 @@ describe('Test video captions API validator', function () {
79 }) 79 })
80 80
81 it('Should fail with a missing language in path', async function () { 81 it('Should fail with a missing language in path', async function () {
82 const captionPath = path + videoUUID + '/captions' 82 const captionPath = path + video.uuid + '/captions'
83 await makeUploadRequest({ 83 await makeUploadRequest({
84 method: 'PUT', 84 method: 'PUT',
85 url: server.url, 85 url: server.url,
@@ -91,7 +91,7 @@ describe('Test video captions API validator', function () {
91 }) 91 })
92 92
93 it('Should fail with an unknown language', async function () { 93 it('Should fail with an unknown language', async function () {
94 const captionPath = path + videoUUID + '/captions/15' 94 const captionPath = path + video.uuid + '/captions/15'
95 await makeUploadRequest({ 95 await makeUploadRequest({
96 method: 'PUT', 96 method: 'PUT',
97 url: server.url, 97 url: server.url,
@@ -103,7 +103,7 @@ describe('Test video captions API validator', function () {
103 }) 103 })
104 104
105 it('Should fail without access token', async function () { 105 it('Should fail without access token', async function () {
106 const captionPath = path + videoUUID + '/captions/fr' 106 const captionPath = path + video.uuid + '/captions/fr'
107 await makeUploadRequest({ 107 await makeUploadRequest({
108 method: 'PUT', 108 method: 'PUT',
109 url: server.url, 109 url: server.url,
@@ -115,7 +115,7 @@ describe('Test video captions API validator', function () {
115 }) 115 })
116 116
117 it('Should fail with a bad access token', async function () { 117 it('Should fail with a bad access token', async function () {
118 const captionPath = path + videoUUID + '/captions/fr' 118 const captionPath = path + video.uuid + '/captions/fr'
119 await makeUploadRequest({ 119 await makeUploadRequest({
120 method: 'PUT', 120 method: 'PUT',
121 url: server.url, 121 url: server.url,
@@ -133,7 +133,7 @@ describe('Test video captions API validator', function () {
133 // 'captionfile': buildAbsoluteFixturePath('subtitle-bad.txt') 133 // 'captionfile': buildAbsoluteFixturePath('subtitle-bad.txt')
134 // } 134 // }
135 // 135 //
136 // const captionPath = path + videoUUID + '/captions/fr' 136 // const captionPath = path + video.uuid + '/captions/fr'
137 // await makeUploadRequest({ 137 // await makeUploadRequest({
138 // method: 'PUT', 138 // method: 'PUT',
139 // url: server.url, 139 // url: server.url,
@@ -151,7 +151,7 @@ describe('Test video captions API validator', function () {
151 // url: server.url, 151 // url: server.url,
152 // accessToken: server.accessToken, 152 // accessToken: server.accessToken,
153 // language: 'zh', 153 // language: 'zh',
154 // videoId: videoUUID, 154 // videoId: video.uuid,
155 // fixture: 'subtitle-bad.txt', 155 // fixture: 'subtitle-bad.txt',
156 // mimeType: 'application/octet-stream', 156 // mimeType: 'application/octet-stream',
157 // statusCodeExpected: HttpStatusCode.BAD_REQUEST_400 157 // statusCodeExpected: HttpStatusCode.BAD_REQUEST_400
@@ -163,7 +163,7 @@ describe('Test video captions API validator', function () {
163 url: server.url, 163 url: server.url,
164 accessToken: server.accessToken, 164 accessToken: server.accessToken,
165 language: 'zh', 165 language: 'zh',
166 videoId: videoUUID, 166 videoId: video.uuid,
167 fixture: 'subtitle-good.srt', 167 fixture: 'subtitle-good.srt',
168 mimeType: 'application/octet-stream' 168 mimeType: 'application/octet-stream'
169 }) 169 })
@@ -175,7 +175,7 @@ describe('Test video captions API validator', function () {
175 // 'captionfile': buildAbsoluteFixturePath('subtitle-bad.srt') 175 // 'captionfile': buildAbsoluteFixturePath('subtitle-bad.srt')
176 // } 176 // }
177 // 177 //
178 // const captionPath = path + videoUUID + '/captions/fr' 178 // const captionPath = path + video.uuid + '/captions/fr'
179 // await makeUploadRequest({ 179 // await makeUploadRequest({
180 // method: 'PUT', 180 // method: 'PUT',
181 // url: server.url, 181 // url: server.url,
@@ -188,7 +188,7 @@ describe('Test video captions API validator', function () {
188 // }) 188 // })
189 189
190 it('Should success with the correct parameters', async function () { 190 it('Should success with the correct parameters', async function () {
191 const captionPath = path + videoUUID + '/captions/fr' 191 const captionPath = path + video.uuid + '/captions/fr'
192 await makeUploadRequest({ 192 await makeUploadRequest({
193 method: 'PUT', 193 method: 'PUT',
194 url: server.url, 194 url: server.url,
@@ -215,7 +215,7 @@ describe('Test video captions API validator', function () {
215 }) 215 })
216 216
217 it('Should success with the correct parameters', async function () { 217 it('Should success with the correct parameters', async function () {
218 await makeGetRequest({ url: server.url, path: path + videoUUID + '/captions', statusCodeExpected: HttpStatusCode.OK_200 }) 218 await makeGetRequest({ url: server.url, path: path + video.shortUUID + '/captions', statusCodeExpected: HttpStatusCode.OK_200 })
219 }) 219 })
220 }) 220 })
221 221
@@ -246,27 +246,27 @@ describe('Test video captions API validator', function () {
246 }) 246 })
247 247
248 it('Should fail with a missing language', async function () { 248 it('Should fail with a missing language', async function () {
249 const captionPath = path + videoUUID + '/captions' 249 const captionPath = path + video.shortUUID + '/captions'
250 await makeDeleteRequest({ url: server.url, path: captionPath, token: server.accessToken }) 250 await makeDeleteRequest({ url: server.url, path: captionPath, token: server.accessToken })
251 }) 251 })
252 252
253 it('Should fail with an unknown language', async function () { 253 it('Should fail with an unknown language', async function () {
254 const captionPath = path + videoUUID + '/captions/15' 254 const captionPath = path + video.shortUUID + '/captions/15'
255 await makeDeleteRequest({ url: server.url, path: captionPath, token: server.accessToken }) 255 await makeDeleteRequest({ url: server.url, path: captionPath, token: server.accessToken })
256 }) 256 })
257 257
258 it('Should fail without access token', async function () { 258 it('Should fail without access token', async function () {
259 const captionPath = path + videoUUID + '/captions/fr' 259 const captionPath = path + video.shortUUID + '/captions/fr'
260 await makeDeleteRequest({ url: server.url, path: captionPath, statusCodeExpected: HttpStatusCode.UNAUTHORIZED_401 }) 260 await makeDeleteRequest({ url: server.url, path: captionPath, statusCodeExpected: HttpStatusCode.UNAUTHORIZED_401 })
261 }) 261 })
262 262
263 it('Should fail with a bad access token', async function () { 263 it('Should fail with a bad access token', async function () {
264 const captionPath = path + videoUUID + '/captions/fr' 264 const captionPath = path + video.shortUUID + '/captions/fr'
265 await makeDeleteRequest({ url: server.url, path: captionPath, token: 'coucou', statusCodeExpected: HttpStatusCode.UNAUTHORIZED_401 }) 265 await makeDeleteRequest({ url: server.url, path: captionPath, token: 'coucou', statusCodeExpected: HttpStatusCode.UNAUTHORIZED_401 })
266 }) 266 })
267 267
268 it('Should fail with another user', async function () { 268 it('Should fail with another user', async function () {
269 const captionPath = path + videoUUID + '/captions/fr' 269 const captionPath = path + video.shortUUID + '/captions/fr'
270 await makeDeleteRequest({ 270 await makeDeleteRequest({
271 url: server.url, 271 url: server.url,
272 path: captionPath, 272 path: captionPath,
@@ -276,7 +276,7 @@ describe('Test video captions API validator', function () {
276 }) 276 })
277 277
278 it('Should success with the correct parameters', async function () { 278 it('Should success with the correct parameters', async function () {
279 const captionPath = path + videoUUID + '/captions/fr' 279 const captionPath = path + video.shortUUID + '/captions/fr'
280 await makeDeleteRequest({ 280 await makeDeleteRequest({
281 url: server.url, 281 url: server.url,
282 path: captionPath, 282 path: captionPath,