diff options
author | Chocobozzz <me@florianbigard.com> | 2022-03-11 11:11:00 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-03-11 11:11:00 +0100 |
commit | 4495806f2f5045a0626ab64f43b5fc4deefe2ac0 (patch) | |
tree | e83b61b8da313fe1add571b9dd73261828c38cf9 /server/tests/api/check-params/live.ts | |
parent | 052bdb7c120b2ac7a1616a8072f9eedd2ab2f4b6 (diff) | |
parent | 58ae266bada2233945c4446220c22ccc4e7c62b5 (diff) | |
download | PeerTube-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/live.ts')
-rw-r--r-- | server/tests/api/check-params/live.ts | 32 |
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 @@ | |||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import { omit } from 'lodash' | 4 | import { omit } from 'lodash' |
5 | import { buildAbsoluteFixturePath } from '@shared/core-utils' | 5 | import { buildAbsoluteFixturePath } from '@shared/core-utils' |
6 | import { HttpStatusCode, VideoCreateResult, VideoPrivacy } from '@shared/models' | 6 | import { HttpStatusCode, LiveVideoLatencyMode, VideoCreateResult, VideoPrivacy } from '@shared/models' |
7 | import { | 7 | import { |
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 } }) |