X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftests%2Fapi%2Fcheck-params%2Fvideo-abuses.ts;h=e643cb95e529acf6f25cb5d47ef728dd40ae94c3;hb=3b0bd70aa05ab82fa30fe67ed4899d44652c703a;hp=7edc8e39d42e3220aebe04ec6482db93cfa81d50;hpb=1eddc9a74f9a80fa5d0cb25fceb3fc47a1a3c14a;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tests/api/check-params/video-abuses.ts b/server/tests/api/check-params/video-abuses.ts index 7edc8e39d..e643cb95e 100644 --- a/server/tests/api/check-params/video-abuses.ts +++ b/server/tests/api/check-params/video-abuses.ts @@ -1,26 +1,25 @@ -/* tslint:disable:no-unused-expression */ +/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ import 'mocha' import { + cleanupTests, createUser, deleteVideoAbuse, - flushTests, - killallServers, + flushAndRunServer, makeGetRequest, makePostBodyRequest, - runServer, ServerInfo, setAccessTokensToServers, updateVideoAbuse, uploadVideo, userLogin -} from '../../../../shared/utils' +} from '../../../../shared/extra-utils' import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination -} from '../../../../shared/utils/requests/check-api-params' +} from '../../../../shared/extra-utils/requests/check-api-params' import { VideoAbuseState } from '../../../../shared/models/videos' describe('Test video abuses API validators', function () { @@ -33,9 +32,7 @@ describe('Test video abuses API validators', function () { before(async function () { this.timeout(30000) - await flushTests() - - server = await runServer(1) + server = await flushAndRunServer(1) await setAccessTokensToServers([ server ]) @@ -79,6 +76,22 @@ describe('Test video abuses API validators', function () { statusCodeExpected: 403 }) }) + + it('Should fail with a bad id filter', async function () { + await makeGetRequest({ url: server.url, path, token: server.accessToken, query: { id: 'toto' } }) + }) + + it('Should fail with a bad state filter', async function () { + await makeGetRequest({ url: server.url, path, token: server.accessToken, query: { state: 'toto' } }) + }) + + it('Should fail with a bad videoIs filter', async function () { + await makeGetRequest({ url: server.url, path, token: server.accessToken, query: { videoIs: 'toto' } }) + }) + + it('Should succeed with the correct params', async function () { + await makeGetRequest({ url: server.url, path, token: server.accessToken, query: { id: 13 }, statusCodeExpected: 200 }) + }) }) describe('When reporting a video abuse', function () { @@ -129,6 +142,7 @@ describe('Test video abuses API validators', function () { describe('When updating a video abuse', function () { const basePath = '/api/v1/videos/' + // eslint-disable-next-line @typescript-eslint/no-unused-vars let path: string before(() => { @@ -166,6 +180,7 @@ describe('Test video abuses API validators', function () { describe('When deleting a video abuse', function () { const basePath = '/api/v1/videos/' + // eslint-disable-next-line @typescript-eslint/no-unused-vars let path: string before(() => { @@ -191,11 +206,6 @@ describe('Test video abuses API validators', function () { }) after(async function () { - killallServers([ server ]) - - // Keep the logs if the test failed - if (this['ok']) { - await flushTests() - } + await cleanupTests([ server ]) }) })