aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/check-params
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-04-22 09:50:20 +0200
committerChocobozzz <me@florianbigard.com>2022-04-22 09:50:20 +0200
commit961cbe4269e5f34639e29310fb3d90a6cb1bd6bc (patch)
tree06404c72c25a95238e7ef8a6bdfcb90d40c8649c /server/tests/api/check-params
parent4ec52d04dcc5d664612331f8e08d7d90da990415 (diff)
downloadPeerTube-961cbe4269e5f34639e29310fb3d90a6cb1bd6bc.tar.gz
PeerTube-961cbe4269e5f34639e29310fb3d90a6cb1bd6bc.tar.zst
PeerTube-961cbe4269e5f34639e29310fb3d90a6cb1bd6bc.zip
Fix getting live by anonymous user
Diffstat (limited to 'server/tests/api/check-params')
-rw-r--r--server/tests/api/check-params/live.ts28
1 files changed, 23 insertions, 5 deletions
diff --git a/server/tests/api/check-params/live.ts b/server/tests/api/check-params/live.ts
index 2f1c1257e..d4a81c4f6 100644
--- a/server/tests/api/check-params/live.ts
+++ b/server/tests/api/check-params/live.ts
@@ -1,6 +1,7 @@
1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ 1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
2 2
3import 'mocha' 3import 'mocha'
4import { expect } from 'chai'
4import { omit } from 'lodash' 5import { omit } from 'lodash'
5import { buildAbsoluteFixturePath } from '@shared/core-utils' 6import { buildAbsoluteFixturePath } from '@shared/core-utils'
6import { HttpStatusCode, LiveVideoLatencyMode, VideoCreateResult, VideoPrivacy } from '@shared/models' 7import { HttpStatusCode, LiveVideoLatencyMode, VideoCreateResult, VideoPrivacy } from '@shared/models'
@@ -340,16 +341,33 @@ describe('Test video lives API validator', function () {
340 341
341 describe('When getting live information', function () { 342 describe('When getting live information', function () {
342 343
343 it('Should fail without access token', async function () {
344 await command.get({ token: '', videoId: video.id, expectedStatus: HttpStatusCode.UNAUTHORIZED_401 })
345 })
346 344
347 it('Should fail with a bad access token', async function () { 345 it('Should fail with a bad access token', async function () {
348 await command.get({ token: 'toto', videoId: video.id, expectedStatus: HttpStatusCode.UNAUTHORIZED_401 }) 346 await command.get({ token: 'toto', videoId: video.id, expectedStatus: HttpStatusCode.UNAUTHORIZED_401 })
349 }) 347 })
350 348
351 it('Should fail with access token of another user', async function () { 349 it('Should not display private information without access token', async function () {
352 await command.get({ token: userAccessToken, videoId: video.id, expectedStatus: HttpStatusCode.FORBIDDEN_403 }) 350 const live = await command.get({ token: '', videoId: video.id })
351
352 expect(live.rtmpUrl).to.not.exist
353 expect(live.streamKey).to.not.exist
354 expect(live.latencyMode).to.exist
355 })
356
357 it('Should not display private information with token of another user', async function () {
358 const live = await command.get({ token: userAccessToken, videoId: video.id })
359
360 expect(live.rtmpUrl).to.not.exist
361 expect(live.streamKey).to.not.exist
362 expect(live.latencyMode).to.exist
363 })
364
365 it('Should display private information with appropriate token', async function () {
366 const live = await command.get({ videoId: video.id })
367
368 expect(live.rtmpUrl).to.exist
369 expect(live.streamKey).to.exist
370 expect(live.latencyMode).to.exist
353 }) 371 })
354 372
355 it('Should fail with a bad video id', async function () { 373 it('Should fail with a bad video id', async function () {