aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/fixtures
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/fixtures
parent7a9e420a02434e4f16c99e7d58da9075dff25d15 (diff)
downloadPeerTube-22df69fdecf299c8be6acaa25f086249ea9a0085.tar.gz
PeerTube-22df69fdecf299c8be6acaa25f086249ea9a0085.tar.zst
PeerTube-22df69fdecf299c8be6acaa25f086249ea9a0085.zip
Add job queue hooks
Diffstat (limited to 'server/tests/fixtures')
-rw-r--r--server/tests/fixtures/peertube-plugin-test-four/main.js10
-rw-r--r--server/tests/fixtures/peertube-plugin-test/main.js26
2 files changed, 35 insertions, 1 deletions
diff --git a/server/tests/fixtures/peertube-plugin-test-four/main.js b/server/tests/fixtures/peertube-plugin-test-four/main.js
index bff42ff40..5194e3e02 100644
--- a/server/tests/fixtures/peertube-plugin-test-four/main.js
+++ b/server/tests/fixtures/peertube-plugin-test-four/main.js
@@ -88,6 +88,15 @@ async function register ({
88 return res.json({ routerRoute }) 88 return res.json({ routerRoute })
89 }) 89 })
90 90
91 router.get('/user/:id', async (req, res) => {
92 const user = await peertubeHelpers.user.loadById(req.params.id)
93 if (!user) return res.status(404).end()
94
95 return res.json({
96 username: user.username
97 })
98 })
99
91 router.get('/user', async (req, res) => { 100 router.get('/user', async (req, res) => {
92 const user = await peertubeHelpers.user.getAuthUser(res) 101 const user = await peertubeHelpers.user.getAuthUser(res)
93 if (!user) return res.sendStatus(404) 102 if (!user) return res.sendStatus(404)
@@ -97,6 +106,7 @@ async function register ({
97 const isUser = user.role === 2 106 const isUser = user.role === 2
98 107
99 return res.json({ 108 return res.json({
109 id: user.id,
100 username: user.username, 110 username: user.username,
101 displayName: user.Account.name, 111 displayName: user.Account.name,
102 isAdmin, 112 isAdmin,
diff --git a/server/tests/fixtures/peertube-plugin-test/main.js b/server/tests/fixtures/peertube-plugin-test/main.js
index 2f3809215..f62f6a435 100644
--- a/server/tests/fixtures/peertube-plugin-test/main.js
+++ b/server/tests/fixtures/peertube-plugin-test/main.js
@@ -253,6 +253,27 @@ async function register ({ registerHook, registerSetting, settingsManager, stora
253 } 253 }
254 }) 254 })
255 255
256 registerHook({
257 target: 'filter:job-queue.process.params',
258 handler: (object, context) => {
259 peertubeHelpers.logger.debug('TOTO.', { object, context })
260
261 if (context.type !== 'video-studio-edition') return object
262
263 object.data.tasks = [
264 {
265 name: 'cut',
266 options: {
267 start: 0,
268 end: 1
269 }
270 }
271 ]
272
273 return object
274 }
275 })
276
256 // Upload/import/live attributes 277 // Upload/import/live attributes
257 for (const target of [ 278 for (const target of [
258 'filter:api.video.upload.video-attribute.result', 279 'filter:api.video.upload.video-attribute.result',
@@ -284,7 +305,10 @@ async function register ({ registerHook, registerSetting, settingsManager, stora
284 'filter:api.search.video-playlists.index.list.result', 305 'filter:api.search.video-playlists.index.list.result',
285 306
286 'filter:api.overviews.videos.list.params', 307 'filter:api.overviews.videos.list.params',
287 'filter:api.overviews.videos.list.result' 308 'filter:api.overviews.videos.list.result',
309
310 'filter:job-queue.process.params',
311 'filter:job-queue.process.result'
288 ] 312 ]
289 313
290 for (const h of filterHooks) { 314 for (const h of filterHooks) {