aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-12-16 17:00:46 +0100
committerChocobozzz <me@florianbigard.com>2021-12-16 17:00:46 +0100
commit754c52b9b998a825fd830d5ac527a67e0eefeb9a (patch)
tree05c914b34bdc3524ad74a5cb86a834d86663d8be /server/tests
parent2e9c7877eb3a3c5d64cc5c3383f0a7c0b51f5481 (diff)
downloadPeerTube-754c52b9b998a825fd830d5ac527a67e0eefeb9a.tar.gz
PeerTube-754c52b9b998a825fd830d5ac527a67e0eefeb9a.tar.zst
PeerTube-754c52b9b998a825fd830d5ac527a67e0eefeb9a.zip
Add ffprobe helper
Diffstat (limited to 'server/tests')
-rw-r--r--server/tests/fixtures/peertube-plugin-test-four/main.js7
-rw-r--r--server/tests/plugins/plugin-helpers.ts17
2 files changed, 24 insertions, 0 deletions
diff --git a/server/tests/fixtures/peertube-plugin-test-four/main.js b/server/tests/fixtures/peertube-plugin-test-four/main.js
index edbb883e2..bff42ff40 100644
--- a/server/tests/fixtures/peertube-plugin-test-four/main.js
+++ b/server/tests/fixtures/peertube-plugin-test-four/main.js
@@ -111,6 +111,13 @@ async function register ({
111 111
112 return res.json(details) 112 return res.json(details)
113 }) 113 })
114
115 router.get('/ffprobe', async (req, res) => {
116 const result = await peertubeHelpers.videos.ffprobe(req.query.path)
117 if (!result) return res.sendStatus(404)
118
119 return res.json(result)
120 })
114 } 121 }
115 122
116} 123}
diff --git a/server/tests/plugins/plugin-helpers.ts b/server/tests/plugins/plugin-helpers.ts
index 26f66b0b1..da84658bb 100644
--- a/server/tests/plugins/plugin-helpers.ts
+++ b/server/tests/plugins/plugin-helpers.ts
@@ -224,6 +224,7 @@ describe('Test plugin helpers', function () {
224 224
225 describe('Videos', function () { 225 describe('Videos', function () {
226 let videoUUID: string 226 let videoUUID: string
227 let videoPath: string
227 228
228 before(async () => { 229 before(async () => {
229 this.timeout(240000) 230 this.timeout(240000)
@@ -260,6 +261,8 @@ describe('Test plugin helpers', function () {
260 await makeRawRequest(file.url, HttpStatusCode.OK_200) 261 await makeRawRequest(file.url, HttpStatusCode.OK_200)
261 } 262 }
262 } 263 }
264
265 videoPath = body.webtorrent.videoFiles[0].path
263 } 266 }
264 267
265 // Thumbnails check 268 // Thumbnails check
@@ -278,6 +281,20 @@ describe('Test plugin helpers', function () {
278 } 281 }
279 }) 282 })
280 283
284 it('Should probe a file', async function () {
285 const { body } = await makeGetRequest({
286 url: servers[0].url,
287 path: '/plugins/test-four/router/ffprobe',
288 query: {
289 path: videoPath
290 },
291 expectedStatus: HttpStatusCode.OK_200
292 })
293
294 expect(body.streams).to.be.an('array')
295 expect(body.streams).to.have.lengthOf(2)
296 })
297
281 it('Should remove a video after a view', async function () { 298 it('Should remove a video after a view', async function () {
282 this.timeout(40000) 299 this.timeout(40000)
283 300