import 'mocha'
import { expect } from 'chai'
import { pathExists } from 'fs-extra'
+import { HttpStatusCode, ThumbnailType } from '@shared/models'
import {
- checkVideoFilesWereRemoved,
cleanupTests,
createMultipleServers,
doubleFollow,
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 }
describe('Videos', function () {
let videoUUID: string
+ let videoPath: string
before(async () => {
this.timeout(240000)
await makeRawRequest(file.url, HttpStatusCode.OK_200)
}
}
+
+ videoPath = body.webtorrent.videoFiles[0].path
}
// Thumbnails check
}
})
+ 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.')