X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftests%2Fapi%2Flive%2Flive-permanent.ts;h=6f4915a6b4b6a634af1c0124f9457369d7481c98;hb=04aed76711909507e74905bde3a7fa024d3585c9;hp=b9e37c834478e2ce89e16f177d48b27d6220a4dc;hpb=65e6e2602c0d5521f3a6740f7469bb92830ecb53;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tests/api/live/live-permanent.ts b/server/tests/api/live/live-permanent.ts index b9e37c834..6f4915a6b 100644 --- a/server/tests/api/live/live-permanent.ts +++ b/server/tests/api/live/live-permanent.ts @@ -6,22 +6,15 @@ import { LiveVideoCreate, VideoDetails, VideoPrivacy, VideoState } from '@shared import { cleanupTests, ConfigCommand, - createLive, doubleFollow, flushAndRunMultipleServers, - getLive, - getPlaylistsCount, getVideo, - sendRTMPStreamInVideo, ServerInfo, setAccessTokensToServers, setDefaultVideoChannel, stopFfmpeg, - updateLive, wait, - waitJobs, - waitUntilLivePublished, - waitUntilLiveWaiting + waitJobs } from '../../../../shared/extra-utils' const expect = chai.expect @@ -39,8 +32,8 @@ describe('Permanent live', function () { permanentLive } - const res = await createLive(servers[0].url, servers[0].accessToken, attributes) - return res.body.video.uuid + const { uuid } = await servers[0].liveCommand.create({ fields: attributes }) + return uuid } async function checkVideoState (videoId: string, state: VideoState) { @@ -83,15 +76,15 @@ describe('Permanent live', function () { const videoUUID = await createLiveWrapper(false) { - const res = await getLive(servers[0].url, servers[0].accessToken, videoUUID) - expect(res.body.permanentLive).to.be.false + const live = await servers[0].liveCommand.get({ videoId: videoUUID }) + expect(live.permanentLive).to.be.false } - await updateLive(servers[0].url, servers[0].accessToken, videoUUID, { permanentLive: true }) + await servers[0].liveCommand.update({ videoId: videoUUID, fields: { permanentLive: true } }) { - const res = await getLive(servers[0].url, servers[0].accessToken, videoUUID) - expect(res.body.permanentLive).to.be.true + const live = await servers[0].liveCommand.get({ videoId: videoUUID }) + expect(live.permanentLive).to.be.true } }) @@ -100,8 +93,8 @@ describe('Permanent live', function () { videoUUID = await createLiveWrapper(true) - const res = await getLive(servers[0].url, servers[0].accessToken, videoUUID) - expect(res.body.permanentLive).to.be.true + const live = await servers[0].liveCommand.get({ videoId: videoUUID }) + expect(live.permanentLive).to.be.true await waitJobs(servers) }) @@ -109,16 +102,16 @@ describe('Permanent live', function () { it('Should stream into this permanent live', async function () { this.timeout(120000) - const command = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, videoUUID) + const ffmpegCommand = await servers[0].liveCommand.sendRTMPStreamInVideo({ videoId: videoUUID }) for (const server of servers) { - await waitUntilLivePublished(server.url, server.accessToken, videoUUID) + await server.liveCommand.waitUntilPublished({ videoId: videoUUID }) } await checkVideoState(videoUUID, VideoState.PUBLISHED) - await stopFfmpeg(command) - await waitUntilLiveWaiting(servers[0].url, servers[0].accessToken, videoUUID) + await stopFfmpeg(ffmpegCommand) + await servers[0].liveCommand.waitUntilWaiting({ videoId: videoUUID }) await waitJobs(servers) }) @@ -160,19 +153,19 @@ describe('Permanent live', function () { } }) - const command = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, videoUUID) + const ffmpegCommand = await servers[0].liveCommand.sendRTMPStreamInVideo({ videoId: videoUUID }) for (const server of servers) { - await waitUntilLivePublished(server.url, server.accessToken, videoUUID) + await server.liveCommand.waitUntilPublished({ videoId: videoUUID }) } await checkVideoState(videoUUID, VideoState.PUBLISHED) - const count = await getPlaylistsCount(servers[0], videoUUID) + const count = await servers[0].liveCommand.countPlaylists({ videoUUID }) // master playlist and 720p playlist expect(count).to.equal(2) - await stopFfmpeg(command) + await stopFfmpeg(ffmpegCommand) }) after(async function () {