diff options
author | Chocobozzz <me@florianbigard.com> | 2021-07-08 10:25:50 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-07-20 15:27:17 +0200 |
commit | 04aed76711909507e74905bde3a7fa024d3585c9 (patch) | |
tree | da93912bb9331feda40f597da3fea7dc24970d66 /server/tests/api/check-params/live.ts | |
parent | d897210c2db1ca2acc1e7b28a13127647ab2222c (diff) | |
download | PeerTube-04aed76711909507e74905bde3a7fa024d3585c9.tar.gz PeerTube-04aed76711909507e74905bde3a7fa024d3585c9.tar.zst PeerTube-04aed76711909507e74905bde3a7fa024d3585c9.zip |
Shorter live methods
Diffstat (limited to 'server/tests/api/check-params/live.ts')
-rw-r--r-- | server/tests/api/check-params/live.ts | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/server/tests/api/check-params/live.ts b/server/tests/api/check-params/live.ts index 56116848f..d851d258d 100644 --- a/server/tests/api/check-params/live.ts +++ b/server/tests/api/check-params/live.ts | |||
@@ -337,72 +337,72 @@ describe('Test video lives API validator', function () { | |||
337 | describe('When getting live information', function () { | 337 | describe('When getting live information', function () { |
338 | 338 | ||
339 | it('Should fail without access token', async function () { | 339 | it('Should fail without access token', async function () { |
340 | await command.getLive({ token: '', videoId: video.id, expectedStatus: HttpStatusCode.UNAUTHORIZED_401 }) | 340 | await command.get({ token: '', videoId: video.id, expectedStatus: HttpStatusCode.UNAUTHORIZED_401 }) |
341 | }) | 341 | }) |
342 | 342 | ||
343 | it('Should fail with a bad access token', async function () { | 343 | it('Should fail with a bad access token', async function () { |
344 | await command.getLive({ token: 'toto', videoId: video.id, expectedStatus: HttpStatusCode.UNAUTHORIZED_401 }) | 344 | await command.get({ token: 'toto', videoId: video.id, expectedStatus: HttpStatusCode.UNAUTHORIZED_401 }) |
345 | }) | 345 | }) |
346 | 346 | ||
347 | it('Should fail with access token of another user', async function () { | 347 | it('Should fail with access token of another user', async function () { |
348 | await command.getLive({ token: userAccessToken, videoId: video.id, expectedStatus: HttpStatusCode.FORBIDDEN_403 }) | 348 | await command.get({ token: userAccessToken, videoId: video.id, expectedStatus: HttpStatusCode.FORBIDDEN_403 }) |
349 | }) | 349 | }) |
350 | 350 | ||
351 | it('Should fail with a bad video id', async function () { | 351 | it('Should fail with a bad video id', async function () { |
352 | await command.getLive({ videoId: 'toto', expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) | 352 | await command.get({ videoId: 'toto', expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) |
353 | }) | 353 | }) |
354 | 354 | ||
355 | it('Should fail with an unknown video id', async function () { | 355 | it('Should fail with an unknown video id', async function () { |
356 | await command.getLive({ videoId: 454555, expectedStatus: HttpStatusCode.NOT_FOUND_404 }) | 356 | await command.get({ videoId: 454555, expectedStatus: HttpStatusCode.NOT_FOUND_404 }) |
357 | }) | 357 | }) |
358 | 358 | ||
359 | it('Should fail with a non live video', async function () { | 359 | it('Should fail with a non live video', async function () { |
360 | await command.getLive({ videoId: videoIdNotLive, expectedStatus: HttpStatusCode.NOT_FOUND_404 }) | 360 | await command.get({ videoId: videoIdNotLive, expectedStatus: HttpStatusCode.NOT_FOUND_404 }) |
361 | }) | 361 | }) |
362 | 362 | ||
363 | it('Should succeed with the correct params', async function () { | 363 | it('Should succeed with the correct params', async function () { |
364 | await command.getLive({ videoId: video.id }) | 364 | await command.get({ videoId: video.id }) |
365 | await command.getLive({ videoId: video.uuid }) | 365 | await command.get({ videoId: video.uuid }) |
366 | await command.getLive({ videoId: video.shortUUID }) | 366 | await command.get({ videoId: video.shortUUID }) |
367 | }) | 367 | }) |
368 | }) | 368 | }) |
369 | 369 | ||
370 | describe('When updating live information', async function () { | 370 | describe('When updating live information', async function () { |
371 | 371 | ||
372 | it('Should fail without access token', async function () { | 372 | it('Should fail without access token', async function () { |
373 | await command.updateLive({ token: '', videoId: video.id, fields: {}, expectedStatus: HttpStatusCode.UNAUTHORIZED_401 }) | 373 | await command.update({ token: '', videoId: video.id, fields: {}, expectedStatus: HttpStatusCode.UNAUTHORIZED_401 }) |
374 | }) | 374 | }) |
375 | 375 | ||
376 | it('Should fail with a bad access token', async function () { | 376 | it('Should fail with a bad access token', async function () { |
377 | await command.updateLive({ token: 'toto', videoId: video.id, fields: {}, expectedStatus: HttpStatusCode.UNAUTHORIZED_401 }) | 377 | await command.update({ token: 'toto', videoId: video.id, fields: {}, expectedStatus: HttpStatusCode.UNAUTHORIZED_401 }) |
378 | }) | 378 | }) |
379 | 379 | ||
380 | it('Should fail with access token of another user', async function () { | 380 | it('Should fail with access token of another user', async function () { |
381 | await command.updateLive({ token: userAccessToken, videoId: video.id, fields: {}, expectedStatus: HttpStatusCode.FORBIDDEN_403 }) | 381 | await command.update({ token: userAccessToken, videoId: video.id, fields: {}, expectedStatus: HttpStatusCode.FORBIDDEN_403 }) |
382 | }) | 382 | }) |
383 | 383 | ||
384 | it('Should fail with a bad video id', async function () { | 384 | it('Should fail with a bad video id', async function () { |
385 | await command.updateLive({ videoId: 'toto', fields: {}, expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) | 385 | await command.update({ videoId: 'toto', fields: {}, expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) |
386 | }) | 386 | }) |
387 | 387 | ||
388 | it('Should fail with an unknown video id', async function () { | 388 | it('Should fail with an unknown video id', async function () { |
389 | await command.updateLive({ videoId: 454555, fields: {}, expectedStatus: HttpStatusCode.NOT_FOUND_404 }) | 389 | await command.update({ videoId: 454555, fields: {}, expectedStatus: HttpStatusCode.NOT_FOUND_404 }) |
390 | }) | 390 | }) |
391 | 391 | ||
392 | it('Should fail with a non live video', async function () { | 392 | it('Should fail with a non live video', async function () { |
393 | await command.updateLive({ videoId: videoIdNotLive, fields: {}, expectedStatus: HttpStatusCode.NOT_FOUND_404 }) | 393 | await command.update({ videoId: videoIdNotLive, fields: {}, expectedStatus: HttpStatusCode.NOT_FOUND_404 }) |
394 | }) | 394 | }) |
395 | 395 | ||
396 | it('Should fail with save replay and permanent live set to true', async function () { | 396 | it('Should fail with save replay and permanent live set to true', async function () { |
397 | const fields = { saveReplay: true, permanentLive: true } | 397 | const fields = { saveReplay: true, permanentLive: true } |
398 | 398 | ||
399 | await command.updateLive({ videoId: video.id, fields, expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) | 399 | await command.update({ videoId: video.id, fields, expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) |
400 | }) | 400 | }) |
401 | 401 | ||
402 | it('Should succeed with the correct params', async function () { | 402 | it('Should succeed with the correct params', async function () { |
403 | await command.updateLive({ videoId: video.id, fields: { saveReplay: false } }) | 403 | await command.update({ videoId: video.id, fields: { saveReplay: false } }) |
404 | await command.updateLive({ videoId: video.uuid, fields: { saveReplay: false } }) | 404 | await command.update({ videoId: video.uuid, fields: { saveReplay: false } }) |
405 | await command.updateLive({ videoId: video.shortUUID, fields: { saveReplay: false } }) | 405 | await command.update({ videoId: video.shortUUID, fields: { saveReplay: false } }) |
406 | }) | 406 | }) |
407 | 407 | ||
408 | it('Should fail to update replay status if replay is not allowed on the instance', async function () { | 408 | it('Should fail to update replay status if replay is not allowed on the instance', async function () { |
@@ -415,18 +415,18 @@ describe('Test video lives API validator', function () { | |||
415 | } | 415 | } |
416 | }) | 416 | }) |
417 | 417 | ||
418 | await command.updateLive({ videoId: video.id, fields: { saveReplay: true }, expectedStatus: HttpStatusCode.FORBIDDEN_403 }) | 418 | await command.update({ videoId: video.id, fields: { saveReplay: true }, expectedStatus: HttpStatusCode.FORBIDDEN_403 }) |
419 | }) | 419 | }) |
420 | 420 | ||
421 | it('Should fail to update a live if it has already started', async function () { | 421 | it('Should fail to update a live if it has already started', async function () { |
422 | this.timeout(40000) | 422 | this.timeout(40000) |
423 | 423 | ||
424 | const live = await command.getLive({ videoId: video.id }) | 424 | const live = await command.get({ videoId: video.id }) |
425 | 425 | ||
426 | const ffmpegCommand = sendRTMPStream(live.rtmpUrl, live.streamKey) | 426 | const ffmpegCommand = sendRTMPStream(live.rtmpUrl, live.streamKey) |
427 | 427 | ||
428 | await command.waitUntilLivePublished({ videoId: video.id }) | 428 | await command.waitUntilPublished({ videoId: video.id }) |
429 | await command.updateLive({ videoId: video.id, fields: {}, expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) | 429 | await command.update({ videoId: video.id, fields: {}, expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) |
430 | 430 | ||
431 | await stopFfmpeg(ffmpegCommand) | 431 | await stopFfmpeg(ffmpegCommand) |
432 | }) | 432 | }) |
@@ -434,13 +434,13 @@ describe('Test video lives API validator', function () { | |||
434 | it('Should fail to stream twice in the save live', async function () { | 434 | it('Should fail to stream twice in the save live', async function () { |
435 | this.timeout(40000) | 435 | this.timeout(40000) |
436 | 436 | ||
437 | const live = await command.getLive({ videoId: video.id }) | 437 | const live = await command.get({ videoId: video.id }) |
438 | 438 | ||
439 | const ffmpegCommand = sendRTMPStream(live.rtmpUrl, live.streamKey) | 439 | const ffmpegCommand = sendRTMPStream(live.rtmpUrl, live.streamKey) |
440 | 440 | ||
441 | await command.waitUntilLivePublished({ videoId: video.id }) | 441 | await command.waitUntilPublished({ videoId: video.id }) |
442 | 442 | ||
443 | await command.runAndTestFfmpegStreamError({ videoId: video.id, shouldHaveError: true }) | 443 | await command.runAndTestStreamError({ videoId: video.id, shouldHaveError: true }) |
444 | 444 | ||
445 | await stopFfmpeg(ffmpegCommand) | 445 | await stopFfmpeg(ffmpegCommand) |
446 | }) | 446 | }) |