aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/check-params
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api/check-params')
-rw-r--r--server/tests/api/check-params/users.ts16
1 files changed, 14 insertions, 2 deletions
diff --git a/server/tests/api/check-params/users.ts b/server/tests/api/check-params/users.ts
index 60165ae22..b3fb61f6c 100644
--- a/server/tests/api/check-params/users.ts
+++ b/server/tests/api/check-params/users.ts
@@ -8,7 +8,7 @@ import { UserRole, VideoImport, VideoImportState } from '../../../../shared'
8import { 8import {
9 createUser, flushTests, getMyUserInformation, getMyUserVideoRating, getUsersList, immutableAssign, killallServers, makeGetRequest, 9 createUser, flushTests, getMyUserInformation, getMyUserVideoRating, getUsersList, immutableAssign, killallServers, makeGetRequest,
10 makePostBodyRequest, makeUploadRequest, makePutBodyRequest, registerUser, removeUser, runServer, ServerInfo, setAccessTokensToServers, 10 makePostBodyRequest, makeUploadRequest, makePutBodyRequest, registerUser, removeUser, runServer, ServerInfo, setAccessTokensToServers,
11 updateUser, uploadVideo, userLogin, deleteMe 11 updateUser, uploadVideo, userLogin, deleteMe, unblockUser, blockUser
12} from '../../utils' 12} from '../../utils'
13import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '../../utils/requests/check-api-params' 13import { checkBadCountPagination, checkBadSortPagination, checkBadStartPagination } from '../../utils/requests/check-api-params'
14import { getMagnetURI, getMyVideoImports, getYoutubeVideoUrl, importVideo } from '../../utils/videos/video-imports' 14import { getMagnetURI, getMyVideoImports, getYoutubeVideoUrl, importVideo } from '../../utils/videos/video-imports'
@@ -455,17 +455,29 @@ describe('Test users API validators', function () {
455 }) 455 })
456 }) 456 })
457 457
458 describe('When removing an user', function () { 458 describe('When blocking/unblocking/removing user', function () {
459 it('Should fail with an incorrect id', async function () { 459 it('Should fail with an incorrect id', async function () {
460 await removeUser(server.url, 'blabla', server.accessToken, 400) 460 await removeUser(server.url, 'blabla', server.accessToken, 400)
461 await blockUser(server.url, 'blabla', server.accessToken, 400)
462 await unblockUser(server.url, 'blabla', server.accessToken, 400)
461 }) 463 })
462 464
463 it('Should fail with the root user', async function () { 465 it('Should fail with the root user', async function () {
464 await removeUser(server.url, rootId, server.accessToken, 400) 466 await removeUser(server.url, rootId, server.accessToken, 400)
467 await blockUser(server.url, rootId, server.accessToken, 400)
468 await unblockUser(server.url, rootId, server.accessToken, 400)
465 }) 469 })
466 470
467 it('Should return 404 with a non existing id', async function () { 471 it('Should return 404 with a non existing id', async function () {
468 await removeUser(server.url, 4545454, server.accessToken, 404) 472 await removeUser(server.url, 4545454, server.accessToken, 404)
473 await blockUser(server.url, 4545454, server.accessToken, 404)
474 await unblockUser(server.url, 4545454, server.accessToken, 404)
475 })
476
477 it('Should fail with a non admin user', async function () {
478 await removeUser(server.url, userId, userAccessToken, 403)
479 await blockUser(server.url, userId, userAccessToken, 403)
480 await unblockUser(server.url, userId, userAccessToken, 403)
469 }) 481 })
470 }) 482 })
471 483