aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/check-params
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-03-11 11:11:00 +0100
committerChocobozzz <me@florianbigard.com>2022-03-11 11:11:00 +0100
commit4495806f2f5045a0626ab64f43b5fc4deefe2ac0 (patch)
treee83b61b8da313fe1add571b9dd73261828c38cf9 /server/tests/api/check-params
parent052bdb7c120b2ac7a1616a8072f9eedd2ab2f4b6 (diff)
parent58ae266bada2233945c4446220c22ccc4e7c62b5 (diff)
downloadPeerTube-4495806f2f5045a0626ab64f43b5fc4deefe2ac0.tar.gz
PeerTube-4495806f2f5045a0626ab64f43b5fc4deefe2ac0.tar.zst
PeerTube-4495806f2f5045a0626ab64f43b5fc4deefe2ac0.zip
Merge remote-tracking branch 'weblate/develop' into develop
Diffstat (limited to 'server/tests/api/check-params')
-rw-r--r--server/tests/api/check-params/config.ts3
-rw-r--r--server/tests/api/check-params/live.ts32
2 files changed, 33 insertions, 2 deletions
diff --git a/server/tests/api/check-params/config.ts b/server/tests/api/check-params/config.ts
index ce067a892..900f642c2 100644
--- a/server/tests/api/check-params/config.ts
+++ b/server/tests/api/check-params/config.ts
@@ -125,6 +125,9 @@ describe('Test config API validators', function () {
125 enabled: true, 125 enabled: true,
126 126
127 allowReplay: false, 127 allowReplay: false,
128 latencySetting: {
129 enabled: false
130 },
128 maxDuration: 30, 131 maxDuration: 30,
129 maxInstanceLives: -1, 132 maxInstanceLives: -1,
130 maxUserLives: 50, 133 maxUserLives: 50,
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 } })