ActivityPub-federated video streaming platform using P2P directly in your web browser
Improve check videos parameters tests
Chocobozzz11ba2ab3f1e3
diff --git a/server/tests/api/check-params/follows.ts b/server/tests/api/check-params/follows.tsindex d5fcb74771..e54f139f07 100644--- a/server/tests/api/check-params/follows.ts+++ b/server/tests/api/check-params/follows.ts@@ -1,7 +1,6 @@/* tslint:disable:no-unused-expression */import 'mocha'-import * as request from 'supertest'import {createUser, flushTests, killallServers, makeDeleteRequest, makePostBodyRequest, runServer, ServerInfo, setAccessTokensToServers,diff --git a/server/tests/api/check-params/jobs.ts b/server/tests/api/check-params/jobs.tsindex 46b05cb4e8..b12818bb1a 100644--- a/server/tests/api/check-params/jobs.ts+++ b/server/tests/api/check-params/jobs.ts@@ -1,9 +1,8 @@/* tslint:disable:no-unused-expression */import 'mocha'-import * as request from 'supertest'-import { createUser, flushTests, userLogin, killallServers, runServer, ServerInfo, setAccessTokensToServers } from '../../utils'+import { createUser, flushTests, killallServers, runServer, ServerInfo, setAccessTokensToServers, userLogin } from '../../utils'import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '../../utils/requests/check-api-params'import { makeGetRequest } from '../../utils/requests/requests'diff --git a/server/tests/api/check-params/video-abuses.ts b/server/tests/api/check-params/video-abuses.tsindex e994ccd49a..68e2ce7860 100644--- a/server/tests/api/check-params/video-abuses.ts+++ b/server/tests/api/check-params/video-abuses.ts@@ -1,20 +1,12 @@/* tslint:disable:no-unused-expression */-import * as request from 'supertest'import 'mocha'import {- ServerInfo,- flushTests,- runServer,- uploadVideo,- getVideosList,- createUser,- setAccessTokensToServers,- killallServers,- makePostBodyRequest,- userLogin+ createUser, flushTests, killallServers, makeGetRequest, makePostBodyRequest, runServer, ServerInfo, setAccessTokensToServers,+ uploadVideo, userLogin} from '../../utils'+import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '../../utils/requests/check-api-params'describe('Test video abuses API validators', function () {let server: ServerInfo@@ -34,63 +26,42 @@ describe('Test video abuses API validators', function () {const username = 'user1'const password = 'my super password'await createUser(server.url, server.accessToken, username, password)-userAccessToken = await userLogin(server, { username, password })- // Upload a video- const videoAttributes = {}- await uploadVideo(server.url, server.accessToken, videoAttributes)-- const res = await getVideosList(server.url)- const videos = res.body.data- server.video = videos[0]+ const res = await uploadVideo(server.url, server.accessToken, {})+ server.video = res.body.video})describe('When listing video abuses', function () {const path = '/api/v1/videos/abuse'it('Should fail with a bad start pagination', async function () {- await request(server.url)- .get(path)- .query({ start: 'hello' })- .set('Authorization', 'Bearer ' + server.accessToken)- .set('Accept', 'application/json')- .expect(400)+ await checkBadStartPagination(server.url, path, server.accessToken)})it('Should fail with a bad count pagination', async function () {- await request(server.url)- .get(path)- .query({ count: 'hello' })- .set('Accept', 'application/json')- .set('Authorization', 'Bearer ' + server.accessToken)- .expect(400)+ await checkBadCountPagination(server.url, path, server.accessToken)})it('Should fail with an incorrect sort', async function () {- await request(server.url)- .get(path)- .query({ sort: 'hello' })- .set('Accept', 'application/json')- .set('Authorization', 'Bearer ' + server.accessToken)- .expect(400)+ await checkBadSortPagination(server.url, path, server.accessToken)})it('Should fail with a non authenticated user', async function () {- await request(server.url)- .get(path)- .query({ sort: 'hello' })- .set('Accept', 'application/json')- .expect(401)+ await makeGetRequest({+ url: server.url,+ path,+ statusCodeExpected: 401+ })})it('Should fail with a non admin user', async function () {- await request(server.url)- .get(path)- .query({ sort: 'hello' })- .set('Accept', 'application/json')- .set('Authorization', 'Bearer ' + userAccessToken)- .expect(403)+ await makeGetRequest({+ url: server.url,+ path,+ token: userAccessToken,+ statusCodeExpected: 403+ })})})@@ -105,32 +76,33 @@ describe('Test video abuses API validators', function () {it('Should fail with a wrong video', async function () {const wrongPath = '/api/v1/videos/blabla/abuse'- const fields = {}+ const fields = {+ reason: 'my super reason'+ }await makePostBodyRequest({ url: server.url, path: wrongPath, token: server.accessToken, fields })})it('Should fail with a non authenticated user', async function () {- const fields = {}const path = basePath + server.video.id + '/abuse'+ const fields = {+ reason: 'my super reason'+ }await makePostBodyRequest({ url: server.url, path, token: 'hello', fields, statusCodeExpected: 401 })})it('Should fail with a reason too short', async function () {+ const path = basePath + server.video.id + '/abuse'const fields = {reason: 'h'}- const path = basePath + server.video.id + '/abuse'await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields })})it('Should fail with a reason too big', async function () {+ const path = basePath + server.video.id + '/abuse'const fields = {- reason: '0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef' +- '0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef' +- '0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef' +- '0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef'+ reason: 'super'.repeat(61)}- const path = basePath + server.video.id + '/abuse'await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields })})})diff --git a/server/tests/api/check-params/video-blacklist.ts b/server/tests/api/check-params/video-blacklist.tsindex c8b4571823..6cd13d23f7 100644--- a/server/tests/api/check-params/video-blacklist.ts+++ b/server/tests/api/check-params/video-blacklist.ts@@ -1,20 +1,12 @@/* tslint:disable:no-unused-expression */import 'mocha'-import * as request from 'supertest'import {- ServerInfo,- flushTests,- runServer,- uploadVideo,- getVideosList,- createUser,- setAccessTokensToServers,- killallServers,- makePostBodyRequest,- userLogin+ createUser, flushTests, getBlacklistedVideosList, killallServers, makePostBodyRequest, removeVideoFromBlacklist, runServer,+ ServerInfo, setAccessTokensToServers, uploadVideo, userLogin} from '../../utils'+import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '../../utils/requests/check-api-params'describe('Test video blacklist API validators', function () {let server: ServerInfo@@ -36,14 +28,8 @@ describe('Test video blacklist API validators', function () {await createUser(server.url, server.accessToken, username, password)userAccessToken = await userLogin(server, { username, password })- // Upload a video- const videoAttributes = {}- await uploadVideo(server.url, server.accessToken, videoAttributes)-- const res = await getVideosList(server.url)-- const videos = res.body.data- server.video = videos[0]+ const res = await uploadVideo(server.url, server.accessToken, {})+ server.video = res.body.video})describe('When adding a video in blacklist', function () {@@ -62,66 +48,40 @@ describe('Test video blacklist API validators', function () {})it('Should fail with a non authenticated user', async function () {- const fields = {}const path = basePath + server.video + '/blacklist'+ const fields = {}await makePostBodyRequest({ url: server.url, path, token: 'hello', fields, statusCodeExpected: 401 })})it('Should fail with a non admin user', async function () {- const fields = {}const path = basePath + server.video + '/blacklist'+ const fields = {}await makePostBodyRequest({ url: server.url, path, token: userAccessToken, fields, statusCodeExpected: 403 })})it('Should fail with a local video', async function () {- const fields = {}const path = basePath + server.video.id + '/blacklist'+ const fields = {}await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields, statusCodeExpected: 403 })})})describe('When removing a video in blacklist', function () {- const basePath = '/api/v1/videos/'-it('Should fail with a non authenticated user', async function () {- const path = basePath + server.video.id + '/blacklist'-- await request(server.url)- .delete(path)- .set('Authorization', 'Bearer ' + 'fake token')- .set('Accept', 'application/json')- .expect(401)+ await removeVideoFromBlacklist(server.url, 'fake token', server.video.id, 401)})it('Should fail with a non admin user', async function () {- const path = basePath + server.video.id + '/blacklist'-- await request(server.url)- .delete(path)- .set('Authorization', 'Bearer ' + userAccessToken)- .set('Accept', 'application/json')- .expect(403)+ await removeVideoFromBlacklist(server.url, userAccessToken, server.video.id, 403)})it('Should fail with an incorrect id', async function () {- const path = basePath + 'foobar/blacklist'-- await request(server.url)- .delete(path)- .set('Authorization', 'Bearer ' + server.accessToken)- .set('Accept', 'application/json')- .expect(400)+ await removeVideoFromBlacklist(server.url, server.accessToken, 'hello', 400)})it('Should fail with a not blacklisted video', async function () {// The video was not added to the blacklist so it should fail- const path = basePath + server.video.id + '/blacklist'-- await request(server.url)- .delete(path)- .set('Authorization', 'Bearer ' + server.accessToken)- .set('Accept', 'application/json')- .expect(404)+ await removeVideoFromBlacklist(server.url, server.accessToken, server.video.id, 404)})})@@ -129,58 +89,23 @@ describe('Test video blacklist API validators', function () {const basePath = '/api/v1/videos/blacklist/'it('Should fail with a non authenticated user', async function () {- const path = basePath-- await request(server.url)- .get(path)- .query({ sort: 'createdAt' })- .set('Accept', 'application/json')- .set('Authorization', 'Bearer ' + 'fake token')- .expect(401)+ await getBlacklistedVideosList(server.url, 'fake token', 401)})it('Should fail with a non admin user', async function () {- const path = basePath-- await request(server.url)- .get(path)- .query({ sort: 'createdAt' })- .set('Authorization', 'Bearer ' + userAccessToken)- .set('Accept', 'application/json')- .expect(403)+ await getBlacklistedVideosList(server.url, userAccessToken, 403)})it('Should fail with a bad start pagination', async function () {- const path = basePath-- await request(server.url)- .get(path)- .query({ start: 'foobar' })- .set('Accept', 'application/json')- .set('Authorization', 'Bearer ' + server.accessToken)- .expect(400)+ await checkBadStartPagination(server.url, basePath, server.accessToken)})it('Should fail with a bad count pagination', async function () {- const path = basePath-- await request(server.url)- .get(path)- .query({ count: 'foobar' })- .set('Accept', 'application/json')- .set('Authorization', 'Bearer ' + server.accessToken)- .expect(400)+ await checkBadCountPagination(server.url, basePath, server.accessToken)})it('Should fail with an incorrect sort', async function () {- const path = basePath-- await request(server.url)- .get(path)- .query({ sort: 'foobar' })- .set('Accept', 'application/json')- .set('Authorization', 'Bearer ' + server.accessToken)- .expect(400)+ await checkBadSortPagination(server.url, basePath, server.accessToken)})})diff --git a/server/tests/api/check-params/video-channels.ts b/server/tests/api/check-params/video-channels.tsindex bf464152b2..22e98d1105 100644--- a/server/tests/api/check-params/video-channels.ts+++ b/server/tests/api/check-params/video-channels.ts@@ -1,22 +1,15 @@/* tslint:disable:no-unused-expression */-import * as request from 'supertest'-import 'mocha'import * as chai from 'chai'-const expect = chai.expect-+import { omit } from 'lodash'+import 'mocha'import {- ServerInfo,- flushTests,- runServer,- makePutBodyRequest,- setAccessTokensToServers,- killallServers,- makePostBodyRequest,- getVideoChannelsList,- createUser,- userLogin+ createUser, deleteVideoChannel, flushTests, getAccountVideoChannelsList, getVideoChannelsList, immutableAssign, killallServers,+ makeGetRequest, makePostBodyRequest, makePutBodyRequest, runServer, ServerInfo, setAccessTokensToServers, userLogin} from '../../utils'+import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '../../utils/requests/check-api-params'++const expect = chai.expectdescribe('Test videos API validator', function () {const path = '/api/v1/videos/channels'@@ -39,64 +32,41 @@ describe('Test videos API validator', function () {password: 'fake_password'}await createUser(server.url, server.accessToken, user.username, user.password)-accessTokenUser = await userLogin(server, user)})describe('When listing a video channels', function () {it('Should fail with a bad start pagination', async function () {- await request(server.url)- .get(path)- .query({ start: 'hello' })- .set('Accept', 'application/json')- .expect(400)+ await checkBadStartPagination(server.url, path, server.accessToken)})it('Should fail with a bad count pagination', async function () {- await request(server.url)- .get(path)- .query({ count: 'hello' })- .set('Accept', 'application/json')- .expect(400)+ await checkBadCountPagination(server.url, path, server.accessToken)})it('Should fail with an incorrect sort', async function () {- await request(server.url)- .get(path)- .query({ sort: 'hello' })- .set('Accept', 'application/json')- .expect(400)+ await checkBadSortPagination(server.url, path, server.accessToken)})})describe('When listing account video channels', function () {it('Should fail with bad account', async function () {- const path = '/api/v1/videos/accounts/hello/channels'-- await request(server.url)- .get(path)- .set('Accept', 'application/json')- .expect(400)+ await getAccountVideoChannelsList(server.url, 'hello', 400)})it('Should fail with a unknown account', async function () {- const path = '/api/v1/videos/accounts/156/channels'-- await request(server.url)- .get(path)- .set('Accept', 'application/json')- .expect(404)+ await getAccountVideoChannelsList(server.url, 154, 404)})})describe('When adding a video channel', function () {+ const baseCorrectParams = {+ name: 'hello',+ description: 'super description'+ }it('Should fail with a non authenticated user', async function () {- const fields = {- name: 'hello',- description: 'super description'- }- await makePostBodyRequest({ url: server.url, path, token: 'none', fields, statusCodeExpected: 401 })+ await makePostBodyRequest({ url: server.url, path, token: 'none', fields: baseCorrectParams, statusCodeExpected: 401 })})it('Should fail with nothing', async function () {@@ -105,45 +75,37 @@ describe('Test videos API validator', function () {})it('Should fail without name', async function () {- const fields = {- description: 'super description'- }+ const fields = omit(baseCorrectParams, 'name')await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields })})it('Should fail with a long name', async function () {- const fields = {- name: 'hello tooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo' +- 'oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo' +- 'oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo' +- 'oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo' +- 'oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo long',- description: 'super description'- }+ const fields = immutableAssign(baseCorrectParams, { name: 'super'.repeat(25) })await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields })})it('Should fail with a long description', async function () {- const fields = {- name: 'hello',- description: 'super toooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo' +- 'oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo0' +- 'ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo' +- 'oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo long description'- }+ const fields = immutableAssign(baseCorrectParams, { description: 'super'.repeat(60) })await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields })})it('Should succeed with the correct parameters', async function () {- const fields = {- name: 'hello',- description: 'super description'- }- await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields, statusCodeExpected: 204 })+ await makePostBodyRequest({+ url: server.url,+ path,+ token: server.accessToken,+ fields: baseCorrectParams,+ statusCodeExpected: 204+ })})})describe('When updating a video channel', function () {+ const baseCorrectParams = {+ name: 'hello',+ description: 'super description'+ }+let videoChannelIdbefore(async function () {@@ -152,60 +114,41 @@ describe('Test videos API validator', function () {})it('Should fail with a non authenticated user', async function () {- const fields = {- name: 'hello',- description: 'super description'- }- await makePutBodyRequest({ url: server.url, path: path + '/' + videoChannelId, token: 'hi', fields, statusCodeExpected: 401 })+ await makePutBodyRequest({+ url: server.url,+ path: path + '/' + videoChannelId,+ token: 'hi',+ fields: baseCorrectParams,+ statusCodeExpected: 401+ })})it('Should fail with another authenticated user', async function () {- const fields = {- name: 'hello',- description: 'super description'- }await makePutBodyRequest({url: server.url,path: path + '/' + videoChannelId,token: accessTokenUser,- fields,+ fields: baseCorrectParams,statusCodeExpected: 403})})it('Should fail with a long name', async function () {- const fields = {- name: 'hello tooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo' +- 'oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo' +- 'oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo' +- 'oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo' +- 'oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo long',- description: 'super description'- }+ const fields = immutableAssign(baseCorrectParams, { name: 'super'.repeat(25) })await makePutBodyRequest({ url: server.url, path: path + '/' + videoChannelId, token: server.accessToken, fields })})it('Should fail with a long description', async function () {- const fields = {- name: 'hello',- description: 'super toooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo' +- 'oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo0' +- 'ooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo' +- 'oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo long description'- }+ const fields = immutableAssign(baseCorrectParams, { description: 'super'.repeat(60) })await makePutBodyRequest({ url: server.url, path: path + '/' + videoChannelId, token: server.accessToken, fields })})it('Should succeed with the correct parameters', async function () {- const fields = {- name: 'hello 2',- description: 'super description 2'- }await makePutBodyRequest({url: server.url,path: path + '/' + videoChannelId,token: server.accessToken,- fields,+ fields: baseCorrectParams,statusCodeExpected: 204})})@@ -220,34 +163,37 @@ describe('Test videos API validator', function () {})it('Should return the list of the video channels with nothing', async function () {- const res = await request(server.url)- .get(path)- .set('Accept', 'application/json')- .expect(200)- .expect('Content-Type', /json/)+ const res = await makeGetRequest({+ url: server.url,+ path,+ statusCodeExpected: 200+ })expect(res.body.data).to.be.an('array')})it('Should fail without a correct uuid', async function () {- await request(server.url)- .get(path + '/coucou')- .set('Accept', 'application/json')- .expect(400)+ await makeGetRequest({+ url: server.url,+ path: path + '/coucou',+ statusCodeExpected: 400+ })})it('Should return 404 with an incorrect video channel', async function () {- await request(server.url)- .get(path + '/4da6fde3-88f7-4d16-b119-108df5630b06')- .set('Accept', 'application/json')- .expect(404)+ await makeGetRequest({+ url: server.url,+ path: path + '/4da6fde3-88f7-4d16-b119-108df5630b06',+ statusCodeExpected: 404+ })})it('Should succeed with the correct parameters', async function () {- await request(server.url)- .get(path + '/' + videoChannelId)- .set('Accept', 'application/json')- .expect(200)+ await makeGetRequest({+ url: server.url,+ path: path + '/' + videoChannelId,+ statusCodeExpected: 200+ })})})@@ -260,42 +206,26 @@ describe('Test videos API validator', function () {})it('Should fail with a non authenticated user', async function () {- await request(server.url)- .delete(path + '/' + videoChannelId)- .set('Authorization', 'Bearer coucou')- .expect(401)+ await deleteVideoChannel(server.url, 'coucou', videoChannelId, 401)})it('Should fail with another authenticated user', async function () {- await request(server.url)- .delete(path + '/' + videoChannelId)- .set('Authorization', 'Bearer ' + accessTokenUser)- .expect(403)+ await deleteVideoChannel(server.url, accessTokenUser, videoChannelId, 403)})it('Should fail with an unknown id', async function () {- await request(server.url)- .delete(path + '/454554')- .set('Authorization', 'Bearer ' + server.accessToken)- .expect(404)+ await deleteVideoChannel(server.url, server.accessToken, 454554, 404)})it('Should succeed with the correct parameters', async function () {- await request(server.url)- .delete(path + '/' + videoChannelId)- .set('Authorization', 'Bearer ' + server.accessToken)- .expect(204)+ await deleteVideoChannel(server.url, server.accessToken, videoChannelId)})it('Should fail to delete the last user video channel', async function () {const res = await getVideoChannelsList(server.url, 0, 1)videoChannelId = res.body.data[0].id- await request(server.url)- .delete(path + '/' + videoChannelId)- .set('Authorization', 'Bearer ' + server.accessToken)- .expect(409- )+ await deleteVideoChannel(server.url, server.accessToken, videoChannelId, 409)})})diff --git a/server/tests/api/check-params/video-comments.ts b/server/tests/api/check-params/video-comments.tsindex f3832bd2cb..cdb48a2769 100644--- a/server/tests/api/check-params/video-comments.ts+++ b/server/tests/api/check-params/video-comments.ts@@ -1,8 +1,11 @@/* tslint:disable:no-unused-expression */import 'mocha'-import * as request from 'supertest'-import { flushTests, killallServers, makePostBodyRequest, runServer, ServerInfo, setAccessTokensToServers, uploadVideo } from '../../utils'+import {+ flushTests, killallServers, makeGetRequest, makePostBodyRequest, runServer, ServerInfo, setAccessTokensToServers,+ uploadVideo+} from '../../utils'+import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '../../utils/requests/check-api-params'import { addVideoCommentThread } from '../../utils/videos/video-comments'describe('Test video comments API validator', function () {@@ -38,57 +41,52 @@ describe('Test video comments API validator', function () {describe('When listing video comment threads', function () {it('Should fail with a bad start pagination', async function () {- await request(server.url)- .get(pathThread)- .query({ start: 'hello' })- .set('Accept', 'application/json')- .expect(400)+ await checkBadStartPagination(server.url, pathThread, server.accessToken)+})it('Should fail with a bad count pagination', async function () {- await request(server.url)- .get(pathThread)- .query({ count: 'hello' })- .set('Accept', 'application/json')- .expect(400)+ await checkBadCountPagination(server.url, pathThread, server.accessToken)+})it('Should fail with an incorrect sort', async function () {- await request(server.url)- .get(pathThread)- .query({ sort: 'hello' })- .set('Accept', 'application/json')- .expect(400)+ await checkBadSortPagination(server.url, pathThread, server.accessToken)+})it('Should fail with an incorrect video', async function () {- await request(server.url)- .get('/api/v1/videos/ba708d62-e3d7-45d9-9d73-41b9097cc02d/comment-threads')- .set('Accept', 'application/json')- .expect(404)+ await makeGetRequest({+ url: server.url,+ path: '/api/v1/videos/ba708d62-e3d7-45d9-9d73-41b9097cc02d/comment-threads',+ statusCodeExpected: 404+ })})})describe('When listing comments of a thread', function () {it('Should fail with an incorrect video', async function () {- await request(server.url)- .get('/api/v1/videos/ba708d62-e3d7-45d9-9d73-41b9097cc02d/comment-threads/' + commentId)- .set('Accept', 'application/json')- .expect(404)+ await makeGetRequest({+ url: server.url,+ path: '/api/v1/videos/ba708d62-e3d7-45d9-9d73-41b9097cc02d/comment-threads/' + commentId,+ statusCodeExpected: 404+ })})it('Should fail with an incorrect thread id', async function () {- await request(server.url)- .get('/api/v1/videos/' + videoUUID + '/comment-threads/156')- .set('Accept', 'application/json')- .expect(404)+ await makeGetRequest({+ url: server.url,+ path: '/api/v1/videos/' + videoUUID + '/comment-threads/156',+ statusCodeExpected: 404+ })})it('Should success with the correct params', async function () {- await request(server.url)- .get('/api/v1/videos/' + videoUUID + '/comment-threads/' + commentId)- .set('Accept', 'application/json')- .expect(200)+ await makeGetRequest({+ url: server.url,+ path: '/api/v1/videos/' + videoUUID + '/comment-threads/' + commentId,+ statusCodeExpected: 200+ })})})diff --git a/server/tests/api/check-params/videos.ts b/server/tests/api/check-params/videos.tsindex b0c850f0ca..b9484afc40 100644--- a/server/tests/api/check-params/videos.ts+++ b/server/tests/api/check-params/videos.ts@@ -1,64 +1,23 @@/* tslint:disable:no-unused-expression */-import * as request from 'supertest'-import { join } from 'path'-import 'mocha'import * as chai from 'chai'-const expect = chai.expect-+import { omit } from 'lodash'+import 'mocha'+import { join } from 'path'+import { VideoPrivacy } from '../../../../shared/models/videos/video-privacy.enum'import {- ServerInfo,- flushTests,- runServer,- getVideosList,- makePutBodyRequest,- setAccessTokensToServers,- killallServers,- makePostUploadRequest,- getMyUserInformation,- createUser,- userLogin+ createUser, flushTests, getMyUserInformation, getVideo, getVideosList, immutableAssign, killallServers, makeDeleteRequest,+ makeGetRequest, makePostUploadRequest, makePutBodyRequest, removeVideo, runServer, ServerInfo, setAccessTokensToServers, userLogin} from '../../utils'-import { VideoPrivacy } from '../../../../shared/models/videos/video-privacy.enum'+import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '../../utils/requests/check-api-params'++const expect = chai.expectdescribe('Test videos API validator', function () {const path = '/api/v1/videos/'let server: ServerInfolet channelId: number- function getCompleteVideoUploadAttributes () {- return {- name: 'my super name',- category: 5,- licence: 1,- language: 6,- nsfw: false,- description: 'my super description',- tags: [ 'tag1', 'tag2' ],- privacy: VideoPrivacy.PUBLIC,- channelId- }- }-- function getCompleteVideoUpdateAttributes () {- return {- name: 'my super name',- category: 5,- licence: 2,- language: 6,- nsfw: false,- description: 'my super description',- privacy: VideoPrivacy.PUBLIC,- tags: [ 'tag1', 'tag2' ]- }- }-- function getVideoUploadAttaches () {- return {- 'videofile': join(__dirname, '..', 'fixtures', 'video_short.webm')- }- }-// ---------------------------------------------------------------before(async function () {@@ -76,60 +35,38 @@ describe('Test videos API validator', function () {describe('When listing a video', function () {it('Should fail with a bad start pagination', async function () {- await request(server.url)- .get(path)- .query({ start: 'hello' })- .set('Accept', 'application/json')- .expect(400)+ await checkBadStartPagination(server.url, path)})it('Should fail with a bad count pagination', async function () {- await request(server.url)- .get(path)- .query({ count: 'hello' })- .set('Accept', 'application/json')- .expect(400)+ await checkBadCountPagination(server.url, path)})it('Should fail with an incorrect sort', async function () {- await request(server.url)- .get(path)- .query({ sort: 'hello' })- .set('Accept', 'application/json')- .expect(400)+ await checkBadSortPagination(server.url, path)})})describe('When searching a video', function () {+it('Should fail with nothing', async function () {- await request(server.url)- .get(join(path, 'search'))- .set('Accept', 'application/json')- .expect(400)+ await makeGetRequest({+ url: server.url,+ path: join(path, 'search'),+ statusCodeExpected: 400+ })})it('Should fail with a bad start pagination', async function () {- await request(server.url)- .get(join(path, 'search', 'test'))- .query({ start: 'hello' })- .set('Accept', 'application/json')- .expect(400)+ await checkBadStartPagination(server.url, join(path, 'search', 'test'))})it('Should fail with a bad count pagination', async function () {- await request(server.url)- .get(join(path, 'search', 'test'))- .query({ count: 'hello' })- .set('Accept', 'application/json')- .expect(400)+ await checkBadCountPagination(server.url, join(path, 'search', 'test'))})it('Should fail with an incorrect sort', async function () {- await request(server.url)- .get(join(path, 'search', 'test'))- .query({ sort: 'hello' })- .set('Accept', 'application/json')- .expect(400)+ await checkBadSortPagination(server.url, join(path, 'search', 'test'))})})@@ -137,34 +74,39 @@ describe('Test videos API validator', function () {const path = '/api/v1/users/me/videos'it('Should fail with a bad start pagination', async function () {- await request(server.url)- .get(path)- .set('Authorization', 'Bearer ' + server.accessToken)- .query({ start: 'hello' })- .set('Accept', 'application/json')- .expect(400)+ await checkBadStartPagination(server.url, path, server.accessToken)})it('Should fail with a bad count pagination', async function () {- await request(server.url)- .get(path)- .set('Authorization', 'Bearer ' + server.accessToken)- .query({ count: 'hello' })- .set('Accept', 'application/json')- .expect(400)+ await checkBadCountPagination(server.url, path, server.accessToken)})it('Should fail with an incorrect sort', async function () {- await request(server.url)- .get(path)- .set('Authorization', 'Bearer ' + server.accessToken)- .query({ sort: 'hello' })- .set('Accept', 'application/json')- .expect(400)+ await checkBadSortPagination(server.url, path, server.accessToken)})})describe('When adding a video', function () {+ let baseCorrectParams+ const baseCorrectAttaches = {+ 'videofile': join(__dirname, '..', 'fixtures', 'video_short.webm')+ }++ before(function () {+ // Put in before to have channelId+ baseCorrectParams = {+ name: 'my super name',+ category: 5,+ licence: 1,+ language: 6,+ nsfw: false,+ description: 'my super description',+ tags: [ 'tag1', 'tag2' ],+ privacy: VideoPrivacy.PUBLIC,+ channelId+ }+ })+it('Should fail with nothing', async function () {const fields = {}const attaches = {}@@ -172,84 +114,72 @@ describe('Test videos API validator', function () {})it('Should fail without name', async function () {- const fields = getCompleteVideoUploadAttributes()- delete fields.name+ const fields = omit(baseCorrectParams, 'name')+ const attaches = baseCorrectAttaches- const attaches = getVideoUploadAttaches()await makePostUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })})it('Should fail with a long name', async function () {- const fields = getCompleteVideoUploadAttributes()- fields.name = 'My very very very very very very very very very very very very very very very very very ' +- 'very very very very very very very very very very very very very very very very long long' +- 'very very very very very very very very very very very very very very very very long name'+ const fields = immutableAssign(baseCorrectParams, { name: 'super'.repeat(65) })+ const attaches = baseCorrectAttaches- const attaches = getVideoUploadAttachesawait makePostUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })})it('Should fail with a bad category', async function () {- const fields = getCompleteVideoUploadAttributes()- fields.category = 125+ const fields = immutableAssign(baseCorrectParams, { category: 125 })+ const attaches = baseCorrectAttaches- const attaches = getVideoUploadAttachesawait makePostUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })})it('Should fail with a bad licence', async function () {- const fields = getCompleteVideoUploadAttributes()- fields.licence = 125+ const fields = immutableAssign(baseCorrectParams, { licence: 125 })+ const attaches = baseCorrectAttaches- const attaches = getVideoUploadAttaches()await makePostUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })})it('Should fail with a bad language', async function () {- const fields = getCompleteVideoUploadAttributes()- fields.language = 563+ const fields = immutableAssign(baseCorrectParams, { language: 125 })+ const attaches = baseCorrectAttaches- const attaches = getVideoUploadAttaches()await makePostUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })})it('Should fail without nsfw attribute', async function () {- const fields = getCompleteVideoUploadAttributes()- delete fields.nsfw+ const fields = omit(baseCorrectParams, 'nsfw')+ const attaches = baseCorrectAttaches- const attaches = getVideoUploadAttaches()await makePostUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })})it('Should fail with a bad nsfw attribute', async function () {- const fields = getCompleteVideoUploadAttributes()- fields.nsfw = 2 as any+ const fields = immutableAssign(baseCorrectParams, { nsfw: 2 })+ const attaches = baseCorrectAttaches- const attaches = getVideoUploadAttaches()await makePostUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })})it('Should fail with a long description', async function () {- const fields = getCompleteVideoUploadAttributes()- fields.description = 'my super description which is very very very very very very very very very very very very long'.repeat(35)+ const fields = immutableAssign(baseCorrectParams, { description: 'super'.repeat(1500) })+ const attaches = baseCorrectAttaches- const attaches = getVideoUploadAttaches()await makePostUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })})it('Should fail without a channel', async function () {- const fields = getCompleteVideoUploadAttributes()- delete fields.channelId+ const fields = omit(baseCorrectParams, 'channelId')+ const attaches = baseCorrectAttaches- const attaches = getVideoUploadAttaches()await makePostUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })})it('Should fail with a bad channel', async function () {- const fields = getCompleteVideoUploadAttributes()- fields.channelId = 545454+ const fields = immutableAssign(baseCorrectParams, { channelId: 545454 })+ const attaches = baseCorrectAttaches- const attaches = getVideoUploadAttaches()await makePostUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })})@@ -264,45 +194,41 @@ describe('Test videos API validator', function () {const res = await getMyUserInformation(server.url, accessTokenUser)const customChannelId = res.body.videoChannels[0].id- const fields = getCompleteVideoUploadAttributes()- fields.channelId = customChannelId+ const fields = immutableAssign(baseCorrectParams, { channelId: customChannelId })+ const attaches = baseCorrectAttaches- const attaches = getVideoUploadAttaches()await makePostUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })})it('Should fail with too many tags', async function () {- const fields = getCompleteVideoUploadAttributes()- fields.tags = [ 'tag1', 'tag2', 'tag3', 'tag4', 'tag5', 'tag6' ]+ const fields = immutableAssign(baseCorrectParams, { tags: [ 'tag1', 'tag2', 'tag3', 'tag4', 'tag5', 'tag6' ] })+ const attaches = baseCorrectAttaches- const attaches = getVideoUploadAttaches()await makePostUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })})it('Should fail with a tag length too low', async function () {- const fields = getCompleteVideoUploadAttributes()- fields.tags = [ 'tag1', 't' ]+ const fields = immutableAssign(baseCorrectParams, { tags: [ 'tag1', 't' ] })+ const attaches = baseCorrectAttaches- const attaches = getVideoUploadAttaches()await makePostUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })})it('Should fail with a tag length too big', async function () {- const fields = getCompleteVideoUploadAttributes()- fields.tags = [ 'my_super_tag_too_long_long_long_long_long_long', 'tag1' ]+ const fields = immutableAssign(baseCorrectParams, { tags: [ 'tag1', 'my_super_tag_too_long_long_long_long_long_long' ] })+ const attaches = baseCorrectAttaches- const attaches = getVideoUploadAttaches()await makePostUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })})it('Should fail without an input file', async function () {- const fields = getCompleteVideoUploadAttributes()+ const fields = baseCorrectParamsconst attaches = {}await makePostUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })})it('Should fail without an incorrect input file', async function () {- const fields = getCompleteVideoUploadAttributes()+ const fields = baseCorrectParamsconst attaches = {'videofile': join(__dirname, '..', 'fixtures', 'video_short_fake.webm')}@@ -312,41 +238,63 @@ describe('Test videos API validator', function () {it('Should succeed with the correct parameters', async function () {this.timeout(10000)- const fields = getCompleteVideoUploadAttributes()- const attaches = getVideoUploadAttaches()-- await makePostUploadRequest({- url: server.url,- path: path + '/upload',- token: server.accessToken,- fields,- attaches,- statusCodeExpected: 200- })+ const fields = baseCorrectParams++ {+ const attaches = baseCorrectAttaches+ await makePostUploadRequest({+ url: server.url,+ path: path + '/upload',+ token: server.accessToken,+ fields,+ attaches,+ statusCodeExpected: 200+ })+ }- attaches.videofile = join(__dirname, '..', 'fixtures', 'video_short.mp4')- await makePostUploadRequest({- url: server.url,- path: path + '/upload',- token: server.accessToken,- fields,- attaches,- statusCodeExpected: 200- })+ {+ const attaches = immutableAssign(baseCorrectAttaches, {+ videofile: join(__dirname, '..', 'fixtures', 'video_short.mp4')+ })++ await makePostUploadRequest({+ url: server.url,+ path: path + '/upload',+ token: server.accessToken,+ fields,+ attaches,+ statusCodeExpected: 200+ })+ }- attaches.videofile = join(__dirname, '..', 'fixtures', 'video_short.ogv')- await makePostUploadRequest({- url: server.url,- path: path + '/upload',- token: server.accessToken,- fields,- attaches,- statusCodeExpected: 200- })+ {+ const attaches = immutableAssign(baseCorrectAttaches, {+ videofile: join(__dirname, '..', 'fixtures', 'video_short.ogv')+ })++ await makePostUploadRequest({+ url: server.url,+ path: path + '/upload',+ token: server.accessToken,+ fields,+ attaches,+ statusCodeExpected: 200+ })+ }})})describe('When updating a video', function () {+ const baseCorrectParams = {+ name: 'my super name',+ category: 5,+ licence: 2,+ language: 6,+ nsfw: false,+ description: 'my super description',+ privacy: VideoPrivacy.PUBLIC,+ tags: [ 'tag1', 'tag2' ]+ }let videoIdbefore(async function () {@@ -360,12 +308,12 @@ describe('Test videos API validator', function () {})it('Should fail without a valid uuid', async function () {- const fields = getCompleteVideoUpdateAttributes()+ const fields = baseCorrectParamsawait makePutBodyRequest({ url: server.url, path: path + 'blabla', token: server.accessToken, fields })})it('Should fail with an unknown id', async function () {- const fields = getCompleteVideoUpdateAttributes()+ const fields = baseCorrectParamsawait makePutBodyRequest({url: server.url,@@ -377,64 +325,55 @@ describe('Test videos API validator', function () {})it('Should fail with a long name', async function () {- const fields = getCompleteVideoUpdateAttributes()- fields.name = 'My very very very very very very very very very very very very very very very very long'.repeat(3)+ const fields = immutableAssign(baseCorrectParams, { name: 'super'.repeat(65) })await makePutBodyRequest({ url: server.url, path: path + videoId, token: server.accessToken, fields })})it('Should fail with a bad category', async function () {- const fields = getCompleteVideoUpdateAttributes()- fields.category = 128+ const fields = immutableAssign(baseCorrectParams, { category: 125 })await makePutBodyRequest({ url: server.url, path: path + videoId, token: server.accessToken, fields })})it('Should fail with a bad licence', async function () {- const fields = getCompleteVideoUpdateAttributes()- fields.licence = 128+ const fields = immutableAssign(baseCorrectParams, { licence: 125 })await makePutBodyRequest({ url: server.url, path: path + videoId, token: server.accessToken, fields })})it('Should fail with a bad language', async function () {- const fields = getCompleteVideoUpdateAttributes()- fields.language = 896+ const fields = immutableAssign(baseCorrectParams, { language: 125 })await makePutBodyRequest({ url: server.url, path: path + videoId, token: server.accessToken, fields })})it('Should fail with a bad nsfw attribute', async function () {- const fields = getCompleteVideoUpdateAttributes()- fields.nsfw = (-4 as any)+ const fields = immutableAssign(baseCorrectParams, { nsfw: 2 })await makePutBodyRequest({ url: server.url, path: path + videoId, token: server.accessToken, fields })})it('Should fail with a long description', async function () {- const fields = getCompleteVideoUpdateAttributes()- fields.description = 'my super description which is very very very very very very very very very very very very very long'.repeat(35)+ const fields = immutableAssign(baseCorrectParams, { description: 'super'.repeat(1500) })await makePutBodyRequest({ url: server.url, path: path + videoId, token: server.accessToken, fields })})it('Should fail with too many tags', async function () {- const fields = getCompleteVideoUpdateAttributes()- fields.tags = [ 'tag1', 'tag2', 'tag3', 'tag4', 'tag5', 'tag6' ]+ const fields = immutableAssign(baseCorrectParams, { tags: [ 'tag1', 'tag2', 'tag3', 'tag4', 'tag5', 'tag6' ] })await makePutBodyRequest({ url: server.url, path: path + videoId, token: server.accessToken, fields })})it('Should fail with a tag length too low', async function () {- const fields = getCompleteVideoUpdateAttributes()- fields.tags = [ 'tag1', 't' ]+ const fields = immutableAssign(baseCorrectParams, { tags: [ 'tag1', 't' ] })await makePutBodyRequest({ url: server.url, path: path + videoId, token: server.accessToken, fields })})it('Should fail with a tag length too big', async function () {- const fields = getCompleteVideoUpdateAttributes()- fields.tags = [ 'my_super_tag_too_long_long_long_long', 'tag1' ]+ const fields = immutableAssign(baseCorrectParams, { tags: [ 'tag1', 'my_super_tag_too_long_long_long_long_long_long' ] })await makePutBodyRequest({ url: server.url, path: path + videoId, token: server.accessToken, fields })})@@ -444,7 +383,7 @@ describe('Test videos API validator', function () {it('Should fail with a video of another server')it('Should succeed with the correct parameters', async function () {- const fields = getCompleteVideoUpdateAttributes()+ const fields = baseCorrectParamsawait makePutBodyRequest({ url: server.url, path: path + videoId, token: server.accessToken, fields, statusCodeExpected: 204 })})@@ -452,28 +391,22 @@ describe('Test videos API validator', function () {describe('When getting a video', function () {it('Should return the list of the videos with nothing', async function () {- const res = await request(server.url)- .get(path)- .set('Accept', 'application/json')- .expect(200)- .expect('Content-Type', /json/)+ const res = await makeGetRequest({+ url: server.url,+ path,+ statusCodeExpected: 200+ })expect(res.body.data).to.be.an('array')expect(res.body.data.length).to.equal(3)})it('Should fail without a correct uuid', async function () {- await request(server.url)- .get(path + 'coucou')- .set('Accept', 'application/json')- .expect(400)+ await getVideo(server.url, 'coucou', 400)})it('Should return 404 with an incorrect video', async function () {- await request(server.url)- .get(path + '4da6fde3-88f7-4d16-b119-108df5630b06')- .set('Accept', 'application/json')- .expect(404)+ await getVideo(server.url, '4da6fde3-88f7-4d16-b119-108df5630b06', 404)})it('Should succeed with the correct parameters')@@ -530,24 +463,19 @@ describe('Test videos API validator', function () {describe('When removing a video', function () {it('Should have 404 with nothing', async function () {- await request(server.url)- .delete(path)- .set('Authorization', 'Bearer ' + server.accessToken)- .expect(400)+ await makeDeleteRequest({+ url: server.url,+ path,+ statusCodeExpected: 400+ })})it('Should fail without a correct uuid', async function () {- await request(server.url)- .delete(path + 'hello')- .set('Authorization', 'Bearer ' + server.accessToken)- .expect(400)+ await removeVideo(server.url, server.accessToken, 'hello', 400)})it('Should fail with a video which does not exist', async function () {- await request(server.url)- .delete(path + '4da6fde3-88f7-4d16-b119-108df5630b06')- .set('Authorization', 'Bearer ' + server.accessToken)- .expect(404)+ await removeVideo(server.url, server.accessToken, '4da6fde3-88f7-4d16-b119-108df5630b06', 404)})it('Should fail with a video of another user')diff --git a/server/tests/api/users/users.ts b/server/tests/api/users/users.tsindex ec164cadc1..b7ec3bc0fd 100644--- a/server/tests/api/users/users.ts+++ b/server/tests/api/users/users.ts@@ -4,32 +4,13 @@ import * as chai from 'chai'import 'mocha'import { UserRole } from '../../../../shared/index'import {- createUser,- flushTests,- getBlacklistedVideosList,- getMyUserInformation,- getUserInformation,- getUsersList,- getUsersListPaginationAndSort,- getMyUserVideoRating,- getVideosList,- killallServers,- login,- serverLogin,- makePutBodyRequest,- rateVideo,- registerUser,- removeUser,- removeVideo,- runServer,- ServerInfo,- updateMyUser,- updateUser,- uploadVideo+ createUser, flushTests, getBlacklistedVideosList, getMyUserInformation, getMyUserVideoRating, getUserInformation, getUsersList,+ getUsersListPaginationAndSort, getVideosList, killallServers, login, makePutBodyRequest, rateVideo, registerUser, removeUser, removeVideo,+ runServer, ServerInfo, serverLogin, updateMyUser, updateUser, uploadVideo} from '../../utils/index'import { follow } from '../../utils/server/follows'-import { getMyVideos } from '../../utils/videos/videos'import { setAccessTokensToServers } from '../../utils/users/login'+import { getMyVideos } from '../../utils/videos/videos'const expect = chai.expect@@ -387,14 +368,22 @@ describe('Test users', function () {})it('Should update my password', async function () {- await updateMyUser(server.url, accessTokenUser, 'new password')+ await updateMyUser({+ url: server.url,+ accessToken: accessTokenUser,+ newPassword: 'new password'+ })server.user.password = 'new password'await login(server.url, server.client, server.user, 200)})it('Should be able to change the NSFW display attribute', async function () {- await updateMyUser(server.url, accessTokenUser, undefined, true)+ await updateMyUser({+ url: server.url,+ accessToken: accessTokenUser,+ displayNSFW: true+ })const res = await getMyUserInformation(server.url, accessTokenUser)const user = res.body@@ -416,7 +405,11 @@ describe('Test users', function () {})it('Should be able to change the autoPlayVideo attribute', async function () {- await updateMyUser(server.url, accessTokenUser, undefined, undefined, undefined, false)+ await updateMyUser({+ url: server.url,+ accessToken: accessTokenUser,+ autoPlayVideo: false+ })const res = await getMyUserInformation(server.url, accessTokenUser)const user = res.body@@ -425,7 +418,11 @@ describe('Test users', function () {})it('Should be able to change the email display attribute', async function () {- await updateMyUser(server.url, accessTokenUser, undefined, undefined, '[email protected]')+ await updateMyUser({+ url: server.url,+ accessToken: accessTokenUser,+ email: '[email protected]'+ })const res = await getMyUserInformation(server.url, accessTokenUser)const user = res.body@@ -447,7 +444,14 @@ describe('Test users', function () {})it('Should be able to update another user', async function () {- await updateUser(server.url, userId, accessToken, '[email protected]', 42, UserRole.MODERATOR)+ await updateUser({+ url: server.url,+ userId,+ accessToken,+ email: '[email protected]',+ videoQuota: 42,+ role: UserRole.MODERATOR+ })const res = await getUserInformation(server.url, accessToken, userId)const user = res.bodydiff --git a/server/tests/utils/videos/video-blacklist.ts b/server/tests/utils/videos/video-blacklist.tsindex 3a499f46a7..aa0d232b6c 100644--- a/server/tests/utils/videos/video-blacklist.ts+++ b/server/tests/utils/videos/video-blacklist.ts@@ -10,7 +10,7 @@ function addVideoToBlacklist (url: string, token: string, videoId: number, speci.expect(specialStatus)}-function removeVideoFromBlacklist (url: string, token: string, videoId: number, specialStatus = 204) {+function removeVideoFromBlacklist (url: string, token: string, videoId: number | string, specialStatus = 204) {const path = '/api/v1/videos/' + videoId + '/blacklist'return request(url)diff --git a/server/tests/utils/videos/video-channels.ts b/server/tests/utils/videos/video-channels.tsindex 0fb80d3312..062ca8f4d0 100644--- a/server/tests/utils/videos/video-channels.ts+++ b/server/tests/utils/videos/video-channels.ts@@ -20,13 +20,13 @@ function getVideoChannelsList (url: string, start: number, count: number, sort?:.expect('Content-Type', /json/)}-function getAccountVideoChannelsList (url: string, accountId: number | string) {+function getAccountVideoChannelsList (url: string, accountId: number | string, specialStatus = 200) {const path = '/api/v1/videos/accounts/' + accountId + '/channels'return request(url).get(path).set('Accept', 'application/json')- .expect(200)+ .expect(specialStatus).expect('Content-Type', /json/)}diff --git a/server/tests/utils/videos/videos.ts b/server/tests/utils/videos/videos.tsindex fefee4878c..166253ffc9 100644--- a/server/tests/utils/videos/videos.ts+++ b/server/tests/utils/videos/videos.ts@@ -143,7 +143,7 @@ function getVideosListSort (url: string, sort: string) {.expect('Content-Type', /json/)}-function removeVideo (url: string, token: string, id: number, expectedStatus = 204) {+function removeVideo (url: string, token: string, id: number | string, expectedStatus = 204) {const path = '/api/v1/videos'return request(url)