diff options
author | Chocobozzz <me@florianbigard.com> | 2021-07-08 10:25:50 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-07-20 15:27:17 +0200 |
commit | 04aed76711909507e74905bde3a7fa024d3585c9 (patch) | |
tree | da93912bb9331feda40f597da3fea7dc24970d66 /server | |
parent | d897210c2db1ca2acc1e7b28a13127647ab2222c (diff) | |
download | PeerTube-04aed76711909507e74905bde3a7fa024d3585c9.tar.gz PeerTube-04aed76711909507e74905bde3a7fa024d3585c9.tar.zst PeerTube-04aed76711909507e74905bde3a7fa024d3585c9.zip |
Shorter live methods
Diffstat (limited to 'server')
-rw-r--r-- | server/tests/api/check-params/live.ts | 52 | ||||
-rw-r--r-- | server/tests/api/live/live-constraints.ts | 14 | ||||
-rw-r--r-- | server/tests/api/live/live-permanent.ts | 18 | ||||
-rw-r--r-- | server/tests/api/live/live-save-replay.ts | 8 | ||||
-rw-r--r-- | server/tests/api/live/live-socket-messages.ts | 4 | ||||
-rw-r--r-- | server/tests/api/live/live-views.ts | 2 | ||||
-rw-r--r-- | server/tests/api/live/live.ts | 42 | ||||
-rw-r--r-- | server/tests/api/search/search-videos.ts | 4 | ||||
-rw-r--r-- | server/tests/api/videos/video-change-ownership.ts | 2 | ||||
-rw-r--r-- | server/tests/plugins/action-hooks.ts | 2 | ||||
-rw-r--r-- | server/tests/plugins/filter-hooks.ts | 2 | ||||
-rw-r--r-- | server/tests/plugins/plugin-transcoding.ts | 10 |
12 files changed, 80 insertions, 80 deletions
diff --git a/server/tests/api/check-params/live.ts b/server/tests/api/check-params/live.ts index 56116848f..d851d258d 100644 --- a/server/tests/api/check-params/live.ts +++ b/server/tests/api/check-params/live.ts | |||
@@ -337,72 +337,72 @@ describe('Test video lives API validator', function () { | |||
337 | describe('When getting live information', function () { | 337 | describe('When getting live information', function () { |
338 | 338 | ||
339 | it('Should fail without access token', async function () { | 339 | it('Should fail without access token', async function () { |
340 | await command.getLive({ token: '', videoId: video.id, expectedStatus: HttpStatusCode.UNAUTHORIZED_401 }) | 340 | await command.get({ token: '', videoId: video.id, expectedStatus: HttpStatusCode.UNAUTHORIZED_401 }) |
341 | }) | 341 | }) |
342 | 342 | ||
343 | it('Should fail with a bad access token', async function () { | 343 | it('Should fail with a bad access token', async function () { |
344 | await command.getLive({ token: 'toto', videoId: video.id, expectedStatus: HttpStatusCode.UNAUTHORIZED_401 }) | 344 | await command.get({ token: 'toto', videoId: video.id, expectedStatus: HttpStatusCode.UNAUTHORIZED_401 }) |
345 | }) | 345 | }) |
346 | 346 | ||
347 | it('Should fail with access token of another user', async function () { | 347 | it('Should fail with access token of another user', async function () { |
348 | await command.getLive({ token: userAccessToken, videoId: video.id, expectedStatus: HttpStatusCode.FORBIDDEN_403 }) | 348 | await command.get({ token: userAccessToken, videoId: video.id, expectedStatus: HttpStatusCode.FORBIDDEN_403 }) |
349 | }) | 349 | }) |
350 | 350 | ||
351 | it('Should fail with a bad video id', async function () { | 351 | it('Should fail with a bad video id', async function () { |
352 | await command.getLive({ videoId: 'toto', expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) | 352 | await command.get({ videoId: 'toto', expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) |
353 | }) | 353 | }) |
354 | 354 | ||
355 | it('Should fail with an unknown video id', async function () { | 355 | it('Should fail with an unknown video id', async function () { |
356 | await command.getLive({ videoId: 454555, expectedStatus: HttpStatusCode.NOT_FOUND_404 }) | 356 | await command.get({ videoId: 454555, expectedStatus: HttpStatusCode.NOT_FOUND_404 }) |
357 | }) | 357 | }) |
358 | 358 | ||
359 | it('Should fail with a non live video', async function () { | 359 | it('Should fail with a non live video', async function () { |
360 | await command.getLive({ videoId: videoIdNotLive, expectedStatus: HttpStatusCode.NOT_FOUND_404 }) | 360 | await command.get({ videoId: videoIdNotLive, expectedStatus: HttpStatusCode.NOT_FOUND_404 }) |
361 | }) | 361 | }) |
362 | 362 | ||
363 | it('Should succeed with the correct params', async function () { | 363 | it('Should succeed with the correct params', async function () { |
364 | await command.getLive({ videoId: video.id }) | 364 | await command.get({ videoId: video.id }) |
365 | await command.getLive({ videoId: video.uuid }) | 365 | await command.get({ videoId: video.uuid }) |
366 | await command.getLive({ videoId: video.shortUUID }) | 366 | await command.get({ videoId: video.shortUUID }) |
367 | }) | 367 | }) |
368 | }) | 368 | }) |
369 | 369 | ||
370 | describe('When updating live information', async function () { | 370 | describe('When updating live information', async function () { |
371 | 371 | ||
372 | it('Should fail without access token', async function () { | 372 | it('Should fail without access token', async function () { |
373 | await command.updateLive({ token: '', videoId: video.id, fields: {}, expectedStatus: HttpStatusCode.UNAUTHORIZED_401 }) | 373 | await command.update({ token: '', videoId: video.id, fields: {}, expectedStatus: HttpStatusCode.UNAUTHORIZED_401 }) |
374 | }) | 374 | }) |
375 | 375 | ||
376 | it('Should fail with a bad access token', async function () { | 376 | it('Should fail with a bad access token', async function () { |
377 | await command.updateLive({ token: 'toto', videoId: video.id, fields: {}, expectedStatus: HttpStatusCode.UNAUTHORIZED_401 }) | 377 | await command.update({ token: 'toto', videoId: video.id, fields: {}, expectedStatus: HttpStatusCode.UNAUTHORIZED_401 }) |
378 | }) | 378 | }) |
379 | 379 | ||
380 | it('Should fail with access token of another user', async function () { | 380 | it('Should fail with access token of another user', async function () { |
381 | await command.updateLive({ token: userAccessToken, videoId: video.id, fields: {}, expectedStatus: HttpStatusCode.FORBIDDEN_403 }) | 381 | await command.update({ token: userAccessToken, videoId: video.id, fields: {}, expectedStatus: HttpStatusCode.FORBIDDEN_403 }) |
382 | }) | 382 | }) |
383 | 383 | ||
384 | it('Should fail with a bad video id', async function () { | 384 | it('Should fail with a bad video id', async function () { |
385 | await command.updateLive({ videoId: 'toto', fields: {}, expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) | 385 | await command.update({ videoId: 'toto', fields: {}, expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) |
386 | }) | 386 | }) |
387 | 387 | ||
388 | it('Should fail with an unknown video id', async function () { | 388 | it('Should fail with an unknown video id', async function () { |
389 | await command.updateLive({ videoId: 454555, fields: {}, expectedStatus: HttpStatusCode.NOT_FOUND_404 }) | 389 | await command.update({ videoId: 454555, fields: {}, expectedStatus: HttpStatusCode.NOT_FOUND_404 }) |
390 | }) | 390 | }) |
391 | 391 | ||
392 | it('Should fail with a non live video', async function () { | 392 | it('Should fail with a non live video', async function () { |
393 | await command.updateLive({ videoId: videoIdNotLive, fields: {}, expectedStatus: HttpStatusCode.NOT_FOUND_404 }) | 393 | await command.update({ videoId: videoIdNotLive, fields: {}, expectedStatus: HttpStatusCode.NOT_FOUND_404 }) |
394 | }) | 394 | }) |
395 | 395 | ||
396 | it('Should fail with save replay and permanent live set to true', async function () { | 396 | it('Should fail with save replay and permanent live set to true', async function () { |
397 | const fields = { saveReplay: true, permanentLive: true } | 397 | const fields = { saveReplay: true, permanentLive: true } |
398 | 398 | ||
399 | await command.updateLive({ videoId: video.id, fields, expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) | 399 | await command.update({ videoId: video.id, fields, expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) |
400 | }) | 400 | }) |
401 | 401 | ||
402 | it('Should succeed with the correct params', async function () { | 402 | it('Should succeed with the correct params', async function () { |
403 | await command.updateLive({ videoId: video.id, fields: { saveReplay: false } }) | 403 | await command.update({ videoId: video.id, fields: { saveReplay: false } }) |
404 | await command.updateLive({ videoId: video.uuid, fields: { saveReplay: false } }) | 404 | await command.update({ videoId: video.uuid, fields: { saveReplay: false } }) |
405 | await command.updateLive({ videoId: video.shortUUID, fields: { saveReplay: false } }) | 405 | await command.update({ videoId: video.shortUUID, fields: { saveReplay: false } }) |
406 | }) | 406 | }) |
407 | 407 | ||
408 | it('Should fail to update replay status if replay is not allowed on the instance', async function () { | 408 | it('Should fail to update replay status if replay is not allowed on the instance', async function () { |
@@ -415,18 +415,18 @@ describe('Test video lives API validator', function () { | |||
415 | } | 415 | } |
416 | }) | 416 | }) |
417 | 417 | ||
418 | await command.updateLive({ videoId: video.id, fields: { saveReplay: true }, expectedStatus: HttpStatusCode.FORBIDDEN_403 }) | 418 | await command.update({ videoId: video.id, fields: { saveReplay: true }, expectedStatus: HttpStatusCode.FORBIDDEN_403 }) |
419 | }) | 419 | }) |
420 | 420 | ||
421 | it('Should fail to update a live if it has already started', async function () { | 421 | it('Should fail to update a live if it has already started', async function () { |
422 | this.timeout(40000) | 422 | this.timeout(40000) |
423 | 423 | ||
424 | const live = await command.getLive({ videoId: video.id }) | 424 | const live = await command.get({ videoId: video.id }) |
425 | 425 | ||
426 | const ffmpegCommand = sendRTMPStream(live.rtmpUrl, live.streamKey) | 426 | const ffmpegCommand = sendRTMPStream(live.rtmpUrl, live.streamKey) |
427 | 427 | ||
428 | await command.waitUntilLivePublished({ videoId: video.id }) | 428 | await command.waitUntilPublished({ videoId: video.id }) |
429 | await command.updateLive({ videoId: video.id, fields: {}, expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) | 429 | await command.update({ videoId: video.id, fields: {}, expectedStatus: HttpStatusCode.BAD_REQUEST_400 }) |
430 | 430 | ||
431 | await stopFfmpeg(ffmpegCommand) | 431 | await stopFfmpeg(ffmpegCommand) |
432 | }) | 432 | }) |
@@ -434,13 +434,13 @@ describe('Test video lives API validator', function () { | |||
434 | it('Should fail to stream twice in the save live', async function () { | 434 | it('Should fail to stream twice in the save live', async function () { |
435 | this.timeout(40000) | 435 | this.timeout(40000) |
436 | 436 | ||
437 | const live = await command.getLive({ videoId: video.id }) | 437 | const live = await command.get({ videoId: video.id }) |
438 | 438 | ||
439 | const ffmpegCommand = sendRTMPStream(live.rtmpUrl, live.streamKey) | 439 | const ffmpegCommand = sendRTMPStream(live.rtmpUrl, live.streamKey) |
440 | 440 | ||
441 | await command.waitUntilLivePublished({ videoId: video.id }) | 441 | await command.waitUntilPublished({ videoId: video.id }) |
442 | 442 | ||
443 | await command.runAndTestFfmpegStreamError({ videoId: video.id, shouldHaveError: true }) | 443 | await command.runAndTestStreamError({ videoId: video.id, shouldHaveError: true }) |
444 | 444 | ||
445 | await stopFfmpeg(ffmpegCommand) | 445 | await stopFfmpeg(ffmpegCommand) |
446 | }) | 446 | }) |
diff --git a/server/tests/api/live/live-constraints.ts b/server/tests/api/live/live-constraints.ts index 5c4817b40..46153f7b1 100644 --- a/server/tests/api/live/live-constraints.ts +++ b/server/tests/api/live/live-constraints.ts | |||
@@ -35,7 +35,7 @@ describe('Test live constraints', function () { | |||
35 | saveReplay | 35 | saveReplay |
36 | } | 36 | } |
37 | 37 | ||
38 | const { uuid } = await servers[0].liveCommand.createLive({ token: userAccessToken, fields: liveAttributes }) | 38 | const { uuid } = await servers[0].liveCommand.create({ token: userAccessToken, fields: liveAttributes }) |
39 | return uuid | 39 | return uuid |
40 | } | 40 | } |
41 | 41 | ||
@@ -53,7 +53,7 @@ describe('Test live constraints', function () { | |||
53 | 53 | ||
54 | async function waitUntilLivePublishedOnAllServers (videoId: string) { | 54 | async function waitUntilLivePublishedOnAllServers (videoId: string) { |
55 | for (const server of servers) { | 55 | for (const server of servers) { |
56 | await server.liveCommand.waitUntilLivePublished({ videoId }) | 56 | await server.liveCommand.waitUntilPublished({ videoId }) |
57 | } | 57 | } |
58 | } | 58 | } |
59 | 59 | ||
@@ -105,7 +105,7 @@ describe('Test live constraints', function () { | |||
105 | this.timeout(60000) | 105 | this.timeout(60000) |
106 | 106 | ||
107 | const userVideoLiveoId = await createLiveWrapper(false) | 107 | const userVideoLiveoId = await createLiveWrapper(false) |
108 | await servers[0].liveCommand.runAndTestFfmpegStreamError({ token: userAccessToken, videoId: userVideoLiveoId, shouldHaveError: false }) | 108 | await servers[0].liveCommand.runAndTestStreamError({ token: userAccessToken, videoId: userVideoLiveoId, shouldHaveError: false }) |
109 | }) | 109 | }) |
110 | 110 | ||
111 | it('Should have size limit depending on user global quota if save replay is enabled', async function () { | 111 | it('Should have size limit depending on user global quota if save replay is enabled', async function () { |
@@ -115,7 +115,7 @@ describe('Test live constraints', function () { | |||
115 | await wait(5000) | 115 | await wait(5000) |
116 | 116 | ||
117 | const userVideoLiveoId = await createLiveWrapper(true) | 117 | const userVideoLiveoId = await createLiveWrapper(true) |
118 | await servers[0].liveCommand.runAndTestFfmpegStreamError({ token: userAccessToken, videoId: userVideoLiveoId, shouldHaveError: true }) | 118 | await servers[0].liveCommand.runAndTestStreamError({ token: userAccessToken, videoId: userVideoLiveoId, shouldHaveError: true }) |
119 | 119 | ||
120 | await waitUntilLivePublishedOnAllServers(userVideoLiveoId) | 120 | await waitUntilLivePublishedOnAllServers(userVideoLiveoId) |
121 | await waitJobs(servers) | 121 | await waitJobs(servers) |
@@ -132,7 +132,7 @@ describe('Test live constraints', function () { | |||
132 | await updateQuota({ total: -1, daily: 1 }) | 132 | await updateQuota({ total: -1, daily: 1 }) |
133 | 133 | ||
134 | const userVideoLiveoId = await createLiveWrapper(true) | 134 | const userVideoLiveoId = await createLiveWrapper(true) |
135 | await servers[0].liveCommand.runAndTestFfmpegStreamError({ token: userAccessToken, videoId: userVideoLiveoId, shouldHaveError: true }) | 135 | await servers[0].liveCommand.runAndTestStreamError({ token: userAccessToken, videoId: userVideoLiveoId, shouldHaveError: true }) |
136 | 136 | ||
137 | await waitUntilLivePublishedOnAllServers(userVideoLiveoId) | 137 | await waitUntilLivePublishedOnAllServers(userVideoLiveoId) |
138 | await waitJobs(servers) | 138 | await waitJobs(servers) |
@@ -149,7 +149,7 @@ describe('Test live constraints', function () { | |||
149 | await updateQuota({ total: 10 * 1000 * 1000, daily: -1 }) | 149 | await updateQuota({ total: 10 * 1000 * 1000, daily: -1 }) |
150 | 150 | ||
151 | const userVideoLiveoId = await createLiveWrapper(true) | 151 | const userVideoLiveoId = await createLiveWrapper(true) |
152 | await servers[0].liveCommand.runAndTestFfmpegStreamError({ token: userAccessToken, videoId: userVideoLiveoId, shouldHaveError: false }) | 152 | await servers[0].liveCommand.runAndTestStreamError({ token: userAccessToken, videoId: userVideoLiveoId, shouldHaveError: false }) |
153 | }) | 153 | }) |
154 | 154 | ||
155 | it('Should have max duration limit', async function () { | 155 | it('Should have max duration limit', async function () { |
@@ -170,7 +170,7 @@ describe('Test live constraints', function () { | |||
170 | }) | 170 | }) |
171 | 171 | ||
172 | const userVideoLiveoId = await createLiveWrapper(true) | 172 | const userVideoLiveoId = await createLiveWrapper(true) |
173 | await servers[0].liveCommand.runAndTestFfmpegStreamError({ token: userAccessToken, videoId: userVideoLiveoId, shouldHaveError: true }) | 173 | await servers[0].liveCommand.runAndTestStreamError({ token: userAccessToken, videoId: userVideoLiveoId, shouldHaveError: true }) |
174 | 174 | ||
175 | await waitUntilLivePublishedOnAllServers(userVideoLiveoId) | 175 | await waitUntilLivePublishedOnAllServers(userVideoLiveoId) |
176 | await waitJobs(servers) | 176 | await waitJobs(servers) |
diff --git a/server/tests/api/live/live-permanent.ts b/server/tests/api/live/live-permanent.ts index a0f70dfdb..6f4915a6b 100644 --- a/server/tests/api/live/live-permanent.ts +++ b/server/tests/api/live/live-permanent.ts | |||
@@ -32,7 +32,7 @@ describe('Permanent live', function () { | |||
32 | permanentLive | 32 | permanentLive |
33 | } | 33 | } |
34 | 34 | ||
35 | const { uuid } = await servers[0].liveCommand.createLive({ fields: attributes }) | 35 | const { uuid } = await servers[0].liveCommand.create({ fields: attributes }) |
36 | return uuid | 36 | return uuid |
37 | } | 37 | } |
38 | 38 | ||
@@ -76,14 +76,14 @@ describe('Permanent live', function () { | |||
76 | const videoUUID = await createLiveWrapper(false) | 76 | const videoUUID = await createLiveWrapper(false) |
77 | 77 | ||
78 | { | 78 | { |
79 | const live = await servers[0].liveCommand.getLive({ videoId: videoUUID }) | 79 | const live = await servers[0].liveCommand.get({ videoId: videoUUID }) |
80 | expect(live.permanentLive).to.be.false | 80 | expect(live.permanentLive).to.be.false |
81 | } | 81 | } |
82 | 82 | ||
83 | await servers[0].liveCommand.updateLive({ videoId: videoUUID, fields: { permanentLive: true } }) | 83 | await servers[0].liveCommand.update({ videoId: videoUUID, fields: { permanentLive: true } }) |
84 | 84 | ||
85 | { | 85 | { |
86 | const live = await servers[0].liveCommand.getLive({ videoId: videoUUID }) | 86 | const live = await servers[0].liveCommand.get({ videoId: videoUUID }) |
87 | expect(live.permanentLive).to.be.true | 87 | expect(live.permanentLive).to.be.true |
88 | } | 88 | } |
89 | }) | 89 | }) |
@@ -93,7 +93,7 @@ describe('Permanent live', function () { | |||
93 | 93 | ||
94 | videoUUID = await createLiveWrapper(true) | 94 | videoUUID = await createLiveWrapper(true) |
95 | 95 | ||
96 | const live = await servers[0].liveCommand.getLive({ videoId: videoUUID }) | 96 | const live = await servers[0].liveCommand.get({ videoId: videoUUID }) |
97 | expect(live.permanentLive).to.be.true | 97 | expect(live.permanentLive).to.be.true |
98 | 98 | ||
99 | await waitJobs(servers) | 99 | await waitJobs(servers) |
@@ -105,13 +105,13 @@ describe('Permanent live', function () { | |||
105 | const ffmpegCommand = await servers[0].liveCommand.sendRTMPStreamInVideo({ videoId: videoUUID }) | 105 | const ffmpegCommand = await servers[0].liveCommand.sendRTMPStreamInVideo({ videoId: videoUUID }) |
106 | 106 | ||
107 | for (const server of servers) { | 107 | for (const server of servers) { |
108 | await server.liveCommand.waitUntilLivePublished({ videoId: videoUUID }) | 108 | await server.liveCommand.waitUntilPublished({ videoId: videoUUID }) |
109 | } | 109 | } |
110 | 110 | ||
111 | await checkVideoState(videoUUID, VideoState.PUBLISHED) | 111 | await checkVideoState(videoUUID, VideoState.PUBLISHED) |
112 | 112 | ||
113 | await stopFfmpeg(ffmpegCommand) | 113 | await stopFfmpeg(ffmpegCommand) |
114 | await servers[0].liveCommand.waitUntilLiveWaiting({ videoId: videoUUID }) | 114 | await servers[0].liveCommand.waitUntilWaiting({ videoId: videoUUID }) |
115 | 115 | ||
116 | await waitJobs(servers) | 116 | await waitJobs(servers) |
117 | }) | 117 | }) |
@@ -156,12 +156,12 @@ describe('Permanent live', function () { | |||
156 | const ffmpegCommand = await servers[0].liveCommand.sendRTMPStreamInVideo({ videoId: videoUUID }) | 156 | const ffmpegCommand = await servers[0].liveCommand.sendRTMPStreamInVideo({ videoId: videoUUID }) |
157 | 157 | ||
158 | for (const server of servers) { | 158 | for (const server of servers) { |
159 | await server.liveCommand.waitUntilLivePublished({ videoId: videoUUID }) | 159 | await server.liveCommand.waitUntilPublished({ videoId: videoUUID }) |
160 | } | 160 | } |
161 | 161 | ||
162 | await checkVideoState(videoUUID, VideoState.PUBLISHED) | 162 | await checkVideoState(videoUUID, VideoState.PUBLISHED) |
163 | 163 | ||
164 | const count = await servers[0].liveCommand.getPlaylistsCount({ videoUUID }) | 164 | const count = await servers[0].liveCommand.countPlaylists({ videoUUID }) |
165 | // master playlist and 720p playlist | 165 | // master playlist and 720p playlist |
166 | expect(count).to.equal(2) | 166 | expect(count).to.equal(2) |
167 | 167 | ||
diff --git a/server/tests/api/live/live-save-replay.ts b/server/tests/api/live/live-save-replay.ts index d3c252ffd..9acd5601d 100644 --- a/server/tests/api/live/live-save-replay.ts +++ b/server/tests/api/live/live-save-replay.ts | |||
@@ -47,7 +47,7 @@ describe('Save replay setting', function () { | |||
47 | saveReplay | 47 | saveReplay |
48 | } | 48 | } |
49 | 49 | ||
50 | const { uuid } = await servers[0].liveCommand.createLive({ fields: attributes }) | 50 | const { uuid } = await servers[0].liveCommand.create({ fields: attributes }) |
51 | return uuid | 51 | return uuid |
52 | } | 52 | } |
53 | 53 | ||
@@ -74,13 +74,13 @@ describe('Save replay setting', function () { | |||
74 | 74 | ||
75 | async function waitUntilLivePublishedOnAllServers (videoId: string) { | 75 | async function waitUntilLivePublishedOnAllServers (videoId: string) { |
76 | for (const server of servers) { | 76 | for (const server of servers) { |
77 | await server.liveCommand.waitUntilLivePublished({ videoId }) | 77 | await server.liveCommand.waitUntilPublished({ videoId }) |
78 | } | 78 | } |
79 | } | 79 | } |
80 | 80 | ||
81 | async function waitUntilLiveSavedOnAllServers (videoId: string) { | 81 | async function waitUntilLiveSavedOnAllServers (videoId: string) { |
82 | for (const server of servers) { | 82 | for (const server of servers) { |
83 | await server.liveCommand.waitUntilLiveSaved({ videoId }) | 83 | await server.liveCommand.waitUntilSaved({ videoId }) |
84 | } | 84 | } |
85 | } | 85 | } |
86 | 86 | ||
@@ -147,7 +147,7 @@ describe('Save replay setting', function () { | |||
147 | await stopFfmpeg(ffmpegCommand) | 147 | await stopFfmpeg(ffmpegCommand) |
148 | 148 | ||
149 | for (const server of servers) { | 149 | for (const server of servers) { |
150 | await server.liveCommand.waitUntilLiveEnded({ videoId: liveVideoUUID }) | 150 | await server.liveCommand.waitUntilEnded({ videoId: liveVideoUUID }) |
151 | } | 151 | } |
152 | await waitJobs(servers) | 152 | await waitJobs(servers) |
153 | 153 | ||
diff --git a/server/tests/api/live/live-socket-messages.ts b/server/tests/api/live/live-socket-messages.ts index 73a300384..4a6677c0a 100644 --- a/server/tests/api/live/live-socket-messages.ts +++ b/server/tests/api/live/live-socket-messages.ts | |||
@@ -57,7 +57,7 @@ describe('Test live', function () { | |||
57 | privacy: VideoPrivacy.PUBLIC | 57 | privacy: VideoPrivacy.PUBLIC |
58 | } | 58 | } |
59 | 59 | ||
60 | const { uuid } = await servers[0].liveCommand.createLive({ fields: liveAttributes }) | 60 | const { uuid } = await servers[0].liveCommand.create({ fields: liveAttributes }) |
61 | return uuid | 61 | return uuid |
62 | } | 62 | } |
63 | 63 | ||
@@ -99,7 +99,7 @@ describe('Test live', function () { | |||
99 | await stopFfmpeg(ffmpegCommand) | 99 | await stopFfmpeg(ffmpegCommand) |
100 | 100 | ||
101 | for (const server of servers) { | 101 | for (const server of servers) { |
102 | await server.liveCommand.waitUntilLiveEnded({ videoId: liveVideoUUID }) | 102 | await server.liveCommand.waitUntilEnded({ videoId: liveVideoUUID }) |
103 | } | 103 | } |
104 | await waitJobs(servers) | 104 | await waitJobs(servers) |
105 | 105 | ||
diff --git a/server/tests/api/live/live-views.ts b/server/tests/api/live/live-views.ts index ae6af7cfd..75f95b167 100644 --- a/server/tests/api/live/live-views.ts +++ b/server/tests/api/live/live-views.ts | |||
@@ -71,7 +71,7 @@ describe('Test live', function () { | |||
71 | privacy: VideoPrivacy.PUBLIC | 71 | privacy: VideoPrivacy.PUBLIC |
72 | } | 72 | } |
73 | 73 | ||
74 | const live = await servers[0].liveCommand.createLive({ fields: liveAttributes }) | 74 | const live = await servers[0].liveCommand.create({ fields: liveAttributes }) |
75 | liveVideoId = live.uuid | 75 | liveVideoId = live.uuid |
76 | 76 | ||
77 | command = await servers[0].liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoId }) | 77 | command = await servers[0].liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoId }) |
diff --git a/server/tests/api/live/live.ts b/server/tests/api/live/live.ts index 5b4e479b6..5d70d8513 100644 --- a/server/tests/api/live/live.ts +++ b/server/tests/api/live/live.ts | |||
@@ -96,7 +96,7 @@ describe('Test live', function () { | |||
96 | thumbnailfile: 'video_short1.webm.jpg' | 96 | thumbnailfile: 'video_short1.webm.jpg' |
97 | } | 97 | } |
98 | 98 | ||
99 | const live = await commands[0].createLive({ fields: attributes }) | 99 | const live = await commands[0].create({ fields: attributes }) |
100 | liveVideoUUID = live.uuid | 100 | liveVideoUUID = live.uuid |
101 | 101 | ||
102 | await waitJobs(servers) | 102 | await waitJobs(servers) |
@@ -127,7 +127,7 @@ describe('Test live', function () { | |||
127 | await testImage(server.url, 'video_short1-preview.webm', video.previewPath) | 127 | await testImage(server.url, 'video_short1-preview.webm', video.previewPath) |
128 | await testImage(server.url, 'video_short1.webm', video.thumbnailPath) | 128 | await testImage(server.url, 'video_short1.webm', video.thumbnailPath) |
129 | 129 | ||
130 | const live = await server.liveCommand.getLive({ videoId: liveVideoUUID }) | 130 | const live = await server.liveCommand.get({ videoId: liveVideoUUID }) |
131 | 131 | ||
132 | if (server.url === servers[0].url) { | 132 | if (server.url === servers[0].url) { |
133 | expect(live.rtmpUrl).to.equal('rtmp://' + server.hostname + ':' + servers[0].rtmpPort + '/live') | 133 | expect(live.rtmpUrl).to.equal('rtmp://' + server.hostname + ':' + servers[0].rtmpPort + '/live') |
@@ -151,7 +151,7 @@ describe('Test live', function () { | |||
151 | nsfw: true | 151 | nsfw: true |
152 | } | 152 | } |
153 | 153 | ||
154 | const live = await commands[0].createLive({ fields: attributes }) | 154 | const live = await commands[0].create({ fields: attributes }) |
155 | const videoId = live.uuid | 155 | const videoId = live.uuid |
156 | 156 | ||
157 | await waitJobs(servers) | 157 | await waitJobs(servers) |
@@ -178,19 +178,19 @@ describe('Test live', function () { | |||
178 | }) | 178 | }) |
179 | 179 | ||
180 | it('Should not be able to update a live of another server', async function () { | 180 | it('Should not be able to update a live of another server', async function () { |
181 | await commands[1].updateLive({ videoId: liveVideoUUID, fields: { saveReplay: false }, expectedStatus: HttpStatusCode.FORBIDDEN_403 }) | 181 | await commands[1].update({ videoId: liveVideoUUID, fields: { saveReplay: false }, expectedStatus: HttpStatusCode.FORBIDDEN_403 }) |
182 | }) | 182 | }) |
183 | 183 | ||
184 | it('Should update the live', async function () { | 184 | it('Should update the live', async function () { |
185 | this.timeout(10000) | 185 | this.timeout(10000) |
186 | 186 | ||
187 | await commands[0].updateLive({ videoId: liveVideoUUID, fields: { saveReplay: false } }) | 187 | await commands[0].update({ videoId: liveVideoUUID, fields: { saveReplay: false } }) |
188 | await waitJobs(servers) | 188 | await waitJobs(servers) |
189 | }) | 189 | }) |
190 | 190 | ||
191 | it('Have the live updated', async function () { | 191 | it('Have the live updated', async function () { |
192 | for (const server of servers) { | 192 | for (const server of servers) { |
193 | const live = await server.liveCommand.getLive({ videoId: liveVideoUUID }) | 193 | const live = await server.liveCommand.get({ videoId: liveVideoUUID }) |
194 | 194 | ||
195 | if (server.url === servers[0].url) { | 195 | if (server.url === servers[0].url) { |
196 | expect(live.rtmpUrl).to.equal('rtmp://' + server.hostname + ':' + servers[0].rtmpPort + '/live') | 196 | expect(live.rtmpUrl).to.equal('rtmp://' + server.hostname + ':' + servers[0].rtmpPort + '/live') |
@@ -214,7 +214,7 @@ describe('Test live', function () { | |||
214 | it('Should have the live deleted', async function () { | 214 | it('Should have the live deleted', async function () { |
215 | for (const server of servers) { | 215 | for (const server of servers) { |
216 | await getVideo(server.url, liveVideoUUID, HttpStatusCode.NOT_FOUND_404) | 216 | await getVideo(server.url, liveVideoUUID, HttpStatusCode.NOT_FOUND_404) |
217 | await server.liveCommand.getLive({ videoId: liveVideoUUID, expectedStatus: HttpStatusCode.NOT_FOUND_404 }) | 217 | await server.liveCommand.get({ videoId: liveVideoUUID, expectedStatus: HttpStatusCode.NOT_FOUND_404 }) |
218 | } | 218 | } |
219 | }) | 219 | }) |
220 | }) | 220 | }) |
@@ -230,7 +230,7 @@ describe('Test live', function () { | |||
230 | vodVideoId = (await uploadVideoAndGetId({ server: servers[0], videoName: 'vod video' })).uuid | 230 | vodVideoId = (await uploadVideoAndGetId({ server: servers[0], videoName: 'vod video' })).uuid |
231 | 231 | ||
232 | const liveOptions = { name: 'live', privacy: VideoPrivacy.PUBLIC, channelId: servers[0].videoChannel.id } | 232 | const liveOptions = { name: 'live', privacy: VideoPrivacy.PUBLIC, channelId: servers[0].videoChannel.id } |
233 | const live = await commands[0].createLive({ fields: liveOptions }) | 233 | const live = await commands[0].create({ fields: liveOptions }) |
234 | liveVideoId = live.uuid | 234 | liveVideoId = live.uuid |
235 | 235 | ||
236 | ffmpegCommand = await servers[0].liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoId }) | 236 | ffmpegCommand = await servers[0].liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoId }) |
@@ -297,9 +297,9 @@ describe('Test live', function () { | |||
297 | saveReplay: false | 297 | saveReplay: false |
298 | } | 298 | } |
299 | 299 | ||
300 | const { uuid } = await commands[0].createLive({ fields: liveAttributes }) | 300 | const { uuid } = await commands[0].create({ fields: liveAttributes }) |
301 | 301 | ||
302 | const live = await commands[0].getLive({ videoId: uuid }) | 302 | const live = await commands[0].get({ videoId: uuid }) |
303 | const resVideo = await getVideo(servers[0].url, uuid) | 303 | const resVideo = await getVideo(servers[0].url, uuid) |
304 | 304 | ||
305 | return Object.assign(resVideo.body as VideoDetails, live) | 305 | return Object.assign(resVideo.body as VideoDetails, live) |
@@ -376,7 +376,7 @@ describe('Test live', function () { | |||
376 | saveReplay | 376 | saveReplay |
377 | } | 377 | } |
378 | 378 | ||
379 | const { uuid } = await commands[0].createLive({ fields: liveAttributes }) | 379 | const { uuid } = await commands[0].create({ fields: liveAttributes }) |
380 | return uuid | 380 | return uuid |
381 | } | 381 | } |
382 | 382 | ||
@@ -403,7 +403,7 @@ describe('Test live', function () { | |||
403 | for (let i = 0; i < resolutions.length; i++) { | 403 | for (let i = 0; i < resolutions.length; i++) { |
404 | const segmentNum = 3 | 404 | const segmentNum = 3 |
405 | const segmentName = `${i}-00000${segmentNum}.ts` | 405 | const segmentName = `${i}-00000${segmentNum}.ts` |
406 | await commands[0].waitUntilLiveSegmentGeneration({ videoUUID: video.uuid, resolution: i, segment: segmentNum }) | 406 | await commands[0].waitUntilSegmentGeneration({ videoUUID: video.uuid, resolution: i, segment: segmentNum }) |
407 | 407 | ||
408 | const res = await getPlaylist(`${servers[0].url}/static/streaming-playlists/hls/${video.uuid}/${i}.m3u8`) | 408 | const res = await getPlaylist(`${servers[0].url}/static/streaming-playlists/hls/${video.uuid}/${i}.m3u8`) |
409 | const subPlaylist = res.text | 409 | const subPlaylist = res.text |
@@ -488,7 +488,7 @@ describe('Test live', function () { | |||
488 | await testVideoResolutions(liveVideoId, resolutions) | 488 | await testVideoResolutions(liveVideoId, resolutions) |
489 | 489 | ||
490 | await stopFfmpeg(ffmpegCommand) | 490 | await stopFfmpeg(ffmpegCommand) |
491 | await commands[0].waitUntilLiveEnded({ videoId: liveVideoId }) | 491 | await commands[0].waitUntilEnded({ videoId: liveVideoId }) |
492 | 492 | ||
493 | await waitJobs(servers) | 493 | await waitJobs(servers) |
494 | 494 | ||
@@ -559,7 +559,7 @@ describe('Test live', function () { | |||
559 | saveReplay | 559 | saveReplay |
560 | } | 560 | } |
561 | 561 | ||
562 | const { uuid } = await commands[0].createLive({ fields: liveAttributes }) | 562 | const { uuid } = await commands[0].create({ fields: liveAttributes }) |
563 | return uuid | 563 | return uuid |
564 | } | 564 | } |
565 | 565 | ||
@@ -575,14 +575,14 @@ describe('Test live', function () { | |||
575 | ]) | 575 | ]) |
576 | 576 | ||
577 | await Promise.all([ | 577 | await Promise.all([ |
578 | commands[0].waitUntilLivePublished({ videoId: liveVideoId }), | 578 | commands[0].waitUntilPublished({ videoId: liveVideoId }), |
579 | commands[0].waitUntilLivePublished({ videoId: liveVideoReplayId }) | 579 | commands[0].waitUntilPublished({ videoId: liveVideoReplayId }) |
580 | ]) | 580 | ]) |
581 | 581 | ||
582 | await commands[0].waitUntilLiveSegmentGeneration({ videoUUID: liveVideoId, resolution: 0, segment: 2 }) | 582 | await commands[0].waitUntilSegmentGeneration({ videoUUID: liveVideoId, resolution: 0, segment: 2 }) |
583 | await commands[0].waitUntilLiveSegmentGeneration({ videoUUID: liveVideoReplayId, resolution: 0, segment: 2 }) | 583 | await commands[0].waitUntilSegmentGeneration({ videoUUID: liveVideoReplayId, resolution: 0, segment: 2 }) |
584 | 584 | ||
585 | await killallServers([ servers[0] ]) | 585 | killallServers([ servers[0] ]) |
586 | await reRunServer(servers[0]) | 586 | await reRunServer(servers[0]) |
587 | 587 | ||
588 | await wait(5000) | 588 | await wait(5000) |
@@ -591,13 +591,13 @@ describe('Test live', function () { | |||
591 | it('Should cleanup lives', async function () { | 591 | it('Should cleanup lives', async function () { |
592 | this.timeout(60000) | 592 | this.timeout(60000) |
593 | 593 | ||
594 | await commands[0].waitUntilLiveEnded({ videoId: liveVideoId }) | 594 | await commands[0].waitUntilEnded({ videoId: liveVideoId }) |
595 | }) | 595 | }) |
596 | 596 | ||
597 | it('Should save a live replay', async function () { | 597 | it('Should save a live replay', async function () { |
598 | this.timeout(120000) | 598 | this.timeout(120000) |
599 | 599 | ||
600 | await commands[0].waitUntilLivePublished({ videoId: liveVideoReplayId }) | 600 | await commands[0].waitUntilPublished({ videoId: liveVideoReplayId }) |
601 | }) | 601 | }) |
602 | }) | 602 | }) |
603 | 603 | ||
diff --git a/server/tests/api/search/search-videos.ts b/server/tests/api/search/search-videos.ts index af74b26a7..a0375fbf0 100644 --- a/server/tests/api/search/search-videos.ts +++ b/server/tests/api/search/search-videos.ts | |||
@@ -502,10 +502,10 @@ describe('Test videos search', function () { | |||
502 | const liveCommand = server.liveCommand | 502 | const liveCommand = server.liveCommand |
503 | 503 | ||
504 | const liveAttributes = { name: 'live', privacy: VideoPrivacy.PUBLIC, channelId: server.videoChannel.id } | 504 | const liveAttributes = { name: 'live', privacy: VideoPrivacy.PUBLIC, channelId: server.videoChannel.id } |
505 | const live = await liveCommand.createLive({ fields: liveAttributes }) | 505 | const live = await liveCommand.create({ fields: liveAttributes }) |
506 | 506 | ||
507 | const ffmpegCommand = await liveCommand.sendRTMPStreamInVideo({ videoId: live.id }) | 507 | const ffmpegCommand = await liveCommand.sendRTMPStreamInVideo({ videoId: live.id }) |
508 | await liveCommand.waitUntilLivePublished({ videoId: live.id }) | 508 | await liveCommand.waitUntilPublished({ videoId: live.id }) |
509 | 509 | ||
510 | const body = await command.advancedVideoSearch({ search: { isLive: true } }) | 510 | const body = await command.advancedVideoSearch({ search: { isLive: true } }) |
511 | 511 | ||
diff --git a/server/tests/api/videos/video-change-ownership.ts b/server/tests/api/videos/video-change-ownership.ts index 88e4d51a2..3c33cf015 100644 --- a/server/tests/api/videos/video-change-ownership.ts +++ b/server/tests/api/videos/video-change-ownership.ts | |||
@@ -111,7 +111,7 @@ describe('Test video change ownership - nominal', function () { | |||
111 | 111 | ||
112 | { | 112 | { |
113 | const attributes = { name: 'live', channelId: firstUserChannelId, privacy: VideoPrivacy.PUBLIC } | 113 | const attributes = { name: 'live', channelId: firstUserChannelId, privacy: VideoPrivacy.PUBLIC } |
114 | const video = await servers[0].liveCommand.createLive({ token: firstUserAccessToken, fields: attributes }) | 114 | const video = await servers[0].liveCommand.create({ token: firstUserAccessToken, fields: attributes }) |
115 | 115 | ||
116 | liveId = video.id | 116 | liveId = video.id |
117 | } | 117 | } |
diff --git a/server/tests/plugins/action-hooks.ts b/server/tests/plugins/action-hooks.ts index 39266c62f..5e9dc3515 100644 --- a/server/tests/plugins/action-hooks.ts +++ b/server/tests/plugins/action-hooks.ts | |||
@@ -95,7 +95,7 @@ describe('Test plugin action hooks', function () { | |||
95 | channelId: servers[0].videoChannel.id | 95 | channelId: servers[0].videoChannel.id |
96 | } | 96 | } |
97 | 97 | ||
98 | await servers[0].liveCommand.createLive({ fields: attributes }) | 98 | await servers[0].liveCommand.create({ fields: attributes }) |
99 | 99 | ||
100 | await checkHook('action:api.live-video.created') | 100 | await checkHook('action:api.live-video.created') |
101 | }) | 101 | }) |
diff --git a/server/tests/plugins/filter-hooks.ts b/server/tests/plugins/filter-hooks.ts index e60bad38d..e938663da 100644 --- a/server/tests/plugins/filter-hooks.ts +++ b/server/tests/plugins/filter-hooks.ts | |||
@@ -155,7 +155,7 @@ describe('Test plugin filter hooks', function () { | |||
155 | channelId: servers[0].videoChannel.id | 155 | channelId: servers[0].videoChannel.id |
156 | } | 156 | } |
157 | 157 | ||
158 | await servers[0].liveCommand.createLive({ fields: attributes, expectedStatus: HttpStatusCode.FORBIDDEN_403 }) | 158 | await servers[0].liveCommand.create({ fields: attributes, expectedStatus: HttpStatusCode.FORBIDDEN_403 }) |
159 | }) | 159 | }) |
160 | 160 | ||
161 | it('Should run filter:api.video.pre-import-url.accept.result', async function () { | 161 | it('Should run filter:api.video.pre-import-url.accept.result', async function () { |
diff --git a/server/tests/plugins/plugin-transcoding.ts b/server/tests/plugins/plugin-transcoding.ts index 65282419e..ca4d9f962 100644 --- a/server/tests/plugins/plugin-transcoding.ts +++ b/server/tests/plugins/plugin-transcoding.ts | |||
@@ -26,7 +26,7 @@ async function createLiveWrapper (server: ServerInfo) { | |||
26 | privacy: VideoPrivacy.PUBLIC | 26 | privacy: VideoPrivacy.PUBLIC |
27 | } | 27 | } |
28 | 28 | ||
29 | const { uuid } = await server.liveCommand.createLive({ fields: liveAttributes }) | 29 | const { uuid } = await server.liveCommand.create({ fields: liveAttributes }) |
30 | 30 | ||
31 | return uuid | 31 | return uuid |
32 | } | 32 | } |
@@ -170,7 +170,7 @@ describe('Test transcoding plugins', function () { | |||
170 | const liveVideoId = await createLiveWrapper(server) | 170 | const liveVideoId = await createLiveWrapper(server) |
171 | 171 | ||
172 | await server.liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoId, fixtureName: 'video_short2.webm' }) | 172 | await server.liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoId, fixtureName: 'video_short2.webm' }) |
173 | await server.liveCommand.waitUntilLivePublished({ videoId: liveVideoId }) | 173 | await server.liveCommand.waitUntilPublished({ videoId: liveVideoId }) |
174 | await waitJobs([ server ]) | 174 | await waitJobs([ server ]) |
175 | 175 | ||
176 | await checkLiveFPS(liveVideoId, 'above', 20) | 176 | await checkLiveFPS(liveVideoId, 'above', 20) |
@@ -184,7 +184,7 @@ describe('Test transcoding plugins', function () { | |||
184 | const liveVideoId = await createLiveWrapper(server) | 184 | const liveVideoId = await createLiveWrapper(server) |
185 | 185 | ||
186 | await server.liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoId, fixtureName: 'video_short2.webm' }) | 186 | await server.liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoId, fixtureName: 'video_short2.webm' }) |
187 | await server.liveCommand.waitUntilLivePublished({ videoId: liveVideoId }) | 187 | await server.liveCommand.waitUntilPublished({ videoId: liveVideoId }) |
188 | await waitJobs([ server ]) | 188 | await waitJobs([ server ]) |
189 | 189 | ||
190 | await checkLiveFPS(liveVideoId, 'below', 12) | 190 | await checkLiveFPS(liveVideoId, 'below', 12) |
@@ -198,7 +198,7 @@ describe('Test transcoding plugins', function () { | |||
198 | const liveVideoId = await createLiveWrapper(server) | 198 | const liveVideoId = await createLiveWrapper(server) |
199 | 199 | ||
200 | await server.liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoId, fixtureName: 'video_short2.webm' }) | 200 | await server.liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoId, fixtureName: 'video_short2.webm' }) |
201 | await server.liveCommand.waitUntilLivePublished({ videoId: liveVideoId }) | 201 | await server.liveCommand.waitUntilPublished({ videoId: liveVideoId }) |
202 | await waitJobs([ server ]) | 202 | await waitJobs([ server ]) |
203 | 203 | ||
204 | await checkLiveFPS(liveVideoId, 'below', 6) | 204 | await checkLiveFPS(liveVideoId, 'below', 6) |
@@ -261,7 +261,7 @@ describe('Test transcoding plugins', function () { | |||
261 | const liveVideoId = await createLiveWrapper(server) | 261 | const liveVideoId = await createLiveWrapper(server) |
262 | 262 | ||
263 | await server.liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoId, fixtureName: 'video_short2.webm' }) | 263 | await server.liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoId, fixtureName: 'video_short2.webm' }) |
264 | await server.liveCommand.waitUntilLivePublished({ videoId: liveVideoId }) | 264 | await server.liveCommand.waitUntilPublished({ videoId: liveVideoId }) |
265 | await waitJobs([ server ]) | 265 | await waitJobs([ server ]) |
266 | 266 | ||
267 | const playlistUrl = `${server.url}/static/streaming-playlists/hls/${liveVideoId}/0.m3u8` | 267 | const playlistUrl = `${server.url}/static/streaming-playlists/hls/${liveVideoId}/0.m3u8` |