X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftests%2Fapi%2Fcheck-params%2Fvideo-imports.ts;h=7f19b9ee9b1f84ae0d6e3c76298ba78d719150e1;hb=c5c95361e6adca439ae316066366e520797f9ec0;hp=5cdd0d925ca9f55f48c651b707a768e722f9531c;hpb=2a491182e483b97afb1b65c908b23cb48d591807;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 5cdd0d925..7f19b9ee9 100644 --- a/server/tests/api/check-params/video-imports.ts +++ b/server/tests/api/check-params/video-imports.ts @@ -1,9 +1,7 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import 'mocha' -import { omit } from 'lodash' import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination, FIXTURE_URLS } from '@server/tests/shared' -import { buildAbsoluteFixturePath } from '@shared/core-utils' +import { buildAbsoluteFixturePath, omit } from '@shared/core-utils' import { HttpStatusCode, VideoPrivacy } from '@shared/models' import { cleanupTests, @@ -59,6 +57,15 @@ describe('Test video imports API validator', function () { await checkBadSortPagination(server.url, myPath, server.accessToken) }) + it('Should fail with a bad videoChannelSyncId param', async function () { + await makeGetRequest({ + url: server.url, + path: myPath, + query: { videoChannelSyncId: 'toto' }, + token: server.accessToken + }) + }) + it('Should success with the correct parameters', async function () { await makeGetRequest({ url: server.url, path: myPath, expectedStatus: HttpStatusCode.OK_200, token: server.accessToken }) }) @@ -98,7 +105,7 @@ describe('Test video imports API validator', function () { }) it('Should fail without a target url', async function () { - const fields = omit(baseCorrectParams, 'targetUrl') + const fields = omit(baseCorrectParams, [ 'targetUrl' ]) await makePostBodyRequest({ url: server.url, path, @@ -180,7 +187,7 @@ describe('Test video imports API validator', function () { }) it('Should fail without a channel', async function () { - const fields = omit(baseCorrectParams, 'channelId') + const fields = omit(baseCorrectParams, [ 'channelId' ]) await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields }) }) @@ -262,7 +269,7 @@ describe('Test video imports API validator', function () { }) it('Should fail with an invalid torrent file', async function () { - const fields = omit(baseCorrectParams, 'targetUrl') + const fields = omit(baseCorrectParams, [ 'targetUrl' ]) const attaches = { torrentfile: buildAbsoluteFixturePath('avatar-big.png') } @@ -271,7 +278,7 @@ describe('Test video imports API validator', function () { }) it('Should fail with an invalid magnet URI', async function () { - let fields = omit(baseCorrectParams, 'targetUrl') + let fields = omit(baseCorrectParams, [ 'targetUrl' ]) fields = { ...fields, magnetUri: 'blabla' } await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields }) @@ -330,7 +337,7 @@ describe('Test video imports API validator', function () { } }) - let fields = omit(baseCorrectParams, 'targetUrl') + let fields = omit(baseCorrectParams, [ 'targetUrl' ]) fields = { ...fields, magnetUri: FIXTURE_URLS.magnet } await makePostBodyRequest({ @@ -341,7 +348,7 @@ describe('Test video imports API validator', function () { expectedStatus: HttpStatusCode.CONFLICT_409 }) - fields = omit(fields, 'magnetUri') + fields = omit(fields, [ 'magnetUri' ]) const attaches = { torrentfile: buildAbsoluteFixturePath('video-720p.torrent') }