X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;ds=sidebyside;f=server%2Ftests%2Fapi%2Fcheck-params%2Fusers.ts;h=3e53c445d313870607c92d9aa73e36fc5b6d7f56;hb=b488ba1e26b803ac6c637e8b11bdd444ca4c803f;hp=472fbda4314e6628211f8e5805cce71dfc52a700;hpb=3487330d308166afb542cbacae0475693c0b059e;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tests/api/check-params/users.ts b/server/tests/api/check-params/users.ts index 472fbda43..3e53c445d 100644 --- a/server/tests/api/check-params/users.ts +++ b/server/tests/api/check-params/users.ts @@ -1,10 +1,10 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ -import { omit } from 'lodash' import 'mocha' +import { expect } from 'chai' +import { omit } from 'lodash' import { join } from 'path' import { User, UserRole, VideoImport, VideoImportState } from '../../../../shared' - import { addVideoChannel, blockUser, @@ -31,17 +31,16 @@ import { uploadVideo, userLogin } from '../../../../shared/extra-utils' +import { MockSmtpServer } from '../../../../shared/extra-utils/miscs/email' import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '../../../../shared/extra-utils/requests/check-api-params' -import { getMagnetURI, getMyVideoImports, getYoutubeVideoUrl, importVideo } from '../../../../shared/extra-utils/videos/video-imports' -import { VideoPrivacy } from '../../../../shared/models/videos' import { waitJobs } from '../../../../shared/extra-utils/server/jobs' -import { expect } from 'chai' +import { getMagnetURI, getMyVideoImports, getGoodVideoUrl, importVideo } from '../../../../shared/extra-utils/videos/video-imports' import { UserAdminFlag } from '../../../../shared/models/users/user-flag.model' -import { MockSmtpServer } from '../../../../shared/extra-utils/miscs/email' +import { VideoPrivacy } from '../../../../shared/models/videos' describe('Test users API validators', function () { const path = '/api/v1/users/' @@ -55,8 +54,6 @@ describe('Test users API validators', function () { let moderatorAccessToken = '' let emailPort: number let overrideConfig: Object - // eslint-disable-next-line @typescript-eslint/no-unused-vars - let channelId: number // --------------------------------------------------------------- @@ -129,11 +126,6 @@ describe('Test users API validators', function () { }) } - { - const res = await getMyUserInformation(server.url, server.accessToken) - channelId = res.body.videoChannels[0].id - } - { const res = await uploadVideo(server.url, server.accessToken, {}) videoId = res.body.video.id @@ -162,6 +154,18 @@ describe('Test users API validators', function () { await checkBadSortPagination(server.url, path, server.accessToken) }) + it('Should fail with a bad blocked/banned user filter', async function () { + await makeGetRequest({ + url: server.url, + path, + query: { + blocked: 42 + }, + token: server.accessToken, + statusCodeExpected: 400 + }) + }) + it('Should fail with a non authenticated user', async function () { await makeGetRequest({ url: server.url, @@ -1042,7 +1046,7 @@ describe('Test users API validators', function () { channelId: 1, privacy: VideoPrivacy.PUBLIC } - await importVideo(server.url, server.accessToken, immutableAssign(baseAttributes, { targetUrl: getYoutubeVideoUrl() })) + await importVideo(server.url, server.accessToken, immutableAssign(baseAttributes, { targetUrl: getGoodVideoUrl() })) await importVideo(server.url, server.accessToken, immutableAssign(baseAttributes, { magnetUri: getMagnetURI() })) await importVideo(server.url, server.accessToken, immutableAssign(baseAttributes, { torrentfile: 'video-720p.torrent' as any }))