From d4a8e7a65f97bb3257facc13e1ae8ffdbad61ddb Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 28 Jun 2021 17:30:59 +0200 Subject: Support short uuid for GET video/playlist --- server/tests/api/check-params/video-captions.ts | 38 ++++++++++++------------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'server/tests/api/check-params/video-captions.ts') 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 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ import 'mocha' - +import { VideoCreateResult } from '@shared/models' import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' import { buildAbsoluteFixturePath, @@ -23,7 +23,7 @@ describe('Test video captions API validator', function () { let server: ServerInfo let userAccessToken: string - let videoUUID: string + let video: VideoCreateResult // --------------------------------------------------------------- @@ -36,7 +36,7 @@ describe('Test video captions API validator', function () { { const res = await uploadVideo(server.url, server.accessToken, {}) - videoUUID = res.body.video.uuid + video = res.body.video } { @@ -79,7 +79,7 @@ describe('Test video captions API validator', function () { }) it('Should fail with a missing language in path', async function () { - const captionPath = path + videoUUID + '/captions' + const captionPath = path + video.uuid + '/captions' await makeUploadRequest({ method: 'PUT', url: server.url, @@ -91,7 +91,7 @@ describe('Test video captions API validator', function () { }) it('Should fail with an unknown language', async function () { - const captionPath = path + videoUUID + '/captions/15' + const captionPath = path + video.uuid + '/captions/15' await makeUploadRequest({ method: 'PUT', url: server.url, @@ -103,7 +103,7 @@ describe('Test video captions API validator', function () { }) it('Should fail without access token', async function () { - const captionPath = path + videoUUID + '/captions/fr' + const captionPath = path + video.uuid + '/captions/fr' await makeUploadRequest({ method: 'PUT', url: server.url, @@ -115,7 +115,7 @@ describe('Test video captions API validator', function () { }) it('Should fail with a bad access token', async function () { - const captionPath = path + videoUUID + '/captions/fr' + const captionPath = path + video.uuid + '/captions/fr' await makeUploadRequest({ method: 'PUT', url: server.url, @@ -133,7 +133,7 @@ describe('Test video captions API validator', function () { // 'captionfile': buildAbsoluteFixturePath('subtitle-bad.txt') // } // - // const captionPath = path + videoUUID + '/captions/fr' + // const captionPath = path + video.uuid + '/captions/fr' // await makeUploadRequest({ // method: 'PUT', // url: server.url, @@ -151,7 +151,7 @@ describe('Test video captions API validator', function () { // url: server.url, // accessToken: server.accessToken, // language: 'zh', - // videoId: videoUUID, + // videoId: video.uuid, // fixture: 'subtitle-bad.txt', // mimeType: 'application/octet-stream', // statusCodeExpected: HttpStatusCode.BAD_REQUEST_400 @@ -163,7 +163,7 @@ describe('Test video captions API validator', function () { url: server.url, accessToken: server.accessToken, language: 'zh', - videoId: videoUUID, + videoId: video.uuid, fixture: 'subtitle-good.srt', mimeType: 'application/octet-stream' }) @@ -175,7 +175,7 @@ describe('Test video captions API validator', function () { // 'captionfile': buildAbsoluteFixturePath('subtitle-bad.srt') // } // - // const captionPath = path + videoUUID + '/captions/fr' + // const captionPath = path + video.uuid + '/captions/fr' // await makeUploadRequest({ // method: 'PUT', // url: server.url, @@ -188,7 +188,7 @@ describe('Test video captions API validator', function () { // }) it('Should success with the correct parameters', async function () { - const captionPath = path + videoUUID + '/captions/fr' + const captionPath = path + video.uuid + '/captions/fr' await makeUploadRequest({ method: 'PUT', url: server.url, @@ -215,7 +215,7 @@ describe('Test video captions API validator', function () { }) it('Should success with the correct parameters', async function () { - await makeGetRequest({ url: server.url, path: path + videoUUID + '/captions', statusCodeExpected: HttpStatusCode.OK_200 }) + await makeGetRequest({ url: server.url, path: path + video.shortUUID + '/captions', statusCodeExpected: HttpStatusCode.OK_200 }) }) }) @@ -246,27 +246,27 @@ describe('Test video captions API validator', function () { }) it('Should fail with a missing language', async function () { - const captionPath = path + videoUUID + '/captions' + const captionPath = path + video.shortUUID + '/captions' await makeDeleteRequest({ url: server.url, path: captionPath, token: server.accessToken }) }) it('Should fail with an unknown language', async function () { - const captionPath = path + videoUUID + '/captions/15' + const captionPath = path + video.shortUUID + '/captions/15' await makeDeleteRequest({ url: server.url, path: captionPath, token: server.accessToken }) }) it('Should fail without access token', async function () { - const captionPath = path + videoUUID + '/captions/fr' + const captionPath = path + video.shortUUID + '/captions/fr' await makeDeleteRequest({ url: server.url, path: captionPath, statusCodeExpected: HttpStatusCode.UNAUTHORIZED_401 }) }) it('Should fail with a bad access token', async function () { - const captionPath = path + videoUUID + '/captions/fr' + const captionPath = path + video.shortUUID + '/captions/fr' await makeDeleteRequest({ url: server.url, path: captionPath, token: 'coucou', statusCodeExpected: HttpStatusCode.UNAUTHORIZED_401 }) }) it('Should fail with another user', async function () { - const captionPath = path + videoUUID + '/captions/fr' + const captionPath = path + video.shortUUID + '/captions/fr' await makeDeleteRequest({ url: server.url, path: captionPath, @@ -276,7 +276,7 @@ describe('Test video captions API validator', function () { }) it('Should success with the correct parameters', async function () { - const captionPath = path + videoUUID + '/captions/fr' + const captionPath = path + video.shortUUID + '/captions/fr' await makeDeleteRequest({ url: server.url, path: captionPath, -- cgit v1.2.3