From 4f2199144e428c16460750305f737b890c1ac322 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 8 Jul 2021 10:18:40 +0200 Subject: Introduce live command --- server/tests/plugins/action-hooks.ts | 3 +-- server/tests/plugins/filter-hooks.ts | 3 +-- server/tests/plugins/plugin-transcoding.ts | 28 +++++++++++++--------------- 3 files changed, 15 insertions(+), 19 deletions(-) (limited to 'server/tests/plugins') diff --git a/server/tests/plugins/action-hooks.ts b/server/tests/plugins/action-hooks.ts index 0de5b523b..39266c62f 100644 --- a/server/tests/plugins/action-hooks.ts +++ b/server/tests/plugins/action-hooks.ts @@ -7,7 +7,6 @@ import { addVideoCommentThread, addVideoInPlaylist, blockUser, - createLive, createUser, createVideoPlaylist, deleteVideoComment, @@ -96,7 +95,7 @@ describe('Test plugin action hooks', function () { channelId: servers[0].videoChannel.id } - await createLive(servers[0].url, servers[0].accessToken, attributes) + await servers[0].liveCommand.createLive({ fields: attributes }) await checkHook('action:api.live-video.created') }) diff --git a/server/tests/plugins/filter-hooks.ts b/server/tests/plugins/filter-hooks.ts index e254046bf..e60bad38d 100644 --- a/server/tests/plugins/filter-hooks.ts +++ b/server/tests/plugins/filter-hooks.ts @@ -7,7 +7,6 @@ import { addVideoCommentReply, addVideoCommentThread, cleanupTests, - createLive, createVideoPlaylist, doubleFollow, flushAndRunMultipleServers, @@ -156,7 +155,7 @@ describe('Test plugin filter hooks', function () { channelId: servers[0].videoChannel.id } - await createLive(servers[0].url, servers[0].accessToken, attributes, HttpStatusCode.FORBIDDEN_403) + await servers[0].liveCommand.createLive({ fields: attributes, expectedStatus: HttpStatusCode.FORBIDDEN_403 }) }) 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 71c2adc72..65282419e 100644 --- a/server/tests/plugins/plugin-transcoding.ts +++ b/server/tests/plugins/plugin-transcoding.ts @@ -7,18 +7,15 @@ import { getAudioStream, getVideoFileFPS, getVideoStreamFromFile } from '@server import { buildServerDirectory, cleanupTests, - createLive, flushAndRunServer, getVideo, PluginsCommand, - sendRTMPStreamInVideo, ServerInfo, setAccessTokensToServers, setDefaultVideoChannel, testFfmpegStreamError, uploadVideoAndGetId, - waitJobs, - waitUntilLivePublished + waitJobs } from '@shared/extra-utils' import { VideoDetails, VideoPrivacy } from '@shared/models' @@ -29,8 +26,9 @@ async function createLiveWrapper (server: ServerInfo) { privacy: VideoPrivacy.PUBLIC } - const res = await createLive(server.url, server.accessToken, liveAttributes) - return res.body.video.uuid + const { uuid } = await server.liveCommand.createLive({ fields: liveAttributes }) + + return uuid } function updateConf (server: ServerInfo, vodProfile: string, liveProfile: string) { @@ -171,8 +169,8 @@ describe('Test transcoding plugins', function () { const liveVideoId = await createLiveWrapper(server) - await sendRTMPStreamInVideo(server.url, server.accessToken, liveVideoId, 'video_short2.webm') - await waitUntilLivePublished(server.url, server.accessToken, liveVideoId) + await server.liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoId, fixtureName: 'video_short2.webm' }) + await server.liveCommand.waitUntilLivePublished({ videoId: liveVideoId }) await waitJobs([ server ]) await checkLiveFPS(liveVideoId, 'above', 20) @@ -185,8 +183,8 @@ describe('Test transcoding plugins', function () { const liveVideoId = await createLiveWrapper(server) - await sendRTMPStreamInVideo(server.url, server.accessToken, liveVideoId, 'video_short2.webm') - await waitUntilLivePublished(server.url, server.accessToken, liveVideoId) + await server.liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoId, fixtureName: 'video_short2.webm' }) + await server.liveCommand.waitUntilLivePublished({ videoId: liveVideoId }) await waitJobs([ server ]) await checkLiveFPS(liveVideoId, 'below', 12) @@ -199,8 +197,8 @@ describe('Test transcoding plugins', function () { const liveVideoId = await createLiveWrapper(server) - await sendRTMPStreamInVideo(server.url, server.accessToken, liveVideoId, 'video_short2.webm') - await waitUntilLivePublished(server.url, server.accessToken, liveVideoId) + await server.liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoId, fixtureName: 'video_short2.webm' }) + await server.liveCommand.waitUntilLivePublished({ videoId: liveVideoId }) await waitJobs([ server ]) await checkLiveFPS(liveVideoId, 'below', 6) @@ -213,7 +211,7 @@ describe('Test transcoding plugins', function () { const liveVideoId = await createLiveWrapper(server) - const command = await sendRTMPStreamInVideo(server.url, server.accessToken, liveVideoId, 'video_short2.webm') + const command = await server.liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoId, fixtureName: 'video_short2.webm' }) await testFfmpegStreamError(command, true) }) @@ -262,8 +260,8 @@ describe('Test transcoding plugins', function () { const liveVideoId = await createLiveWrapper(server) - await sendRTMPStreamInVideo(server.url, server.accessToken, liveVideoId, 'video_short2.webm') - await waitUntilLivePublished(server.url, server.accessToken, liveVideoId) + await server.liveCommand.sendRTMPStreamInVideo({ videoId: liveVideoId, fixtureName: 'video_short2.webm' }) + await server.liveCommand.waitUntilLivePublished({ videoId: liveVideoId }) await waitJobs([ server ]) const playlistUrl = `${server.url}/static/streaming-playlists/hls/${liveVideoId}/0.m3u8` -- cgit v1.2.3