import 'mocha'
import * as chai from 'chai'
-import * as request from 'supertest'
+import request from 'supertest'
import {
buildAbsoluteFixturePath,
checkTmpIsEmpty,
dateIsValid,
doubleFollow,
PeerTubeServer,
+ saveVideoInServers,
setAccessTokensToServers,
testImage,
wait,
describe('It should list local videos', function () {
it('Should list only local videos on server 1', async function () {
- const { data, total } = await servers[0].videos.list({ filter: 'local' })
+ const { data, total } = await servers[0].videos.list({ isLocal: true })
expect(total).to.equal(1)
expect(data).to.be.an('array')
})
it('Should list only local videos on server 2', async function () {
- const { data, total } = await servers[1].videos.list({ filter: 'local' })
+ const { data, total } = await servers[1].videos.list({ isLocal: true })
expect(total).to.equal(1)
expect(data).to.be.an('array')
})
it('Should list only local videos on server 3', async function () {
- const { data, total } = await servers[2].videos.list({ filter: 'local' })
+ const { data, total } = await servers[2].videos.list({ isLocal: true })
expect(total).to.equal(2)
expect(data).to.be.an('array')
}
})
- it('Should remove the videos 3 and 3-2 by asking server 3', async function () {
- this.timeout(10000)
+ it('Should remove the videos 3 and 3-2 by asking server 3 and correctly delete files', async function () {
+ this.timeout(30000)
- await servers[2].videos.remove({ id: toRemove[0].id })
- await servers[2].videos.remove({ id: toRemove[1].id })
+ for (const id of [ toRemove[0].id, toRemove[1].id ]) {
+ await saveVideoInServers(servers, id)
- await waitJobs(servers)
- })
+ await servers[2].videos.remove({ id })
- it('Should not have files of videos 3 and 3-2 on each server', async function () {
- for (const server of servers) {
- await checkVideoFilesWereRemoved(toRemove[0].uuid, server)
- await checkVideoFilesWereRemoved(toRemove[1].uuid, server)
+ await waitJobs(servers)
+
+ for (const server of servers) {
+ await checkVideoFilesWereRemoved({ server, video: server.store.videoDetails })
+ }
}
})