diff options
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 } }) |