]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/plugins/plugin-helpers.ts
Clearer live session
[github/Chocobozzz/PeerTube.git] / server / tests / plugins / plugin-helpers.ts
index 26f66b0b13958f5947fd2927dde2a10511067240..5e8d08dff7154b43b88098ed89e251cfa12e7a32 100644 (file)
@@ -3,8 +3,8 @@
 import 'mocha'
 import { expect } from 'chai'
 import { pathExists } from 'fs-extra'
+import { HttpStatusCode, ThumbnailType } from '@shared/models'
 import {
-  checkVideoFilesWereRemoved,
   cleanupTests,
   createMultipleServers,
   doubleFollow,
@@ -15,8 +15,8 @@ import {
   PluginsCommand,
   setAccessTokensToServers,
   waitJobs
-} from '@shared/extra-utils'
-import { HttpStatusCode, ThumbnailType } from '@shared/models'
+} from '@shared/server-commands'
+import { checkVideoFilesWereRemoved } from '../shared'
 
 function postCommand (server: PeerTubeServer, command: string, bodyArg?: object) {
   const body = { command }
@@ -224,6 +224,7 @@ describe('Test plugin helpers', function () {
 
   describe('Videos', function () {
     let videoUUID: string
+    let videoPath: string
 
     before(async () => {
       this.timeout(240000)
@@ -260,6 +261,8 @@ describe('Test plugin helpers', function () {
             await makeRawRequest(file.url, HttpStatusCode.OK_200)
           }
         }
+
+        videoPath = body.webtorrent.videoFiles[0].path
       }
 
       // Thumbnails check
@@ -278,13 +281,27 @@ describe('Test plugin helpers', function () {
       }
     })
 
+    it('Should probe a file', async function () {
+      const { body } = await makeGetRequest({
+        url: servers[0].url,
+        path: '/plugins/test-four/router/ffprobe',
+        query: {
+          path: videoPath
+        },
+        expectedStatus: HttpStatusCode.OK_200
+      })
+
+      expect(body.streams).to.be.an('array')
+      expect(body.streams).to.have.lengthOf(2)
+    })
+
     it('Should remove a video after a view', async function () {
       this.timeout(40000)
 
       // Should not throw -> video exists
       const video = await servers[0].videos.get({ id: videoUUID })
       // Should delete the video
-      await servers[0].videos.view({ id: videoUUID })
+      await servers[0].views.simulateView({ id: videoUUID })
 
       await servers[0].servers.waitUntilLog('Video deleted by plugin four.')