diff options
author | Chocobozzz <me@florianbigard.com> | 2022-03-04 13:40:02 +0100 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2022-03-09 09:23:10 +0100 |
commit | f443a74649174b2f9347c158e30f8ac7aa3e958a (patch) | |
tree | e423bc4e2307477bda4341037b7fa04ad10adae6 /server/tests/api/check-params | |
parent | 01dd04cd5ab7b55d2a9af7d0ebf405bee9579b09 (diff) | |
download | PeerTube-f443a74649174b2f9347c158e30f8ac7aa3e958a.tar.gz PeerTube-f443a74649174b2f9347c158e30f8ac7aa3e958a.tar.zst PeerTube-f443a74649174b2f9347c158e30f8ac7aa3e958a.zip |
Add latency setting support
Diffstat (limited to 'server/tests/api/check-params')
-rw-r--r-- | server/tests/api/check-params/config.ts | 3 | ||||
-rw-r--r-- | server/tests/api/check-params/live.ts | 32 |
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 @@ | |||
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 } }) |