aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/plugins
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-12-10 13:49:19 +0100
committerChocobozzz <me@florianbigard.com>2021-12-10 13:51:44 +0100
commitd17d743051c5716e1e08cd8870d718cfd6a57f0c (patch)
tree2f8c8d1a08467f35c5ede18001fc18cb2bafafef /server/tests/plugins
parent8cf43a6524d354fbfa0f0eaf789e8d4756bd25d6 (diff)
downloadPeerTube-d17d743051c5716e1e08cd8870d718cfd6a57f0c.tar.gz
PeerTube-d17d743051c5716e1e08cd8870d718cfd6a57f0c.tar.zst
PeerTube-d17d743051c5716e1e08cd8870d718cfd6a57f0c.zip
Add upload/import/go live video attributes hooks
Diffstat (limited to 'server/tests/plugins')
-rw-r--r--server/tests/plugins/filter-hooks.ts59
1 files changed, 59 insertions, 0 deletions
diff --git a/server/tests/plugins/filter-hooks.ts b/server/tests/plugins/filter-hooks.ts
index 80014566b..ff2afc56b 100644
--- a/server/tests/plugins/filter-hooks.ts
+++ b/server/tests/plugins/filter-hooks.ts
@@ -537,6 +537,65 @@ describe('Test plugin filter hooks', function () {
537 }) 537 })
538 }) 538 })
539 539
540 describe('Upload/import/live attributes filters', function () {
541
542 before(async function () {
543 await servers[0].config.enableLive({ transcoding: false, allowReplay: false })
544 await servers[0].config.enableImports()
545 await servers[0].config.disableTranscoding()
546 })
547
548 it('Should run filter:api.video.upload.video-attribute.result', async function () {
549 for (const mode of [ 'legacy' as 'legacy', 'resumable' as 'resumable' ]) {
550 const { id } = await servers[0].videos.upload({ attributes: { name: 'video', description: 'upload' }, mode })
551
552 const video = await servers[0].videos.get({ id })
553 expect(video.description).to.equal('upload - filter:api.video.upload.video-attribute.result')
554 }
555 })
556
557 it('Should run filter:api.video.import-url.video-attribute.result', async function () {
558 const attributes = {
559 name: 'video',
560 description: 'import url',
561 channelId: servers[0].store.channel.id,
562 targetUrl: FIXTURE_URLS.goodVideo,
563 privacy: VideoPrivacy.PUBLIC
564 }
565 const { video: { id } } = await servers[0].imports.importVideo({ attributes })
566
567 const video = await servers[0].videos.get({ id })
568 expect(video.description).to.equal('import url - filter:api.video.import-url.video-attribute.result')
569 })
570
571 it('Should run filter:api.video.import-torrent.video-attribute.result', async function () {
572 const attributes = {
573 name: 'video',
574 description: 'import torrent',
575 channelId: servers[0].store.channel.id,
576 magnetUri: FIXTURE_URLS.magnet,
577 privacy: VideoPrivacy.PUBLIC
578 }
579 const { video: { id } } = await servers[0].imports.importVideo({ attributes })
580
581 const video = await servers[0].videos.get({ id })
582 expect(video.description).to.equal('import torrent - filter:api.video.import-torrent.video-attribute.result')
583 })
584
585 it('Should run filter:api.video.live.video-attribute.result', async function () {
586 const fields = {
587 name: 'live',
588 description: 'live',
589 channelId: servers[0].store.channel.id,
590 privacy: VideoPrivacy.PUBLIC
591 }
592 const { id } = await servers[0].live.create({ fields })
593
594 const video = await servers[0].videos.get({ id })
595 expect(video.description).to.equal('live - filter:api.video.live.video-attribute.result')
596 })
597 })
598
540 describe('Stats filters', function () { 599 describe('Stats filters', function () {
541 600
542 it('Should run filter:api.server.stats.get.result', async function () { 601 it('Should run filter:api.server.stats.get.result', async function () {