X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftests%2Fapi%2Fcheck-params%2Fvideo-captions.ts;h=a5f5c332284469b256e359fa4e4751e04f343956;hb=4c1def5fd8e9f483238eb38e221f555e2e6bbf07;hp=e4d36fd4fe7e84c20cc87cbc454167c7ab323075;hpb=9639bd175726b73f8fe664b5ced12a72407b1f0b;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tests/api/check-params/video-captions.ts b/server/tests/api/check-params/video-captions.ts index e4d36fd4f..a5f5c3322 100644 --- a/server/tests/api/check-params/video-captions.ts +++ b/server/tests/api/check-params/video-captions.ts @@ -1,21 +1,20 @@ -/* tslint:disable:no-unused-expression */ +/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ import 'mocha' import { + cleanupTests, createUser, - flushTests, - killallServers, + flushAndRunServer, makeDeleteRequest, makeGetRequest, makeUploadRequest, - runServer, ServerInfo, setAccessTokensToServers, uploadVideo, userLogin -} from '../../../../shared/utils' +} from '../../../../shared/extra-utils' import { join } from 'path' -import { createVideoCaption } from '../../../../shared/utils/videos/video-captions' +import { createVideoCaption } from '../../../../shared/extra-utils/videos/video-captions' describe('Test video captions API validator', function () { const path = '/api/v1/videos/' @@ -29,9 +28,7 @@ describe('Test video captions API validator', function () { before(async function () { this.timeout(30000) - await flushTests() - - server = await runServer(1) + server = await flushAndRunServer(1) await setAccessTokensToServers([ server ]) @@ -45,7 +42,7 @@ describe('Test video captions API validator', function () { username: 'user1', password: 'my super password' } - await createUser(server.url, server.accessToken, user.username, user.password) + await createUser({ url: server.url, accessToken: server.accessToken, username: user.username, password: user.password }) userAccessToken = await userLogin(server, user) } }) @@ -53,7 +50,7 @@ describe('Test video captions API validator', function () { describe('When adding video caption', function () { const fields = { } const attaches = { - 'captionfile': join(__dirname, '..', '..', 'fixtures', 'subtitle-good1.vtt') + captionfile: join(__dirname, '..', '..', 'fixtures', 'subtitle-good1.vtt') } it('Should fail without a valid uuid', async function () { @@ -127,22 +124,23 @@ describe('Test video captions API validator', function () { }) }) - it('Should fail with an invalid captionfile extension', async function () { - const attaches = { - 'captionfile': join(__dirname, '..', '..', 'fixtures', 'subtitle-bad.txt') - } - - const captionPath = path + videoUUID + '/captions/fr' - await makeUploadRequest({ - method: 'PUT', - url: server.url, - path: captionPath, - token: server.accessToken, - fields, - attaches, - statusCodeExpected: 400 - }) - }) + // We accept any file now + // it('Should fail with an invalid captionfile extension', async function () { + // const attaches = { + // 'captionfile': join(__dirname, '..', '..', 'fixtures', 'subtitle-bad.txt') + // } + // + // const captionPath = path + videoUUID + '/captions/fr' + // await makeUploadRequest({ + // method: 'PUT', + // url: server.url, + // path: captionPath, + // token: server.accessToken, + // fields, + // attaches, + // statusCodeExpected: 400 + // }) + // }) // We don't check the extension yet // it('Should fail with an invalid captionfile extension and octet-stream mime type', async function () { @@ -272,11 +270,6 @@ describe('Test video captions API validator', function () { }) after(async function () { - killallServers([ server ]) - - // Keep the logs if the test failed - if (this['ok']) { - await flushTests() - } + await cleanupTests([ server ]) }) })