]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Shorter live methods
authorChocobozzz <me@florianbigard.com>
Thu, 8 Jul 2021 08:25:50 +0000 (10:25 +0200)
committerChocobozzz <me@florianbigard.com>
Tue, 20 Jul 2021 13:27:17 +0000 (15:27 +0200)
14 files changed:
server/tests/api/check-params/live.ts
server/tests/api/live/live-constraints.ts
server/tests/api/live/live-permanent.ts
server/tests/api/live/live-save-replay.ts
server/tests/api/live/live-socket-messages.ts
server/tests/api/live/live-views.ts
server/tests/api/live/live.ts
server/tests/api/search/search-videos.ts
server/tests/api/videos/video-change-ownership.ts
server/tests/plugins/action-hooks.ts
server/tests/plugins/filter-hooks.ts
server/tests/plugins/plugin-transcoding.ts
shared/extra-utils/videos/live-command.ts
shared/extra-utils/videos/live.ts

index 56116848fb0813893d8cf087d6234c16648406fc..d851d258dc7dd1aad9634bf8e77b2536dad3cea7 100644 (file)
@@ -337,72 +337,72 @@ describe('Test video lives API validator', function () {
   describe('When getting live information', function () {
 
     it('Should fail without access token', async function () {
-      await command.getLive({ token: '', videoId: video.id, expectedStatus: HttpStatusCode.UNAUTHORIZED_401 })
+      await command.get({ token: '', videoId: video.id, expectedStatus: HttpStatusCode.UNAUTHORIZED_401 })
     })
 
     it('Should fail with a bad access token', async function () {
-      await command.getLive({ token: 'toto', videoId: video.id, expectedStatus: HttpStatusCode.UNAUTHORIZED_401 })
+      await command.get({ token: 'toto', videoId: video.id, expectedStatus: HttpStatusCode.UNAUTHORIZED_401 })
     })
 
     it('Should fail with access token of another user', async function () {
-      await command.getLive({ token: userAccessToken, videoId: video.id, expectedStatus: HttpStatusCode.FORBIDDEN_403 })
+      await command.get({ token: userAccessToken, videoId: video.id, expectedStatus: HttpStatusCode.FORBIDDEN_403 })
     })
 
     it('Should fail with a bad video id', async function () {
-      await command.getLive({ videoId: 'toto', expectedStatus: HttpStatusCode.BAD_REQUEST_400 })
+      await command.get({ videoId: 'toto', expectedStatus: HttpStatusCode.BAD_REQUEST_400 })
     })
 
     it('Should fail with an unknown video id', async function () {
-      await command.getLive({ videoId: 454555, expectedStatus: HttpStatusCode.NOT_FOUND_404 })
+      await command.get({ videoId: 454555, expectedStatus: HttpStatusCode.NOT_FOUND_404 })
     })
 
     it('Should fail with a non live video', async function () {
-      await command.getLive({ videoId: videoIdNotLive, expectedStatus: HttpStatusCode.NOT_FOUND_404 })
+      await command.get({ videoId: videoIdNotLive, expectedStatus: HttpStatusCode.NOT_FOUND_404 })
     })
 
     it('Should succeed with the correct params', async function () {
-      await command.getLive({ videoId: video.id })
-      await command.getLive({ videoId: video.uuid })
-      await command.getLive({ videoId: video.shortUUID })
+      await command.get({ videoId: video.id })
+      await command.get({ videoId: video.uuid })
+      await command.get({ videoId: video.shortUUID })
     })
   })
 
   describe('When updating live information', async function () {
 
     it('Should fail without access token', async function () {
-      await command.updateLive({ token: '', videoId: video.id, fields: {}, expectedStatus: HttpStatusCode.UNAUTHORIZED_401 })
+      await command.update({ token: '', videoId: video.id, fields: {}, expectedStatus: HttpStatusCode.UNAUTHORIZED_401 })
     })
 
     it('Should fail with a bad access token', async function () {
-      await command.updateLive({ token: 'toto', videoId: video.id, fields: {}, expectedStatus: HttpStatusCode.UNAUTHORIZED_401 })
+      await command.update({ token: 'toto', videoId: video.id, fields: {}, expectedStatus: HttpStatusCode.UNAUTHORIZED_401 })
     })
 
     it('Should fail with access token of another user', async function () {
-      await command.updateLive({ token: userAccessToken, videoId: video.id, fields: {}, expectedStatus: HttpStatusCode.FORBIDDEN_403 })
+      await command.update({ token: userAccessToken, videoId: video.id, fields: {}, expectedStatus: HttpStatusCode.FORBIDDEN_403 })
     })
 
     it('Should fail with a bad video id', async function () {
-      await command.updateLive({ videoId: 'toto', fields: {}, expectedStatus: HttpStatusCode.BAD_REQUEST_400 })
+      await command.update({ videoId: 'toto', fields: {}, expectedStatus: HttpStatusCode.BAD_REQUEST_400 })
     })
 
     it('Should fail with an unknown video id', async function () {
-      await command.updateLive({ videoId: 454555, fields: {}, expectedStatus: HttpStatusCode.NOT_FOUND_404 })
+      await command.update({ videoId: 454555, fields: {}, expectedStatus: HttpStatusCode.NOT_FOUND_404 })
     })
 
     it('Should fail with a non live video', async function () {
-      await command.updateLive({ videoId: videoIdNotLive, fields: {}, expectedStatus: HttpStatusCode.NOT_FOUND_404 })
+      await command.update({ videoId: videoIdNotLive, fields: {}, expectedStatus: HttpStatusCode.NOT_FOUND_404 })
     })
 
     it('Should fail with save replay and permanent live set to true', async function () {
       const fields = { saveReplay: true, permanentLive: true }
 
-      await command.updateLive({ videoId: video.id, fields, expectedStatus: HttpStatusCode.BAD_REQUEST_400 })
+      await command.update({ videoId: video.id, fields, expectedStatus: HttpStatusCode.BAD_REQUEST_400 })
     })
 
     it('Should succeed with the correct params', async function () {
-      await command.updateLive({ videoId: video.id, fields: { saveReplay: false } })
-      await command.updateLive({ videoId: video.uuid, fields: { saveReplay: false } })
-      await command.updateLive({ videoId: video.shortUUID, fields: { saveReplay: false } })
+      await command.update({ videoId: video.id, fields: { saveReplay: false } })
+      await command.update({ videoId: video.uuid, fields: { saveReplay: false } })
+      await command.update({ videoId: video.shortUUID, fields: { saveReplay: false } })
     })
 
     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 () {
         }
       })
 
-      await command.updateLive({ videoId: video.id, fields: { saveReplay: true }, expectedStatus: HttpStatusCode.FORBIDDEN_403 })
+      await command.update({ videoId: video.id, fields: { saveReplay: true }, expectedStatus: HttpStatusCode.FORBIDDEN_403 })
     })
 
     it('Should fail to update a live if it has already started', async function () {
       this.timeout(40000)
 
-      const live = await command.getLive({ videoId: video.id })
+      const live = await command.get({ videoId: video.id })
 
       const ffmpegCommand = sendRTMPStream(live.rtmpUrl, live.streamKey)
 
-      await command.waitUntilLivePublished({ videoId: video.id })
-      await command.updateLive({ videoId: video.id, fields: {}, expectedStatus: HttpStatusCode.BAD_REQUEST_400 })
+      await command.waitUntilPublished({ videoId: video.id })
+      await command.update({ videoId: video.id, fields: {}, expectedStatus: HttpStatusCode.BAD_REQUEST_400 })
 
       await stopFfmpeg(ffmpegCommand)
     })
