aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/check-params/video-channels.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api/check-params/video-channels.ts')
-rw-r--r--server/tests/api/check-params/video-channels.ts35
1 files changed, 18 insertions, 17 deletions
diff --git a/server/tests/api/check-params/video-channels.ts b/server/tests/api/check-params/video-channels.ts
index 2795ad7d5..0dd436426 100644
--- a/server/tests/api/check-params/video-channels.ts
+++ b/server/tests/api/check-params/video-channels.ts
@@ -25,6 +25,7 @@ import {
25} from '../../../../shared/extra-utils/requests/check-api-params' 25} from '../../../../shared/extra-utils/requests/check-api-params'
26import { join } from 'path' 26import { join } from 'path'
27import { VideoChannelUpdate } from '../../../../shared/models/videos' 27import { VideoChannelUpdate } from '../../../../shared/models/videos'
28import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
28 29
29const expect = chai.expect 30const expect = chai.expect
30 31
@@ -83,14 +84,14 @@ describe('Test video channels API validator', function () {
83 }) 84 })
84 85
85 it('Should fail with a unknown account', async function () { 86 it('Should fail with a unknown account', async function () {
86 await getAccountVideoChannelsList({ url: server.url, accountName: 'unknown', specialStatus: 404 }) 87 await getAccountVideoChannelsList({ url: server.url, accountName: 'unknown', specialStatus: HttpStatusCode.NOT_FOUND_404 })
87 }) 88 })
88 89
89 it('Should succeed with the correct parameters', async function () { 90 it('Should succeed with the correct parameters', async function () {
90 await makeGetRequest({ 91 await makeGetRequest({
91 url: server.url, 92 url: server.url,
92 path: accountChannelPath, 93 path: accountChannelPath,
93 statusCodeExpected: 200 94 statusCodeExpected: HttpStatusCode.OK_200
94 }) 95 })
95 }) 96 })
96 }) 97 })
@@ -109,7 +110,7 @@ describe('Test video channels API validator', function () {
109 path: videoChannelPath, 110 path: videoChannelPath,
110 token: 'none', 111 token: 'none',
111 fields: baseCorrectParams, 112 fields: baseCorrectParams,
112 statusCodeExpected: 401 113 statusCodeExpected: HttpStatusCode.UNAUTHORIZED_401
113 }) 114 })
114 }) 115 })
115 116
@@ -154,7 +155,7 @@ describe('Test video channels API validator', function () {
154 path: videoChannelPath, 155 path: videoChannelPath,
155 token: server.accessToken, 156 token: server.accessToken,
156 fields: baseCorrectParams, 157 fields: baseCorrectParams,
157 statusCodeExpected: 200 158 statusCodeExpected: HttpStatusCode.OK_200
158 }) 159 })
159 }) 160 })
160 161
@@ -164,7 +165,7 @@ describe('Test video channels API validator', function () {
164 path: videoChannelPath, 165 path: videoChannelPath,
165 token: server.accessToken, 166 token: server.accessToken,
166 fields: baseCorrectParams, 167 fields: baseCorrectParams,
167 statusCodeExpected: 409 168 statusCodeExpected: HttpStatusCode.CONFLICT_409
168 }) 169 })
169 }) 170 })
170 }) 171 })
@@ -188,7 +189,7 @@ describe('Test video channels API validator', function () {
188 path, 189 path,
189 token: 'hi', 190 token: 'hi',
190 fields: baseCorrectParams, 191 fields: baseCorrectParams,
191 statusCodeExpected: 401 192 statusCodeExpected: HttpStatusCode.UNAUTHORIZED_401
192 }) 193 })
193 }) 194 })
194 195
@@ -198,7 +199,7 @@ describe('Test video channels API validator', function () {
198 path, 199 path,
199 token: accessTokenUser, 200 token: accessTokenUser,
200 fields: baseCorrectParams, 201 fields: baseCorrectParams,
201 statusCodeExpected: 403 202 statusCodeExpected: HttpStatusCode.FORBIDDEN_403
202 }) 203 })
203 }) 204 })
204 205
@@ -228,7 +229,7 @@ describe('Test video channels API validator', function () {
228 path, 229 path,
229 token: server.accessToken, 230 token: server.accessToken,
230 fields: baseCorrectParams, 231 fields: baseCorrectParams,
231 statusCodeExpected: 204 232 statusCodeExpected: HttpStatusCode.NO_CONTENT_204
232 }) 233 })
233 }) 234 })
234 }) 235 })
@@ -266,7 +267,7 @@ describe('Test video channels API validator', function () {
266 path: path + '/avatar/pick', 267 path: path + '/avatar/pick',
267 fields, 268 fields,
268 attaches, 269 attaches,
269 statusCodeExpected: 401 270 statusCodeExpected: HttpStatusCode.UNAUTHORIZED_401
270 }) 271 })
271 }) 272 })
272 273
@@ -281,7 +282,7 @@ describe('Test video channels API validator', function () {
281 token: server.accessToken, 282 token: server.accessToken,
282 fields, 283 fields,
283 attaches, 284 attaches,
284 statusCodeExpected: 200 285 statusCodeExpected: HttpStatusCode.OK_200
285 }) 286 })
286 }) 287 })
287 }) 288 })
@@ -291,7 +292,7 @@ describe('Test video channels API validator', function () {
291 const res = await makeGetRequest({ 292 const res = await makeGetRequest({
292 url: server.url, 293 url: server.url,
293 path: videoChannelPath, 294 path: videoChannelPath,
294 statusCodeExpected: 200 295 statusCodeExpected: HttpStatusCode.OK_200
295 }) 296 })
296 297
297 expect(res.body.data).to.be.an('array') 298 expect(res.body.data).to.be.an('array')
@@ -301,7 +302,7 @@ describe('Test video channels API validator', function () {
301 await makeGetRequest({ 302 await makeGetRequest({
302 url: server.url, 303 url: server.url,
303 path: videoChannelPath + '/super_channel2', 304 path: videoChannelPath + '/super_channel2',
304 statusCodeExpected: 404 305 statusCodeExpected: HttpStatusCode.NOT_FOUND_404
305 }) 306 })
306 }) 307 })
307 308
@@ -309,22 +310,22 @@ describe('Test video channels API validator', function () {
309 await makeGetRequest({ 310 await makeGetRequest({
310 url: server.url, 311 url: server.url,
311 path: videoChannelPath + '/super_channel', 312 path: videoChannelPath + '/super_channel',
312 statusCodeExpected: 200 313 statusCodeExpected: HttpStatusCode.OK_200
313 }) 314 })
314 }) 315 })
315 }) 316 })
316 317
317 describe('When deleting a video channel', function () { 318 describe('When deleting a video channel', function () {
318 it('Should fail with a non authenticated user', async function () { 319 it('Should fail with a non authenticated user', async function () {
319 await deleteVideoChannel(server.url, 'coucou', 'super_channel', 401) 320 await deleteVideoChannel(server.url, 'coucou', 'super_channel', HttpStatusCode.UNAUTHORIZED_401)
320 }) 321 })
321 322
322 it('Should fail with another authenticated user', async function () { 323 it('Should fail with another authenticated user', async function () {
323 await deleteVideoChannel(server.url, accessTokenUser, 'super_channel', 403) 324 await deleteVideoChannel(server.url, accessTokenUser, 'super_channel', HttpStatusCode.FORBIDDEN_403)
324 }) 325 })
325 326
326 it('Should fail with an unknown video channel id', async function () { 327 it('Should fail with an unknown video channel id', async function () {
327 await deleteVideoChannel(server.url, server.accessToken, 'super_channel2', 404) 328 await deleteVideoChannel(server.url, server.accessToken, 'super_channel2', HttpStatusCode.NOT_FOUND_404)
328 }) 329 })
329 330
330 it('Should succeed with the correct parameters', async function () { 331 it('Should succeed with the correct parameters', async function () {
@@ -332,7 +333,7 @@ describe('Test video channels API validator', function () {
332 }) 333 })
333 334
334 it('Should fail to delete the last user video channel', async function () { 335 it('Should fail to delete the last user video channel', async function () {
335 await deleteVideoChannel(server.url, server.accessToken, 'root_channel', 409) 336 await deleteVideoChannel(server.url, server.accessToken, 'root_channel', HttpStatusCode.CONFLICT_409)
336 }) 337 })
337 }) 338 })
338 339