aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/plugins
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-08-02 15:29:00 +0200
committerChocobozzz <me@florianbigard.com>2022-08-02 15:50:05 +0200
commit22df69fdecf299c8be6acaa25f086249ea9a0085 (patch)
treee8c7e21c18fb42bb74b54f2eab1509c3d93a380d /server/tests/plugins
parent7a9e420a02434e4f16c99e7d58da9075dff25d15 (diff)
downloadPeerTube-22df69fdecf299c8be6acaa25f086249ea9a0085.tar.gz
PeerTube-22df69fdecf299c8be6acaa25f086249ea9a0085.tar.zst
PeerTube-22df69fdecf299c8be6acaa25f086249ea9a0085.zip
Add job queue hooks
Diffstat (limited to 'server/tests/plugins')
-rw-r--r--server/tests/plugins/filter-hooks.ts45
-rw-r--r--server/tests/plugins/plugin-helpers.ts23
2 files changed, 68 insertions, 0 deletions
diff --git a/server/tests/plugins/filter-hooks.ts b/server/tests/plugins/filter-hooks.ts
index b1f83d201..27b72cf7d 100644
--- a/server/tests/plugins/filter-hooks.ts
+++ b/server/tests/plugins/filter-hooks.ts
@@ -632,6 +632,51 @@ describe('Test plugin filter hooks', function () {
632 632
633 }) 633 })
634 634
635 describe('Job queue filters', function () {
636 let videoUUID: string
637
638 before(async function () {
639 this.timeout(120_000)
640
641 const { uuid } = await servers[0].videos.quickUpload({ name: 'studio' })
642
643 const video = await servers[0].videos.get({ id: uuid })
644 expect(video.duration).at.least(2)
645 videoUUID = video.uuid
646
647 await waitJobs(servers)
648
649 await servers[0].config.enableStudio()
650 })
651
652 it('Should run filter:job-queue.process.params', async function () {
653 this.timeout(120_000)
654
655 await servers[0].videoStudio.createEditionTasks({
656 videoId: videoUUID,
657 tasks: [
658 {
659 name: 'add-intro',
660 options: {
661 file: 'video_very_short_240p.mp4'
662 }
663 }
664 ]
665 })
666
667 await waitJobs(servers)
668
669 await servers[0].servers.waitUntilLog('Run hook filter:job-queue.process.params', 1, false)
670
671 const video = await servers[0].videos.get({ id: videoUUID })
672 expect(video.duration).at.most(2)
673 })
674
675 it('Should run filter:job-queue.process.result', async function () {
676 await servers[0].servers.waitUntilLog('Run hook filter:job-queue.process.result', 1, false)
677 })
678 })
679
635 after(async function () { 680 after(async function () {
636 await cleanupTests(servers) 681 await cleanupTests(servers)
637 }) 682 })
diff --git a/server/tests/plugins/plugin-helpers.ts b/server/tests/plugins/plugin-helpers.ts
index 5e8d08dff..49807f8f5 100644
--- a/server/tests/plugins/plugin-helpers.ts
+++ b/server/tests/plugins/plugin-helpers.ts
@@ -110,6 +110,7 @@ describe('Test plugin helpers', function () {
110 }) 110 })
111 111
112 describe('User', function () { 112 describe('User', function () {
113 let rootId: number
113 114
114 it('Should not get a user if not authenticated', async function () { 115 it('Should not get a user if not authenticated', async function () {
115 await makeGetRequest({ 116 await makeGetRequest({
@@ -132,6 +133,28 @@ describe('Test plugin helpers', function () {
132 expect(res.body.isAdmin).to.be.true 133 expect(res.body.isAdmin).to.be.true
133 expect(res.body.isModerator).to.be.false 134 expect(res.body.isModerator).to.be.false
134 expect(res.body.isUser).to.be.false 135 expect(res.body.isUser).to.be.false
136
137 rootId = res.body.id
138 })
139
140 it('Should load a user by id', async function () {
141 {
142 const res = await makeGetRequest({
143 url: servers[0].url,
144 path: '/plugins/test-four/router/user/' + rootId,
145 expectedStatus: HttpStatusCode.OK_200
146 })
147
148 expect(res.body.username).to.equal('root')
149 }
150
151 {
152 await makeGetRequest({
153 url: servers[0].url,
154 path: '/plugins/test-four/router/user/42',
155 expectedStatus: HttpStatusCode.NOT_FOUND_404
156 })
157 }
135 }) 158 })
136 }) 159 })
137 160