aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/fixtures/peertube-plugin-test
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/fixtures/peertube-plugin-test
parent3b46eec8aeb95eb0dce763e3569c0509b1da7607 (diff)
downloadPeerTube-9901c8d6908a43ab4594406446eac770ee21176c.tar.gz
PeerTube-9901c8d6908a43ab4594406446eac770ee21176c.tar.zst
PeerTube-9901c8d6908a43ab4594406446eac770ee21176c.zip
Add video file update hook tests
Diffstat (limited to 'server/tests/fixtures/peertube-plugin-test')
-rw-r--r--server/tests/fixtures/peertube-plugin-test/main.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/server/tests/fixtures/peertube-plugin-test/main.js b/server/tests/fixtures/peertube-plugin-test/main.js
index 17032f6d9..e16bf0ca3 100644
--- a/server/tests/fixtures/peertube-plugin-test/main.js
+++ b/server/tests/fixtures/peertube-plugin-test/main.js
@@ -9,6 +9,8 @@ async function register ({ registerHook, registerSetting, settingsManager, stora
9 'action:api.video.uploaded', 9 'action:api.video.uploaded',
10 'action:api.video.viewed', 10 'action:api.video.viewed',
11 11
12 'action:api.video.file-updated',
13
12 'action:api.video-channel.created', 14 'action:api.video-channel.created',
13 'action:api.video-channel.updated', 15 'action:api.video-channel.updated',
14 'action:api.video-channel.deleted', 16 'action:api.video-channel.deleted',
@@ -161,6 +163,16 @@ async function register ({ registerHook, registerSetting, settingsManager, stora
161 } 163 }
162 164
163 registerHook({ 165 registerHook({
166 target: 'filter:api.video.update-file.accept.result',
167 handler: ({ accepted }, { videoFile }) => {
168 if (!accepted) return { accepted: false }
169 if (videoFile.filename.includes('webm')) return { accepted: false, errorMessage: 'no webm' }
170
171 return { accepted: true }
172 }
173 })
174
175 registerHook({
164 target: 'filter:api.video.pre-import-url.accept.result', 176 target: 'filter:api.video.pre-import-url.accept.result',
165 handler: ({ accepted }, { videoImportBody }) => { 177 handler: ({ accepted }, { videoImportBody }) => {
166 if (!accepted) return { accepted: false } 178 if (!accepted) return { accepted: false }