1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-06 03:50:26 +02:00

Add upload/import/go live video attributes hooks

This commit is contained in:
Chocobozzz 2021-12-10 13:49:19 +01:00
parent 8cf43a6524
commit d17d743051
No known key found for this signature in database
GPG key ID: 583A612D890159BE
6 changed files with 98 additions and 6 deletions

View file

@ -537,6 +537,65 @@ describe('Test plugin filter hooks', function () {
})
})
describe('Upload/import/live attributes filters', function () {
before(async function () {
await servers[0].config.enableLive({ transcoding: false, allowReplay: false })
await servers[0].config.enableImports()
await servers[0].config.disableTranscoding()
})
it('Should run filter:api.video.upload.video-attribute.result', async function () {
for (const mode of [ 'legacy' as 'legacy', 'resumable' as 'resumable' ]) {
const { id } = await servers[0].videos.upload({ attributes: { name: 'video', description: 'upload' }, mode })
const video = await servers[0].videos.get({ id })
expect(video.description).to.equal('upload - filter:api.video.upload.video-attribute.result')
}
})
it('Should run filter:api.video.import-url.video-attribute.result', async function () {
const attributes = {
name: 'video',
description: 'import url',
channelId: servers[0].store.channel.id,
targetUrl: FIXTURE_URLS.goodVideo,
privacy: VideoPrivacy.PUBLIC
}
const { video: { id } } = await servers[0].imports.importVideo({ attributes })
const video = await servers[0].videos.get({ id })
expect(video.description).to.equal('import url - filter:api.video.import-url.video-attribute.result')
})
it('Should run filter:api.video.import-torrent.video-attribute.result', async function () {
const attributes = {
name: 'video',
description: 'import torrent',
channelId: servers[0].store.channel.id,
magnetUri: FIXTURE_URLS.magnet,
privacy: VideoPrivacy.PUBLIC
}
const { video: { id } } = await servers[0].imports.importVideo({ attributes })
const video = await servers[0].videos.get({ id })
expect(video.description).to.equal('import torrent - filter:api.video.import-torrent.video-attribute.result')
})
it('Should run filter:api.video.live.video-attribute.result', async function () {
const fields = {
name: 'live',
description: 'live',
channelId: servers[0].store.channel.id,
privacy: VideoPrivacy.PUBLIC
}
const { id } = await servers[0].live.create({ fields })
const video = await servers[0].videos.get({ id })
expect(video.description).to.equal('live - filter:api.video.live.video-attribute.result')
})
})
describe('Stats filters', function () {
it('Should run filter:api.server.stats.get.result', async function () {