X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftests%2Fplugins%2Faction-hooks.ts;h=ac9f2cea5b97075826550e01b4338b9ec04ab832;hb=f2eb23cd87cf32b8fe545178143b5f49e06a58da;hp=ca57a4b518f71f1a12fe3b78f5ab898db507f4bb;hpb=7024e9120b381b5b3201212f5a18f5cdc14e15ff;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tests/plugins/action-hooks.ts b/server/tests/plugins/action-hooks.ts index ca57a4b51..ac9f2cea5 100644 --- a/server/tests/plugins/action-hooks.ts +++ b/server/tests/plugins/action-hooks.ts @@ -1,18 +1,12 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ import 'mocha' -import { - cleanupTests, - flushAndRunMultipleServers, - killallServers, - reRunServer, - ServerInfo, - waitUntilLog -} from '../../../shared/extra-utils/server/servers' +import { ServerHookName, VideoPrivacy } from '@shared/models' import { addVideoCommentReply, addVideoCommentThread, blockUser, + createLive, createUser, deleteVideoComment, getPluginTestPath, @@ -20,6 +14,7 @@ import { registerUser, removeUser, setAccessTokensToServers, + setDefaultVideoChannel, unblockUser, updateUser, updateVideo, @@ -27,13 +22,21 @@ import { userLogin, viewVideo } from '../../../shared/extra-utils' +import { + cleanupTests, + flushAndRunMultipleServers, + killallServers, + reRunServer, + ServerInfo, + waitUntilLog +} from '../../../shared/extra-utils/server/servers' describe('Test plugin action hooks', function () { let servers: ServerInfo[] let videoUUID: string let threadId: number - function checkHook (hook: string) { + function checkHook (hook: ServerHookName) { return waitUntilLog(servers[0], 'Run hook ' + hook) } @@ -42,6 +45,7 @@ describe('Test plugin action hooks', function () { servers = await flushAndRunMultipleServers(2) await setAccessTokensToServers(servers) + await setDefaultVideoChannel(servers) await installPlugin({ url: servers[0].url, @@ -51,7 +55,11 @@ describe('Test plugin action hooks', function () { killallServers([ servers[0] ]) - await reRunServer(servers[0]) + await reRunServer(servers[0], { + live: { + enabled: true + } + }) }) describe('Application hooks', function () { @@ -81,6 +89,21 @@ describe('Test plugin action hooks', function () { }) }) + describe('Live hooks', function () { + + it('Should run action:api.live-video.created', async function () { + const attributes = { + name: 'live', + privacy: VideoPrivacy.PUBLIC, + channelId: servers[0].videoChannel.id + } + + await createLive(servers[0].url, servers[0].accessToken, attributes) + + await checkHook('action:api.live-video.created') + }) + }) + describe('Comments hooks', function () { it('Should run action:api.video-thread.created', async function () { const res = await addVideoCommentThread(servers[0].url, servers[0].accessToken, videoUUID, 'thread')