aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/check-params/live.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-03-04 13:40:02 +0100
committerChocobozzz <chocobozzz@cpy.re>2022-03-09 09:23:10 +0100
commitf443a74649174b2f9347c158e30f8ac7aa3e958a (patch)
treee423bc4e2307477bda4341037b7fa04ad10adae6 /server/tests/api/check-params/live.ts
parent01dd04cd5ab7b55d2a9af7d0ebf405bee9579b09 (diff)
downloadPeerTube-f443a74649174b2f9347c158e30f8ac7aa3e958a.tar.gz
PeerTube-f443a74649174b2f9347c158e30f8ac7aa3e958a.tar.zst
PeerTube-f443a74649174b2f9347c158e30f8ac7aa3e958a.zip
Add latency setting support
Diffstat (limited to 'server/tests/api/check-params/live.ts')
-rw-r--r--server/tests/api/check-params/live.ts32
1 files changed, 30 insertions, 2 deletions
diff --git a/server/tests/api/check-params/live.ts b/server/tests/api/check-params/live.ts
index 8aee6164c..b253f5e20 100644
--- a/server/tests/api/check-params/live.ts
+++ b/server/tests/api/check-params/live.ts
@@ -3,7 +3,7 @@
3import 'mocha' 3import 'mocha'
4import { omit } from 'lodash' 4import { omit } from 'lodash'
5import { buildAbsoluteFixturePath } from '@shared/core-utils' 5import { buildAbsoluteFixturePath } from '@shared/core-utils'
6import { HttpStatusCode, VideoCreateResult, VideoPrivacy } from '@shared/models' 6import { HttpStatusCode, LiveVideoLatencyMode, VideoCreateResult, VideoPrivacy } from '@shared/models'
7import { 7import {
8 cleanupTests, 8 cleanupTests,
9 createSingleServer, 9 createSingleServer,
@@ -38,6 +38,9 @@ describe('Test video lives API validator', function () {
38 newConfig: { 38 newConfig: {
39 live: { 39 live: {
40 enabled: true, 40 enabled: true,
41 latencySetting: {
42 enabled: false
43 },
41 maxInstanceLives: 20, 44 maxInstanceLives: 20,
42 maxUserLives: 20, 45 maxUserLives: 20,
43 allowReplay: true 46 allowReplay: true
@@ -81,7 +84,8 @@ describe('Test video lives API validator', function () {
81 privacy: VideoPrivacy.PUBLIC, 84 privacy: VideoPrivacy.PUBLIC,
82 channelId, 85 channelId,
83 saveReplay: false, 86 saveReplay: false,
84 permanentLive: false 87 permanentLive: false,
88 latencyMode: LiveVideoLatencyMode.DEFAULT
85 } 89 }
86 }) 90 })
87 91
@@ -214,6 +218,18 @@ describe('Test video lives API validator', function () {
214 await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields }) 218 await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields })
215 }) 219 })
216 220
221 it('Should fail with bad latency setting', async function () {
222 const fields = { ...baseCorrectParams, latencyMode: 42 }
223
224 await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields })
225 })
226
227 it('Should fail to set latency if the server does not allow it', async function () {
228 const fields = { ...baseCorrectParams, latencyMode: LiveVideoLatencyMode.HIGH_LATENCY }
229
230 await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields, expectedStatus: HttpStatusCode.FORBIDDEN_403 })
231 })
232
217 it('Should succeed with the correct parameters', async function () { 233 it('Should succeed with the correct parameters', async function () {
218 this.timeout(30000) 234 this.timeout(30000)
219 235
@@ -393,6 +409,18 @@ describe('Test video lives API validator', function () {
393 await command.update({ videoId: video.id, fields, expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) 409 await command.update({ videoId: video.id, fields, expectedStatus: HttpStatusCode.BAD_REQUEST_400 })
394 }) 410 })
395 411
412 it('Should fail with bad latency setting', async function () {
413 const fields = { latencyMode: 42 }
414
415 await command.update({ videoId: video.id, fields, expectedStatus: HttpStatusCode.BAD_REQUEST_400 })
416 })
417
418 it('Should fail to set latency if the server does not allow it', async function () {
419 const fields = { latencyMode: LiveVideoLatencyMode.HIGH_LATENCY }
420
421 await command.update({ videoId: video.id, fields, expectedStatus: HttpStatusCode.FORBIDDEN_403 })
422 })
423
396 it('Should succeed with the correct params', async function () { 424 it('Should succeed with the correct params', async function () {
397 await command.update({ videoId: video.id, fields: { saveReplay: false } }) 425 await command.update({ videoId: video.id, fields: { saveReplay: false } })
398 await command.update({ videoId: video.uuid, fields: { saveReplay: false } }) 426 await command.update({ videoId: video.uuid, fields: { saveReplay: false } })