X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftests%2Fapi%2Fcheck-params%2Fvideo-blacklist.ts;h=c2e9622cc41caefdaf0341d66643332fd3063915;hb=94565d52bb2883e09f16d1363170ac9c0dccb7a1;hp=6b82643f4fbcbfa2e9f74f144e224ee9f98025a6;hpb=5abb9fbbd12e7097e348d6a38622d364b1fa47ed;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tests/api/check-params/video-blacklist.ts b/server/tests/api/check-params/video-blacklist.ts index 6b82643f4..c2e9622cc 100644 --- a/server/tests/api/check-params/video-blacklist.ts +++ b/server/tests/api/check-params/video-blacklist.ts @@ -18,13 +18,13 @@ import { setAccessTokensToServers, uploadVideo, userLogin, waitJobs -} from '../../../../shared/utils' +} from '../../../../shared/extra-utils' import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination -} from '../../../../shared/utils/requests/check-api-params' -import { VideoDetails } from '../../../../shared/models/videos' +} from '../../../../shared/extra-utils/requests/check-api-params' +import { VideoDetails, VideoBlacklistType } from '../../../../shared/models/videos' import { expect } from 'chai' describe('Test video blacklist API validators', function () { @@ -48,14 +48,14 @@ describe('Test video blacklist API validators', function () { { const username = 'user1' const password = 'my super password' - await createUser(servers[0].url, servers[0].accessToken, username, password) + await createUser({ url: servers[ 0 ].url, accessToken: servers[ 0 ].accessToken, username: username, password: password }) userAccessToken1 = await userLogin(servers[0], { username, password }) } { const username = 'user2' const password = 'my super password' - await createUser(servers[0].url, servers[0].accessToken, username, password) + await createUser({ url: servers[ 0 ].url, accessToken: servers[ 0 ].accessToken, username: username, password: password }) userAccessToken2 = await userLogin(servers[0], { username, password }) } @@ -220,11 +220,11 @@ describe('Test video blacklist API validators', function () { const basePath = '/api/v1/videos/blacklist/' it('Should fail with a non authenticated user', async function () { - await getBlacklistedVideosList(servers[0].url, 'fake token', 401) + await getBlacklistedVideosList({ url: servers[0].url, token: 'fake token', specialStatus: 401 }) }) it('Should fail with a non admin user', async function () { - await getBlacklistedVideosList(servers[0].url, userAccessToken2, 403) + await getBlacklistedVideosList({ url: servers[0].url, token: userAccessToken2, specialStatus: 403 }) }) it('Should fail with a bad start pagination', async function () { @@ -238,6 +238,14 @@ describe('Test video blacklist API validators', function () { it('Should fail with an incorrect sort', async function () { await checkBadSortPagination(servers[0].url, basePath, servers[0].accessToken) }) + + it('Should fail with an invalid type', async function () { + await getBlacklistedVideosList({ url: servers[0].url, token: servers[0].accessToken, type: 0, specialStatus: 400 }) + }) + + it('Should succeed with the correct parameters', async function () { + await getBlacklistedVideosList({ url: servers[0].url, token: servers[0].accessToken, type: VideoBlacklistType.MANUAL }) + }) }) after(async function () {