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.ts5
-rw-r--r--server/tests/api/check-params/video-channels.ts18
2 files changed, 12 insertions, 11 deletions
diff --git a/server/tests/api/check-params/users.ts b/server/tests/api/check-params/users.ts
index da0f55bf8..88fc8e8b1 100644
--- a/server/tests/api/check-params/users.ts
+++ b/server/tests/api/check-params/users.ts
@@ -5,7 +5,6 @@ import { omit } from 'lodash'
5import { User, UserRole, VideoCreateResult } from '../../../../shared' 5import { User, UserRole, VideoCreateResult } from '../../../../shared'
6import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' 6import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
7import { 7import {
8 addVideoChannel,
9 blockUser, 8 blockUser,
10 buildAbsoluteFixturePath, 9 buildAbsoluteFixturePath,
11 cleanupTests, 10 cleanupTests,
@@ -1041,8 +1040,8 @@ describe('Test users API validators', function () {
1041 }) 1040 })
1042 1041
1043 it('Should fail with an existing channel', async function () { 1042 it('Should fail with an existing channel', async function () {
1044 const videoChannelAttributesArg = { name: 'existing_channel', displayName: 'hello', description: 'super description' } 1043 const attributes = { name: 'existing_channel', displayName: 'hello', description: 'super description' }
1045 await addVideoChannel(server.url, server.accessToken, videoChannelAttributesArg) 1044 await server.channelsCommand.create({ attributes })
1046 1045
1047 const fields = immutableAssign(baseCorrectParams, { channel: { name: 'existing_channel', displayName: 'toto' } }) 1046 const fields = immutableAssign(baseCorrectParams, { channel: { name: 'existing_channel', displayName: 'toto' } })
1048 1047
diff --git a/server/tests/api/check-params/video-channels.ts b/server/tests/api/check-params/video-channels.ts
index 5c02afd31..d29346dc3 100644
--- a/server/tests/api/check-params/video-channels.ts
+++ b/server/tests/api/check-params/video-channels.ts
@@ -6,11 +6,10 @@ import { omit } from 'lodash'
6import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' 6import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
7import { 7import {
8 buildAbsoluteFixturePath, 8 buildAbsoluteFixturePath,
9 ChannelsCommand,
9 cleanupTests, 10 cleanupTests,
10 createUser, 11 createUser,
11 deleteVideoChannel,
12 flushAndRunServer, 12 flushAndRunServer,
13 getAccountVideoChannelsList,
14 immutableAssign, 13 immutableAssign,
15 makeGetRequest, 14 makeGetRequest,
16 makePostBodyRequest, 15 makePostBodyRequest,
@@ -33,6 +32,7 @@ describe('Test video channels API validator', function () {
33 const videoChannelPath = '/api/v1/video-channels' 32 const videoChannelPath = '/api/v1/video-channels'
34 let server: ServerInfo 33 let server: ServerInfo
35 let accessTokenUser: string 34 let accessTokenUser: string
35 let command: ChannelsCommand
36 36
37 // --------------------------------------------------------------- 37 // ---------------------------------------------------------------
38 38
@@ -52,6 +52,8 @@ describe('Test video channels API validator', function () {
52 await createUser({ url: server.url, accessToken: server.accessToken, username: user.username, password: user.password }) 52 await createUser({ url: server.url, accessToken: server.accessToken, username: user.username, password: user.password })
53 accessTokenUser = await userLogin(server, user) 53 accessTokenUser = await userLogin(server, user)
54 } 54 }
55
56 command = server.channelsCommand
55 }) 57 })
56 58
57 describe('When listing a video channels', function () { 59 describe('When listing a video channels', function () {
@@ -84,7 +86,7 @@ describe('Test video channels API validator', function () {
84 }) 86 })
85 87
86 it('Should fail with a unknown account', async function () { 88 it('Should fail with a unknown account', async function () {
87 await getAccountVideoChannelsList({ url: server.url, accountName: 'unknown', specialStatus: HttpStatusCode.NOT_FOUND_404 }) 89 await server.channelsCommand.listByAccount({ accountName: 'unknown', expectedStatus: HttpStatusCode.NOT_FOUND_404 })
88 }) 90 })
89 91
90 it('Should succeed with the correct parameters', async function () { 92 it('Should succeed with the correct parameters', async function () {
@@ -327,23 +329,23 @@ describe('Test video channels API validator', function () {
327 329
328 describe('When deleting a video channel', function () { 330 describe('When deleting a video channel', function () {
329 it('Should fail with a non authenticated user', async function () { 331 it('Should fail with a non authenticated user', async function () {
330 await deleteVideoChannel(server.url, 'coucou', 'super_channel', HttpStatusCode.UNAUTHORIZED_401) 332 await command.delete({ token: 'coucou', channelName: 'super_channel', expectedStatus: HttpStatusCode.UNAUTHORIZED_401 })
331 }) 333 })
332 334
333 it('Should fail with another authenticated user', async function () { 335 it('Should fail with another authenticated user', async function () {
334 await deleteVideoChannel(server.url, accessTokenUser, 'super_channel', HttpStatusCode.FORBIDDEN_403) 336 await command.delete({ token: accessTokenUser, channelName: 'super_channel', expectedStatus: HttpStatusCode.FORBIDDEN_403 })
335 }) 337 })
336 338
337 it('Should fail with an unknown video channel id', async function () { 339 it('Should fail with an unknown video channel id', async function () {
338 await deleteVideoChannel(server.url, server.accessToken, 'super_channel2', HttpStatusCode.NOT_FOUND_404) 340 await command.delete({ channelName: 'super_channel2', expectedStatus: HttpStatusCode.NOT_FOUND_404 })
339 }) 341 })
340 342
341 it('Should succeed with the correct parameters', async function () { 343 it('Should succeed with the correct parameters', async function () {
342 await deleteVideoChannel(server.url, server.accessToken, 'super_channel') 344 await command.delete({ channelName: 'super_channel' })
343 }) 345 })
344 346
345 it('Should fail to delete the last user video channel', async function () { 347 it('Should fail to delete the last user video channel', async function () {
346 await deleteVideoChannel(server.url, server.accessToken, 'root_channel', HttpStatusCode.CONFLICT_409) 348 await command.delete({ channelName: 'root_channel', expectedStatus: HttpStatusCode.CONFLICT_409 })
347 }) 349 })
348 }) 350 })
349 351