From 04aed76711909507e74905bde3a7fa024d3585c9 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 8 Jul 2021 10:25:50 +0200 Subject: Shorter live methods --- server/tests/api/live/live-constraints.ts | 14 ++++----- server/tests/api/live/live-permanent.ts | 18 ++++++------ server/tests/api/live/live-save-replay.ts | 8 ++--- server/tests/api/live/live-socket-messages.ts | 4 +-- server/tests/api/live/live-views.ts | 2 +- server/tests/api/live/live.ts | 42 +++++++++++++-------------- 6 files changed, 44 insertions(+), 44 deletions(-) (limited to 'server/tests/api/live') 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 () { 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) 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 () { 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) 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 () { 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) 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 () { 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) 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 () { 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 }) 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 () { 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 }) }) }) -- cgit v1.2.3