mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-05 02:39:33 +02:00
Add live server hooks
This commit is contained in:
parent
c8f3cfeba7
commit
3cabf3532b
9 changed files with 133 additions and 32 deletions
|
@ -1,6 +1,27 @@
|
|||
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
|
||||
|
||||
import 'mocha'
|
||||
import { ServerHookName, VideoPrivacy } from '@shared/models'
|
||||
import {
|
||||
addVideoCommentReply,
|
||||
addVideoCommentThread,
|
||||
blockUser,
|
||||
createLive,
|
||||
createUser,
|
||||
deleteVideoComment,
|
||||
getPluginTestPath,
|
||||
installPlugin,
|
||||
registerUser,
|
||||
removeUser,
|
||||
setAccessTokensToServers,
|
||||
setDefaultVideoChannel,
|
||||
unblockUser,
|
||||
updateUser,
|
||||
updateVideo,
|
||||
uploadVideo,
|
||||
userLogin,
|
||||
viewVideo
|
||||
} from '../../../shared/extra-utils'
|
||||
import {
|
||||
cleanupTests,
|
||||
flushAndRunMultipleServers,
|
||||
|
@ -9,31 +30,13 @@ import {
|
|||
ServerInfo,
|
||||
waitUntilLog
|
||||
} from '../../../shared/extra-utils/server/servers'
|
||||
import {
|
||||
addVideoCommentReply,
|
||||
addVideoCommentThread,
|
||||
blockUser,
|
||||
createUser,
|
||||
deleteVideoComment,
|
||||
getPluginTestPath,
|
||||
installPlugin,
|
||||
registerUser,
|
||||
removeUser,
|
||||
setAccessTokensToServers,
|
||||
unblockUser,
|
||||
updateUser,
|
||||
updateVideo,
|
||||
uploadVideo,
|
||||
userLogin,
|
||||
viewVideo
|
||||
} from '../../../shared/extra-utils'
|
||||
|
||||
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')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue