X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftests%2Fapi%2Fcheck-params%2Fvideo-imports.ts;h=dbea39c48cb3340142e061b2e9ccf7c1e66dc073;hb=3b0bd70aa05ab82fa30fe67ed4899d44652c703a;hp=82fdc06670a34164796a61628c9a42e648b093a6;hpb=210feb6cc484a6c5c63c98f770de34e223f944cb;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tests/api/check-params/video-imports.ts b/server/tests/api/check-params/video-imports.ts index 82fdc0667..dbea39c48 100644 --- a/server/tests/api/check-params/video-imports.ts +++ b/server/tests/api/check-params/video-imports.ts @@ -1,19 +1,18 @@ -/* tslint:disable:no-unused-expression */ +/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ import { omit } from 'lodash' import 'mocha' import { join } from 'path' import { VideoPrivacy } from '../../../../shared/models/videos/video-privacy.enum' import { + cleanupTests, createUser, - flushTests, + flushAndRunServer, getMyUserInformation, immutableAssign, - killallServers, makeGetRequest, makePostBodyRequest, makeUploadRequest, - flushAndRunServer, ServerInfo, setAccessTokensToServers, updateCustomSubConfig, @@ -30,6 +29,7 @@ describe('Test video imports API validator', function () { const path = '/api/v1/videos/imports' let server: ServerInfo let userAccessToken = '' + // eslint-disable-next-line @typescript-eslint/no-unused-vars let accountName: string let channelId: number @@ -49,7 +49,7 @@ describe('Test video imports API validator', function () { { const res = await getMyUserInformation(server.url, server.accessToken) - channelId = res.body.videoChannels[ 0 ].id + channelId = res.body.videoChannels[0].id accountName = res.body.account.name + '@' + res.body.account.host } }) @@ -92,7 +92,7 @@ describe('Test video imports API validator', function () { support: 'my super support text', tags: [ 'tag1', 'tag2' ], privacy: VideoPrivacy.PUBLIC, - channelId: channelId + channelId } }) @@ -197,7 +197,7 @@ describe('Test video imports API validator', function () { it('Should fail with an incorrect thumbnail file', async function () { const fields = baseCorrectParams const attaches = { - 'thumbnailfile': join(__dirname, '..', '..', 'fixtures', 'avatar.png') + thumbnailfile: join(__dirname, '..', '..', 'fixtures', 'avatar.png') } await makeUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches }) @@ -206,7 +206,7 @@ describe('Test video imports API validator', function () { it('Should fail with a big thumbnail file', async function () { const fields = baseCorrectParams const attaches = { - 'thumbnailfile': join(__dirname, '..', '..', 'fixtures', 'avatar-big.png') + thumbnailfile: join(__dirname, '..', '..', 'fixtures', 'avatar-big.png') } await makeUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches }) @@ -215,7 +215,7 @@ describe('Test video imports API validator', function () { it('Should fail with an incorrect preview file', async function () { const fields = baseCorrectParams const attaches = { - 'previewfile': join(__dirname, '..', '..', 'fixtures', 'avatar.png') + previewfile: join(__dirname, '..', '..', 'fixtures', 'avatar.png') } await makeUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches }) @@ -224,7 +224,7 @@ describe('Test video imports API validator', function () { it('Should fail with a big preview file', async function () { const fields = baseCorrectParams const attaches = { - 'previewfile': join(__dirname, '..', '..', 'fixtures', 'avatar-big.png') + previewfile: join(__dirname, '..', '..', 'fixtures', 'avatar-big.png') } await makeUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches }) @@ -233,7 +233,7 @@ describe('Test video imports API validator', function () { it('Should fail with an invalid torrent file', async function () { const fields = omit(baseCorrectParams, 'targetUrl') const attaches = { - 'torrentfile': join(__dirname, '..', '..', 'fixtures', 'avatar-big.png') + torrentfile: join(__dirname, '..', '..', 'fixtures', 'avatar-big.png') } await makeUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches }) @@ -304,14 +304,14 @@ describe('Test video imports API validator', function () { fields = omit(fields, 'magnetUri') const attaches = { - 'torrentfile': join(__dirname, '..', '..', 'fixtures', 'video-720p.torrent') + torrentfile: join(__dirname, '..', '..', 'fixtures', 'video-720p.torrent') } await makeUploadRequest({ url: server.url, path, token: server.accessToken, fields, attaches, statusCodeExpected: 409 }) }) }) - after(function () { - killallServers([ server ]) + after(async function () { + await cleanupTests([ server ]) }) })