aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/live/live.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-07-08 10:25:50 +0200
committerChocobozzz <me@florianbigard.com>2021-07-20 15:27:17 +0200
commit04aed76711909507e74905bde3a7fa024d3585c9 (patch)
treeda93912bb9331feda40f597da3fea7dc24970d66 /server/tests/api/live/live.ts
parentd897210c2db1ca2acc1e7b28a13127647ab2222c (diff)
downloadPeerTube-04aed76711909507e74905bde3a7fa024d3585c9.tar.gz
PeerTube-04aed76711909507e74905bde3a7fa024d3585c9.tar.zst
PeerTube-04aed76711909507e74905bde3a7fa024d3585c9.zip
Shorter live methods
Diffstat (limited to 'server/tests/api/live/live.ts')
-rw-r--r--server/tests/api/live/live.ts42
1 files changed, 21 insertions, 21 deletions
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