@@ -434,13 +434,13 @@ describe('Test video lives API validator', function () {
     it('Should fail to stream twice in the save live', async function () {
       this.timeout(40000)
 
-      const live = await command.getLive({ videoId: video.id })
+      const live = await command.get({ videoId: video.id })
 
       const ffmpegCommand = sendRTMPStream(live.rtmpUrl, live.streamKey)
 
-      await command.waitUntilLivePublished({ videoId: video.id })
+      await command.waitUntilPublished({ videoId: video.id })
 
-      await command.runAndTestFfmpegStreamError({ videoId: video.id, shouldHaveError: true })
+      await command.runAndTestStreamError({ videoId: video.id, shouldHaveError: true })
 
       await stopFfmpeg(ffmpegCommand)
     })
index 5c4817b406722e56b7037979d3224b9cb0d4d0be..46153f7b1b1a035c074e8eafd283cd5accc21a21 100644 (file)
@@ -35,7 +35,7 @@ describe('Test live constraints', function () {
       saveReplay
     }
 
-    const { uuid } = await servers[0].liveCommand.createLive({ token: userAccessToken, fields: liveAttributes })
+    const { uuid } = await servers[0].liveCommand.create({ token: userAccessToken, fields: liveAttributes })
     return uuid
   }
 
@@ -53,7 +53,7 @@ describe('Test live constraints', function () {
 
   async function waitUntilLivePublishedOnAllServers (videoId: string) {
     for (const server of servers) {
-      await server.liveCommand.waitUntilLivePublished({ videoId })
+      await server.liveCommand.waitUntilPublished({ videoId })
     }
   }
 
@@ -105,7 +105,7 @@ describe('Test live constraints', function () {
     this.timeout(60000)
 
     const userVideoLiveoId = await createLiveWrapper(false)
-    await servers[0].liveCommand.runAndTestFfmpegStreamError({ token: userAccessToken, videoId: userVideoLiveoId, shouldHaveError: false })
+    await servers[0].liveCommand.runAndTestStreamError({ token: userAccessToken, videoId: userVideoLiveoId, shouldHaveError: false })
   })
 
   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 () {
     await wait(5000)
 
     const userVideoLiveoId = await createLiveWrapper(true)
-    await servers[0].liveCommand.runAndTestFfmpegStreamError({ token: userAccessToken, videoId: userVideoLiveoId, shouldHaveError: true })
+    await servers[0].liveCommand.runAndTestStreamError({ token: userAccessToken, videoId: userVideoLiveoId, shouldHaveError: true })
 
     await waitUntilLivePublishedOnAllServers(userVideoLiveoId)
     await waitJobs(servers)
@@ -132,7 +132,7 @@ describe('Test live constraints', function () {
     await updateQuota({ total: -1, daily: 1 })
 
     const userVideoLiveoId = await createLiveWrapper(true)
-    await servers[0].liveCommand.runAndTestFfmpegStreamError({ token: userAccessToken, videoId: userVideoLiveoId, shouldHaveError: true })
+    await servers[0].liveCommand.runAndTestStreamError({ token: userAccessToken, videoId: userVideoLiveoId, shouldHaveError: true })
 
     await waitUntilLivePublishedOnAllServers(userVideoLiveoId)
     await waitJobs(servers)
@@ -149,7 +149,7 @@ describe('Test live constraints', function () {
     await updateQuota({ total: 10 * 1000 * 1000, daily: -1 })
 
     const userVideoLiveoId = await createLiveWrapper(true)
-    await servers[0].liveCommand.runAndTestFfmpegStreamError({ token: userAccessToken, videoId: userVideoLiveoId, shouldHaveError: false })
+    await servers[0].liveCommand.runAndTestStreamError({ token: userAccessToken, videoId: userVideoLiveoId, shouldHaveError: false })
   })
 
   it('Should have max duration limit', async function () {
@@ -170,7 +170,7 @@ describe('Test live constraints', function () {
     })
 
     const userVideoLiveoId = await createLiveWrapper(true)
-    await servers[0].liveCommand.runAndTestFfmpegStreamError({ token: userAccessToken, videoId: userVideoLiveoId, shouldHaveError: true })
+    await servers[0].liveCommand.runAndTestStreamError({ token: userAccessToken, videoId: userVideoLiveoId, shouldHaveError: true })
 
     await waitUntilLivePublishedOnAllServers(userVideoLiveoId)
     await waitJobs(servers)
index a0f70dfdb3dcb365c09334156b971829eb6b136b..6f4915a6b4b6a634af1c0124f9457369d7481c98 100644 (file)
@@ -32,7 +32,7 @@ describe('Permanent live', function () {
       permanentLive
     }
 
-    const { uuid } = await servers[0].liveCommand.createLive({ fields: attributes })
+    const { uuid } = await servers[0].liveCommand.create({ fields: attributes })
     return uuid
   }
 
@@ -76,14 +76,14 @@ describe('Permanent live', function () {
     const videoUUID = await createLiveWrapper(false)
 
     {
-      const live = await servers[0].liveCommand.getLive({ videoId: videoUUID })
+      const live = await servers[0].liveCommand.get({ videoId: videoUUID })
       expect(live.permanentLive).to.be.false
     }
 
-    await servers[0].liveCommand.updateLive({ videoId: videoUUID, fields: { permanentLive: true } })
+    await servers[0].liveCommand.update({ videoId: videoUUID, fields: { permanentLive: true } })
 
     {
-      const live = await servers[0].liveCommand.getLive({ videoId: videoUUID })
+      const live = await servers[0].liveCommand.get({ videoId: videoUUID })
       expect(live.permanentLive).to.be.true
     }
   })
@@ -93,7 +93,7 @@ describe('Permanent live', function () {
 
     videoUUID = await createLiveWrapper(true)
 
-    const live = await servers[0].liveCommand.getLive({ videoId: videoUUID })
+    const live = await servers[0].liveCommand.get({ videoId: videoUUID })
     expect(live.permanentLive).to.be.true
 
     await waitJobs(servers)
@@ -105,13 +105,13 @@ describe('Permanent live', function () {
     const ffmpegCommand = await servers[0].liveCommand.sendRTMPStreamInVideo({ videoId: videoUUID })
 
     for (const server of servers) {
-      await server.liveCommand.waitUntilLivePublished({ videoId: videoUUID })
+      await server.liveCommand.waitUntilPublished({ videoId: videoUUID })
     }
 
     await checkVideoState(videoUUID, VideoState.PUBLISHED)
 
     await stopFfmpeg(ffmpegCommand)
-    await servers[0].liveCommand.waitUntilLiveWaiting({ videoId: videoUUID })
+    await servers[0].liveCommand.waitUntilWaiting({ videoId: videoUUID })
 
     await waitJobs(servers)
   })
@@ -156,12 +156,12 @@ describe('Permanent live', function () {
     const ffmpegCommand = await servers[0].liveCommand.sendRTMPStreamInVideo({ videoId: videoUUID })
 
     for (const server of servers) {
-      await server.liveCommand.waitUntilLivePublished({ videoId: videoUUID })
+      await server.liveCommand.waitUntilPublished({ videoId: videoUUID })
     }
 
     await checkVideoState(videoUUID, VideoState.PUBLISHED)
 
-    const count = await servers[0].liveCommand.getPlaylistsCount({ videoUUID })
+    const count = await servers[0].liveCommand.countPlaylists({ videoUUID })
     // master playlist and 720p playlist
     expect(count).to.equal(2)
 
index d3c252ffdb711fb54cefc80b4c7db5606741b040..9acd5601d5b447a50395529c3af598cb293ed710 100644 (file)
@@ -47,7 +47,7 @@ describe('Save replay setting', function () {
       saveReplay
     }
 
-    const { uuid } = await servers[0].liveCommand.createLive({ fields: attributes })
+    const { uuid } = await servers[0].liveCommand.create({ fields: attributes })
     return uuid
   }
 
@@ -74,13 +74,13 @@ describe('Save replay setting', function () {
 
   async function waitUntilLivePublishedOnAllServers (videoId: string) {
     for (const server of servers) {
-      await server.liveCommand.waitUntilLivePublished({ videoId })
+      await server.liveCommand.waitUntilPublished({ videoId })
     }
   }
 
   async function waitUntilLiveSavedOnAllServers (videoId: string) {
     for (const server of servers) {
-      await server.liveCommand.waitUntilLiveSaved({ videoId })
+      await server.liveCommand.waitUntilSaved({ videoId })
     }
   }
 
@@ -147,7 +147,7 @@ describe('Save replay setting', function () {
       await stopFfmpeg(ffmpegCommand)
 
       for (const server of servers) {
-        await server.liveCommand.waitUntilLiveEnded({ videoId: liveVideoUUID })
+        await server.liveCommand.waitUntilEnded({ videoId: liveVideoUUID })
       }
       await waitJobs(servers)
 
index 73a300384f4b4a85174fc8b78a2f2d99be1002f4..4a6677c0aef20cd9cd3232591a3075b9e23552a9 100644 (file)
@@ -57,7 +57,7 @@ describe('Test live', function () {
         privacy: VideoPrivacy.PUBLIC
       }
 
-      const { uuid } = await servers[0].liveCommand.createLive({ fields: liveAttributes })
+      const { uuid } = await servers[0].liveCommand.create({ fields: liveAttributes })
       return uuid
     }
 
@@ -99,7 +99,7 @@ describe('Test live', function () {
       await stopFfmpeg(ffmpegCommand)
 
       for (const server of servers) {
-        await server.liveCommand.waitUntilLiveEnded({ videoId: liveVideoUUID })
+        await server.liveCommand.waitUntilEnded({ videoId: liveVideoUUID })
       }
       await waitJobs(servers)
 
index ae6af7cfdebf0c07a5674440edcf16b0760644cc..75f95b167b624708d554a53eeb8eedd2a28a8ee9 100644 (file)
@@ -71,7 +71,7 @@ describe('Test live', function () {
         privacy: VideoPrivacy.PUBLIC
       }
 
-      const live = await servers[0].liveCommand.createLive({ fields: liveAttributes })
+      const live = await servers[0].liveCommand.create({ fields: liveAttributes })
       liveVideoId = live.uuid
 
       command = await servers[0].liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoId })
index 5b4e479b675ce7f4c848eeb8a7a8412d2746149a..5d70d8513e746441aec6e1c555cc5df8dcc7c520 100644 (file)
@@ -96,7 +96,7 @@ describe('Test live', function () {
         thumbnailfile: 'video_short1.webm.jpg'
       }
 
-      const live = await commands[0].createLive({ fields: attributes })
+      const live = await commands[0].create({ fields: attributes })
       liveVideoUUID = live.uuid
 
       await waitJobs(servers)
@@ -127,7 +127,7 @@ describe('Test live', function () {
         await testImage(server.url, 'video_short1-preview.webm', video.previewPath)
         await testImage(server.url, 'video_short1.webm', video.thumbnailPath)
 
-        const live = await server.liveCommand.getLive({ videoId: liveVideoUUID })
+        const live = await server.liveCommand.get({ videoId: liveVideoUUID })
 
         if (server.url === servers[0].url) {
           expect(live.rtmpUrl).to.equal('rtmp://' + server.hostname + ':' + servers[0].rtmpPort + '/live')
@@ -151,7 +151,7 @@ describe('Test live', function () {
         nsfw: true
       }
 
-      const live = await commands[0].createLive({ fields: attributes })
+      const live = await commands[0].create({ fields: attributes })
       const videoId = live.uuid
 
       await waitJobs(servers)
@@ -178,19 +178,19 @@ describe('Test live', function () {
     })
 
     it('Should not be able to update a live of another server', async function () {
-      await commands[1].updateLive({ videoId: liveVideoUUID, fields: { saveReplay: false }, expectedStatus: HttpStatusCode.FORBIDDEN_403 })
+      await commands[1].update({ videoId: liveVideoUUID, fields: { saveReplay: false }, expectedStatus: HttpStatusCode.FORBIDDEN_403 })
     })
 
     it('Should update the live', async function () {
       this.timeout(10000)
 
-      await commands[0].updateLive({ videoId: liveVideoUUID, fields: { saveReplay: false } })
+      await commands[0].update({ videoId: liveVideoUUID, fields: { saveReplay: false } })
       await waitJobs(servers)
     })
 
     it('Have the live updated', async function () {
       for (const server of servers) {
-        const live = await server.liveCommand.getLive({ videoId: liveVideoUUID })
+        const live = await server.liveCommand.get({ videoId: liveVideoUUID })
 
         if (server.url === servers[0].url) {
           expect(live.rtmpUrl).to.equal('rtmp://' + server.hostname + ':' + servers[0].rtmpPort + '/live')
@@ -214,7 +214,7 @@ describe('Test live', function () {
     it('Should have the live deleted', async function () {
       for (const server of servers) {
         await getVideo(server.url, liveVideoUUID, HttpStatusCode.NOT_FOUND_404)
-        await server.liveCommand.getLive({ videoId: liveVideoUUID, expectedStatus: HttpStatusCode.NOT_FOUND_404 })
+        await server.liveCommand.get({ videoId: liveVideoUUID, expectedStatus: HttpStatusCode.NOT_FOUND_404 })
       }
     })
   })
@@ -230,7 +230,7 @@ describe('Test live', function () {
       vodVideoId = (await uploadVideoAndGetId({ server: servers[0], videoName: 'vod video' })).uuid
 
       const liveOptions = { name: 'live', privacy: VideoPrivacy.PUBLIC, channelId: servers[0].videoChannel.id }
-      const live = await commands[0].createLive({ fields: liveOptions })
+      const live = await commands[0].create({ fields: liveOptions })
       liveVideoId = live.uuid
 
       ffmpegCommand = await servers[0].liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoId })
@@ -297,9 +297,9 @@ describe('Test live', function () {
         saveReplay: false
       }
 
-      const { uuid } = await commands[0].createLive({ fields: liveAttributes })
+      const { uuid } = await commands[0].create({ fields: liveAttributes })
 
-      const live = await commands[0].getLive({ videoId: uuid })
+      const live = await commands[0].get({ videoId: uuid })
       const resVideo = await getVideo(servers[0].url, uuid)
 
       return Object.assign(resVideo.body as VideoDetails, live)
@@ -376,7 +376,7 @@ describe('Test live', function () {
         saveReplay
       }
 
-      const { uuid } = await commands[0].createLive({ fields: liveAttributes })
+      const { uuid } = await commands[0].create({ fields: liveAttributes })
       return uuid
     }
 
@@ -403,7 +403,7 @@ describe('Test live', function () {
         for (let i = 0; i < resolutions.length; i++) {
           const segmentNum = 3
           const segmentName = `${i}-00000${segmentNum}.ts`
-          await commands[0].waitUntilLiveSegmentGeneration({ videoUUID: video.uuid, resolution: i, segment: segmentNum })
+          await commands[0].waitUntilSegmentGeneration({ videoUUID: video.uuid, resolution: i, segment: segmentNum })
 
           const res = await getPlaylist(`${servers[0].url}/static/streaming-playlists/hls/${video.uuid}/${i}.m3u8`)
           const subPlaylist = res.text
@@ -488,7 +488,7 @@ describe('Test live', function () {
       await testVideoResolutions(liveVideoId, resolutions)
 
       await stopFfmpeg(ffmpegCommand)
-      await commands[0].waitUntilLiveEnded({ videoId: liveVideoId })
+      await commands[0].waitUntilEnded({ videoId: liveVideoId })
 
       await waitJobs(servers)
 
@@ -559,7 +559,7 @@ describe('Test live', function () {
         saveReplay
       }
 
-      const { uuid } = await commands[0].createLive({ fields: liveAttributes })
+      const { uuid } = await commands[0].create({ fields: liveAttributes })
       return uuid
     }
 
@@ -575,14 +575,14 @@ describe('Test live', function () {
       ])
 
       await Promise.all([
-        commands[0].waitUntilLivePublished({ videoId: liveVideoId }),
-        commands[0].waitUntilLivePublished({ videoId: liveVideoReplayId })
+        commands[0].waitUntilPublished({ videoId: liveVideoId }),
+        commands[0].waitUntilPublished({ videoId: liveVideoReplayId })
       ])
 
-      await commands[0].waitUntilLiveSegmentGeneration({ videoUUID: liveVideoId, resolution: 0, segment: 2 })
-      await commands[0].waitUntilLiveSegmentGeneration({ videoUUID: liveVideoReplayId, resolution: 0, segment: 2 })
+      await commands[0].waitUntilSegmentGeneration({ videoUUID: liveVideoId, resolution: 0, segment: 2 })
+      await commands[0].waitUntilSegmentGeneration({ videoUUID: liveVideoReplayId, resolution: 0, segment: 2 })
 
-      await killallServers([ servers[0] ])
+      killallServers([ servers[0] ])
       await reRunServer(servers[0])
 
       await wait(5000)
@@ -591,13 +591,13 @@ describe('Test live', function () {
     it('Should cleanup lives', async function () {
       this.timeout(60000)
 
-      await commands[0].waitUntilLiveEnded({ videoId: liveVideoId })
+      await commands[0].waitUntilEnded({ videoId: liveVideoId })
     })
 
     it('Should save a live replay', async function () {
       this.timeout(120000)
 
-      await commands[0].waitUntilLivePublished({ videoId: liveVideoReplayId })
+      await commands[0].waitUntilPublished({ videoId: liveVideoReplayId })
     })
   })
 
index af74b26a7ebd1d57738c83c7a083a815ad5abfa3..a0375fbf03138c3352edf43cbae5cfa5d57fa1a6 100644 (file)
@@ -502,10 +502,10 @@ describe('Test videos search', function () {
       const liveCommand = server.liveCommand
 
       const liveAttributes = { name: 'live', privacy: VideoPrivacy.PUBLIC, channelId: server.videoChannel.id }
-      const live = await liveCommand.createLive({ fields: liveAttributes })
+      const live = await liveCommand.create({ fields: liveAttributes })
 
       const ffmpegCommand = await liveCommand.sendRTMPStreamInVideo({ videoId: live.id })
-      await liveCommand.waitUntilLivePublished({ videoId: live.id })
+      await liveCommand.waitUntilPublished({ videoId: live.id })
 
       const body = await command.advancedVideoSearch({ search: { isLive: true } })
 
index 88e4d51a2c8fdc72e3c28019ddacbc9ab084bcd7..3c33cf0150f7d5cd93a5ffb7008e56cdb584a380 100644 (file)
@@ -111,7 +111,7 @@ describe('Test video change ownership - nominal', function () {
 
     {
       const attributes = { name: 'live', channelId: firstUserChannelId, privacy: VideoPrivacy.PUBLIC }
-      const video = await servers[0].liveCommand.createLive({ token: firstUserAccessToken, fields: attributes })
+      const video = await servers[0].liveCommand.create({ token: firstUserAccessToken, fields: attributes })
 
       liveId = video.id
     }
index 39266c62f4d5fb8bd887dabd269bdfbe404e9ea3..5e9dc351519dd1d1b1a200b5e57181f6f5d9c98a 100644 (file)
@@ -95,7 +95,7 @@ describe('Test plugin action hooks', function () {
         channelId: servers[0].videoChannel.id
       }
 
-      await servers[0].liveCommand.createLive({ fields: attributes })
+      await servers[0].liveCommand.create({ fields: attributes })
 
       await checkHook('action:api.live-video.created')
     })
index e60bad38d3a7ff1e492293495b343fe30d1c70ff..e938663da43435b566cba21722ab5d1db592356a 100644 (file)
@@ -155,7 +155,7 @@ describe('Test plugin filter hooks', function () {
       channelId: servers[0].videoChannel.id
     }
 
-    await servers[0].liveCommand.createLive({ fields: attributes, expectedStatus: HttpStatusCode.FORBIDDEN_403 })
+    await servers[0].liveCommand.create({ fields: attributes, expectedStatus: HttpStatusCode.FORBIDDEN_403 })
   })
 
   it('Should run filter:api.video.pre-import-url.accept.result', async function () {
index 65282419e816b6cd80f4913e92b8e40f87a4bde5..ca4d9f962eca2f9c0f4e4c094210a264b7baf4c3 100644 (file)
@@ -26,7 +26,7 @@ async function createLiveWrapper (server: ServerInfo) {
     privacy: VideoPrivacy.PUBLIC
   }
 
-  const { uuid } = await server.liveCommand.createLive({ fields: liveAttributes })
+  const { uuid } = await server.liveCommand.create({ fields: liveAttributes })
 
   return uuid
 }
@@ -170,7 +170,7 @@ describe('Test transcoding plugins', function () {
       const liveVideoId = await createLiveWrapper(server)
 
       await server.liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoId, fixtureName: 'video_short2.webm' })
-      await server.liveCommand.waitUntilLivePublished({ videoId: liveVideoId })
+      await server.liveCommand.waitUntilPublished({ videoId: liveVideoId })
       await waitJobs([ server ])
 
       await checkLiveFPS(liveVideoId, 'above', 20)
@@ -184,7 +184,7 @@ describe('Test transcoding plugins', function () {
       const liveVideoId = await createLiveWrapper(server)
 
       await server.liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoId, fixtureName: 'video_short2.webm' })
-      await server.liveCommand.waitUntilLivePublished({ videoId: liveVideoId })
+      await server.liveCommand.waitUntilPublished({ videoId: liveVideoId })
       await waitJobs([ server ])
 
       await checkLiveFPS(liveVideoId, 'below', 12)
@@ -198,7 +198,7 @@ describe('Test transcoding plugins', function () {
       const liveVideoId = await createLiveWrapper(server)
 
       await server.liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoId, fixtureName: 'video_short2.webm' })
-      await server.liveCommand.waitUntilLivePublished({ videoId: liveVideoId })
+      await server.liveCommand.waitUntilPublished({ videoId: liveVideoId })
       await waitJobs([ server ])
 
       await checkLiveFPS(liveVideoId, 'below', 6)
@@ -261,7 +261,7 @@ describe('Test transcoding plugins', function () {
       const liveVideoId = await createLiveWrapper(server)
 
       await server.liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoId, fixtureName: 'video_short2.webm' })
-      await server.liveCommand.waitUntilLivePublished({ videoId: liveVideoId })
+      await server.liveCommand.waitUntilPublished({ videoId: liveVideoId })
       await waitJobs([ server ])
 
       const playlistUrl = `${server.url}/static/streaming-playlists/hls/${liveVideoId}/0.m3u8`
index 55811b8baf009abaa373db406be69ffe69efbac3..e36c632ee0abdb3e3bec66a657df005c57aec3c1 100644 (file)
@@ -14,7 +14,7 @@ import { getVideoWithToken } from './videos'
 
 export class LiveCommand extends AbstractCommand {
 
-  getLive (options: OverrideCommandOptions & {
+  get (options: OverrideCommandOptions & {
     videoId: number | string
   }) {
     const path = '/api/v1/videos/live'
@@ -27,7 +27,7 @@ export class LiveCommand extends AbstractCommand {
     })
   }
 
-  updateLive (options: OverrideCommandOptions & {
+  update (options: OverrideCommandOptions & {
     videoId: number | string
     fields: LiveVideoUpdate
   }) {
@@ -43,7 +43,7 @@ export class LiveCommand extends AbstractCommand {
     })
   }
 
-  async createLive (options: OverrideCommandOptions & {
+  async create (options: OverrideCommandOptions & {
     fields: LiveVideoCreate
   }) {
     const { fields } = options
@@ -70,12 +70,12 @@ export class LiveCommand extends AbstractCommand {
     fixtureName?: string
   }) {
     const { videoId, fixtureName } = options
-    const videoLive = await this.getLive({ videoId })
+    const videoLive = await this.get({ videoId })
 
     return sendRTMPStream(videoLive.rtmpUrl, videoLive.streamKey, fixtureName)
   }
 
-  async runAndTestFfmpegStreamError (options: OverrideCommandOptions & {
+  async runAndTestStreamError (options: OverrideCommandOptions & {
     videoId: number | string
     shouldHaveError: boolean
   }) {
@@ -84,28 +84,28 @@ export class LiveCommand extends AbstractCommand {
     return testFfmpegStreamError(command, options.shouldHaveError)
   }
 
-  waitUntilLivePublished (options: OverrideCommandOptions & {
+  waitUntilPublished (options: OverrideCommandOptions & {
     videoId: number | string
   }) {
     const { videoId } = options
-    return this.waitUntilLiveState({ videoId, state: VideoState.PUBLISHED })
+    return this.waitUntilState({ videoId, state: VideoState.PUBLISHED })
   }
 
-  waitUntilLiveWaiting (options: OverrideCommandOptions & {
+  waitUntilWaiting (options: OverrideCommandOptions & {
     videoId: number | string
   }) {
     const { videoId } = options
-    return this.waitUntilLiveState({ videoId, state: VideoState.WAITING_FOR_LIVE })
+    return this.waitUntilState({ videoId, state: VideoState.WAITING_FOR_LIVE })
   }
 
-  waitUntilLiveEnded (options: OverrideCommandOptions & {
+  waitUntilEnded (options: OverrideCommandOptions & {
     videoId: number | string
   }) {
     const { videoId } = options
-    return this.waitUntilLiveState({ videoId, state: VideoState.LIVE_ENDED })
+    return this.waitUntilState({ videoId, state: VideoState.LIVE_ENDED })
   }
 
-  waitUntilLiveSegmentGeneration (options: OverrideCommandOptions & {
+  waitUntilSegmentGeneration (options: OverrideCommandOptions & {
     videoUUID: string
     resolution: number
     segment: number
@@ -116,7 +116,7 @@ export class LiveCommand extends AbstractCommand {
     return waitUntilLog(this.server, `${videoUUID}/${segmentName}`, 2, false)
   }
 
-  async waitUntilLiveSaved (options: OverrideCommandOptions & {
+  async waitUntilSaved (options: OverrideCommandOptions & {
     videoId: number | string
   }) {
     let video: VideoDetails
@@ -129,7 +129,7 @@ export class LiveCommand extends AbstractCommand {
     } while (video.isLive === true && video.state.id !== VideoState.PUBLISHED)
   }
 
-  async getPlaylistsCount (options: OverrideCommandOptions & {
+  async countPlaylists (options: OverrideCommandOptions & {
     videoUUID: string
   }) {
     const basePath = buildServerDirectory(this.server, 'streaming-playlists')
@@ -140,7 +140,7 @@ export class LiveCommand extends AbstractCommand {
     return files.filter(f => f.endsWith('.m3u8')).length
   }
 
-  private async waitUntilLiveState (options: OverrideCommandOptions & {
+  private async waitUntilState (options: OverrideCommandOptions & {
     videoId: number | string
     state: VideoState
   }) {
index 285a39c7eda704e350990c4f2c1e508f65ee882c..92cb9104c4a5b828a2800c89bc579c7634ad480c 100644 (file)
@@ -72,7 +72,7 @@ async function stopFfmpeg (command: ffmpeg.FfmpegCommand) {
 
 async function waitUntilLivePublishedOnAllServers (servers: ServerInfo[], videoId: string) {
   for (const server of servers) {
-    await server.liveCommand.waitUntilLivePublished({ videoId })
+    await server.liveCommand.waitUntilPublished({ videoId })
   }
 }