aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/plugins
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2023-07-25 15:17:58 +0200
committerChocobozzz <me@florianbigard.com>2023-07-25 15:17:58 +0200
commit9901c8d6908a43ab4594406446eac770ee21176c (patch)
treecc59c2c45d96bd51053e283db1121baa2723b765 /server/tests/plugins
parent3b46eec8aeb95eb0dce763e3569c0509b1da7607 (diff)
downloadPeerTube-9901c8d6908a43ab4594406446eac770ee21176c.tar.gz
PeerTube-9901c8d6908a43ab4594406446eac770ee21176c.tar.zst
PeerTube-9901c8d6908a43ab4594406446eac770ee21176c.zip
Add video file update hook tests
Diffstat (limited to 'server/tests/plugins')
-rw-r--r--server/tests/plugins/action-hooks.ts8
-rw-r--r--server/tests/plugins/filter-hooks.ts19
2 files changed, 26 insertions, 1 deletions
diff --git a/server/tests/plugins/action-hooks.ts b/server/tests/plugins/action-hooks.ts
index 34b4e1891..773be0d76 100644
--- a/server/tests/plugins/action-hooks.ts
+++ b/server/tests/plugins/action-hooks.ts
@@ -40,6 +40,8 @@ describe('Test plugin action hooks', function () {
40 } 40 }
41 }) 41 })
42 42
43 await servers[0].config.enableFileUpdate()
44
43 await doubleFollow(servers[0], servers[1]) 45 await doubleFollow(servers[0], servers[1])
44 }) 46 })
45 47
@@ -70,6 +72,12 @@ describe('Test plugin action hooks', function () {
70 await checkHook('action:api.video.viewed') 72 await checkHook('action:api.video.viewed')
71 }) 73 })
72 74
75 it('Should run action:api.video.file-updated', async function () {
76 await servers[0].videos.replaceSourceFile({ videoId: videoUUID, fixture: 'video_short.mp4' })
77
78 await checkHook('action:api.video.file-updated')
79 })
80
73 it('Should run action:api.video.deleted', async function () { 81 it('Should run action:api.video.deleted', async function () {
74 await servers[0].videos.remove({ id: videoUUID }) 82 await servers[0].videos.remove({ id: videoUUID })
75 83
diff --git a/server/tests/plugins/filter-hooks.ts b/server/tests/plugins/filter-hooks.ts
index a75a8c8fa..8382b400f 100644
--- a/server/tests/plugins/filter-hooks.ts
+++ b/server/tests/plugins/filter-hooks.ts
@@ -64,6 +64,11 @@ describe('Test plugin filter hooks', function () {
64 newConfig: { 64 newConfig: {
65 live: { enabled: true }, 65 live: { enabled: true },
66 signup: { enabled: true }, 66 signup: { enabled: true },
67 videoFile: {
68 update: {
69 enabled: true
70 }
71 },
67 import: { 72 import: {
68 videos: { 73 videos: {
69 http: { enabled: true }, 74 http: { enabled: true },
@@ -178,7 +183,19 @@ describe('Test plugin filter hooks', function () {
178 describe('Video/live/import accept', function () { 183 describe('Video/live/import accept', function () {
179 184
180 it('Should run filter:api.video.upload.accept.result', async function () { 185 it('Should run filter:api.video.upload.accept.result', async function () {
181 await servers[0].videos.upload({ attributes: { name: 'video with bad word' }, expectedStatus: HttpStatusCode.FORBIDDEN_403 }) 186 const options = { attributes: { name: 'video with bad word' }, expectedStatus: HttpStatusCode.FORBIDDEN_403 }
187 await servers[0].videos.upload({ mode: 'legacy', ...options })
188 await servers[0].videos.upload({ mode: 'resumable', ...options })
189 })
190
191 it('Should run filter:api.video.update-file.accept.result', async function () {
192 const res = await servers[0].videos.replaceSourceFile({
193 videoId: videoUUID,
194 fixture: 'video_short1.webm',
195 completedExpectedStatus: HttpStatusCode.FORBIDDEN_403
196 })
197
198 expect((res as any)?.error).to.equal('no webm')
182 }) 199 })
183 200
184 it('Should run filter:api.live-video.create.accept.result', async function () { 201 it('Should run filter:api.live-video.create.accept.result', async function () {