PeerTube/server/tests/api/videos/multiple-servers.ts

1091 lines
36 KiB
TypeScript
Raw Normal View History

2020-01-31 09:56:52 -06:00
/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
2017-09-04 14:21:47 -05:00
2017-12-27 13:03:37 -06:00
import 'mocha'
2021-05-11 04:27:40 -05:00
import * as chai from 'chai'
2021-08-27 07:32:44 -05:00
import request from 'supertest'
2017-09-04 14:21:47 -05:00
import {
2018-12-11 02:16:41 -06:00
checkTmpIsEmpty,
checkVideoFilesWereRemoved,
completeVideoCheck,
dateIsValid,
saveVideoInServers,
testImage
} from '@server/tests/shared'
import { buildAbsoluteFixturePath, wait } from '@shared/core-utils'
import { HttpStatusCode, VideoCommentThreadTree, VideoPrivacy } from '@shared/models'
import {
cleanupTests,
2021-07-16 07:27:30 -05:00
createMultipleServers,
2018-03-12 05:06:15 -05:00
doubleFollow,
2021-07-16 02:47:51 -05:00
PeerTubeServer,
2018-03-12 05:06:15 -05:00
setAccessTokensToServers,
setDefaultAccountAvatar,
setDefaultChannelAvatar,
2021-07-09 07:15:11 -05:00
waitJobs,
2018-03-12 05:06:15 -05:00
webtorrentAdd
} from '@shared/server-commands'
2017-09-04 14:21:47 -05:00
const expect = chai.expect
2017-11-17 08:20:42 -06:00
describe('Test multiple servers', function () {
2021-07-16 02:47:51 -05:00
let servers: PeerTubeServer[] = []
2017-09-04 14:21:47 -05:00
const toRemove = []
let videoUUID = ''
2017-10-24 12:41:30 -05:00
let videoChannelId: number
2017-09-04 14:21:47 -05:00
before(async function () {
this.timeout(120000)
2021-07-16 02:47:51 -05:00
servers = await createMultipleServers(3)
2017-09-04 14:21:47 -05:00
// Get the access tokens
await setAccessTokensToServers(servers)
2018-04-24 10:05:32 -05:00
{
const videoChannel = {
2018-08-17 08:45:42 -05:00
name: 'super_channel_name',
2018-04-26 09:11:38 -05:00
displayName: 'my channel',
2018-04-24 10:05:32 -05:00
description: 'super channel'
}
2021-07-16 02:04:35 -05:00
await servers[0].channels.create({ attributes: videoChannel })
await setDefaultChannelAvatar(servers[0], videoChannel.name)
await setDefaultAccountAvatar(servers)
2021-07-16 02:04:35 -05:00
const { data } = await servers[0].channels.list({ start: 0, count: 1 })
2021-07-09 04:21:30 -05:00
videoChannelId = data[0].id
2017-10-24 12:41:30 -05:00
}
2017-11-17 08:20:42 -06:00
// Server 1 and server 2 follow each other
await doubleFollow(servers[0], servers[1])
// Server 1 and server 3 follow each other
await doubleFollow(servers[0], servers[2])
// Server 2 and server 3 follow each other
await doubleFollow(servers[1], servers[2])
2017-09-04 14:21:47 -05:00
})
2017-11-17 08:20:42 -06:00
it('Should not have videos for all servers', async function () {
2017-09-04 14:21:47 -05:00
for (const server of servers) {
2021-07-16 02:04:35 -05:00
const { data } = await server.videos.list()
2021-07-15 03:02:54 -05:00
expect(data).to.be.an('array')
expect(data.length).to.equal(0)
2017-09-04 14:21:47 -05:00
}
})
2017-11-17 08:20:42 -06:00
describe('Should upload the video and propagate on each server', function () {
it('Should upload the video on server 1 and propagate on each server', async function () {
2017-11-24 07:39:14 -06:00
this.timeout(25000)
2017-09-04 14:21:47 -05:00
2021-07-15 03:02:54 -05:00
const attributes = {
2017-11-17 08:20:42 -06:00
name: 'my super name for server 1',
2017-09-04 14:21:47 -05:00
category: 5,
licence: 4,
2018-04-23 07:39:52 -05:00
language: 'ja',
2017-09-04 14:21:47 -05:00
nsfw: true,
2017-11-17 08:20:42 -06:00
description: 'my super description for server 1',
support: 'my super support text for server 1',
2019-02-11 07:41:55 -06:00
originallyPublishedAt: '2019-02-10T13:38:14.449Z',
2017-09-04 14:21:47 -05:00
tags: [ 'tag1p1', 'tag2p1' ],
2017-10-24 12:41:30 -05:00
channelId: videoChannelId,
2017-09-04 14:21:47 -05:00
fixture: 'video_short1.webm'
}
2021-07-16 02:04:35 -05:00
await servers[0].videos.upload({ attributes })
2017-09-04 14:21:47 -05:00
await waitJobs(servers)
2017-09-04 14:21:47 -05:00
2017-11-17 08:20:42 -06:00
// All servers should have this video
let publishedAt: string = null
2017-09-04 14:21:47 -05:00
for (const server of servers) {
2019-04-26 01:50:52 -05:00
const isLocal = server.port === servers[0].port
2017-12-29 04:51:55 -06:00
const checkAttributes = {
name: 'my super name for server 1',
category: 5,
licence: 4,
2018-04-23 07:39:52 -05:00
language: 'ja',
2017-12-29 04:51:55 -06:00
nsfw: true,
description: 'my super description for server 1',
support: 'my super support text for server 1',
2019-02-11 07:41:55 -06:00
originallyPublishedAt: '2019-02-10T13:38:14.449Z',
2018-03-12 05:06:15 -05:00
account: {
name: 'root',
host: 'localhost:' + servers[0].port
2018-03-12 05:06:15 -05:00
},
2017-12-29 04:51:55 -06:00
isLocal,
publishedAt,
2017-12-29 04:51:55 -06:00
duration: 10,
tags: [ 'tag1p1', 'tag2p1' ],
privacy: VideoPrivacy.PUBLIC,
2018-01-03 03:12:36 -06:00
commentsEnabled: true,
downloadEnabled: true,
2017-12-29 04:51:55 -06:00
channel: {
displayName: 'my channel',
name: 'super_channel_name',
2017-12-29 04:51:55 -06:00
description: 'super channel',
isLocal
},
2017-12-29 07:32:51 -06:00
fixture: 'video_short1.webm',
2017-12-29 04:51:55 -06:00
files: [
{
resolution: 720,
size: 572456
}
]
}
2017-09-04 14:21:47 -05:00
2021-07-16 02:04:35 -05:00
const { data } = await server.videos.list()
2021-07-15 03:02:54 -05:00
expect(data).to.be.an('array')
expect(data.length).to.equal(1)
const video = data[0]
2017-09-04 14:21:47 -05:00
2021-07-15 03:02:54 -05:00
await completeVideoCheck(server, video, checkAttributes)
publishedAt = video.publishedAt as string
2017-09-04 14:21:47 -05:00
}
})
2017-11-17 08:20:42 -06:00
it('Should upload the video on server 2 and propagate on each server', async function () {
2020-11-16 04:55:17 -06:00
this.timeout(100000)
2017-09-04 14:21:47 -05:00
2017-10-24 12:41:30 -05:00
const user = {
username: 'user1',
password: 'super_password'
}
2021-07-16 02:04:35 -05:00
await servers[1].users.create({ username: user.username, password: user.password })
const userAccessToken = await servers[1].login.getAccessToken(user)
2017-10-24 12:41:30 -05:00
2021-07-15 03:02:54 -05:00
const attributes = {
2017-11-17 08:20:42 -06:00
name: 'my super name for server 2',
2017-09-04 14:21:47 -05:00
category: 4,
licence: 3,
2018-04-23 07:39:52 -05:00
language: 'de',
2017-09-04 14:21:47 -05:00
nsfw: true,
2017-11-17 08:20:42 -06:00
description: 'my super description for server 2',
support: 'my super support text for server 2',
2017-09-04 14:21:47 -05:00
tags: [ 'tag1p2', 'tag2p2', 'tag3p2' ],
fixture: 'video_short2.webm',
thumbnailfile: 'thumbnail.jpg',
previewfile: 'preview.jpg'
2017-09-04 14:21:47 -05:00
}
2021-07-16 02:04:35 -05:00
await servers[1].videos.upload({ token: userAccessToken, attributes, mode: 'resumable' })
2017-09-04 14:21:47 -05:00
// Transcoding
await waitJobs(servers)
2017-09-04 14:21:47 -05:00
2017-11-17 08:20:42 -06:00
// All servers should have this video
2017-09-04 14:21:47 -05:00
for (const server of servers) {
const isLocal = server.url === 'http://localhost:' + servers[1].port
2017-12-29 04:51:55 -06:00
const checkAttributes = {
name: 'my super name for server 2',
category: 4,
licence: 3,
2018-04-23 07:39:52 -05:00
language: 'de',
2017-12-29 04:51:55 -06:00
nsfw: true,
description: 'my super description for server 2',
support: 'my super support text for server 2',
2018-03-12 05:06:15 -05:00
account: {
name: 'user1',
host: 'localhost:' + servers[1].port
2018-03-12 05:06:15 -05:00
},
2017-12-29 04:51:55 -06:00
isLocal,
2018-01-03 03:12:36 -06:00
commentsEnabled: true,
downloadEnabled: true,
2017-12-29 04:51:55 -06:00
duration: 5,
tags: [ 'tag1p2', 'tag2p2', 'tag3p2' ],
privacy: VideoPrivacy.PUBLIC,
channel: {
displayName: 'Main user1 channel',
name: 'user1_channel',
2017-12-29 04:51:55 -06:00
description: 'super channel',
isLocal
},
fixture: 'video_short2.webm',
files: [
{
resolution: 240,
2020-11-24 09:24:50 -06:00
size: 270000
2017-12-29 04:51:55 -06:00
},
{
resolution: 360,
2020-11-24 09:24:50 -06:00
size: 359000
2017-12-29 04:51:55 -06:00
},
{
resolution: 480,
2020-11-24 09:24:50 -06:00
size: 465000
2017-12-29 04:51:55 -06:00
},
{
resolution: 720,
size: 750000
2017-12-29 04:51:55 -06:00
}
],
thumbnailfile: 'thumbnail',
previewfile: 'preview'
2017-12-29 04:51:55 -06:00
}
2017-09-04 14:21:47 -05:00
2021-07-16 02:04:35 -05:00
const { data } = await server.videos.list()
2021-07-15 03:02:54 -05:00
expect(data).to.be.an('array')
expect(data.length).to.equal(2)
const video = data[1]
2017-09-04 14:21:47 -05:00
2021-07-15 03:02:54 -05:00
await completeVideoCheck(server, video, checkAttributes)
2017-09-04 14:21:47 -05:00
}
})
2017-11-17 08:20:42 -06:00
it('Should upload two videos on server 3 and propagate on each server', async function () {
2017-09-04 14:21:47 -05:00
this.timeout(45000)
2021-07-15 03:02:54 -05:00
{
const attributes = {
name: 'my super name for server 3',
category: 6,
licence: 5,
language: 'de',
nsfw: true,
description: 'my super description for server 3',
support: 'my super support text for server 3',
tags: [ 'tag1p3' ],
fixture: 'video_short3.webm'
}
2021-07-16 02:04:35 -05:00
await servers[2].videos.upload({ attributes })
2017-09-04 14:21:47 -05:00
}
2021-07-15 03:02:54 -05:00
{
const attributes = {
name: 'my super name for server 3-2',
category: 7,
licence: 6,
language: 'ko',
nsfw: false,
description: 'my super description for server 3-2',
support: 'my super support text for server 3-2',
tags: [ 'tag2p3', 'tag3p3', 'tag4p3' ],
fixture: 'video_short.webm'
}
2021-07-16 02:04:35 -05:00
await servers[2].videos.upload({ attributes })
2017-09-04 14:21:47 -05:00
}
await waitJobs(servers)
2017-09-04 14:21:47 -05:00
2017-11-17 08:20:42 -06:00
// All servers should have this video
2017-09-04 14:21:47 -05:00
for (const server of servers) {
const isLocal = server.url === 'http://localhost:' + servers[2].port
2021-07-16 02:04:35 -05:00
const { data } = await server.videos.list()
2017-09-04 14:21:47 -05:00
2021-07-15 03:02:54 -05:00
expect(data).to.be.an('array')
expect(data.length).to.equal(4)
2017-09-04 14:21:47 -05:00
// We not sure about the order of the two last uploads
let video1 = null
let video2 = null
2021-07-15 03:02:54 -05:00
if (data[2].name === 'my super name for server 3') {
video1 = data[2]
video2 = data[3]
2017-09-04 14:21:47 -05:00
} else {
2021-07-15 03:02:54 -05:00
video1 = data[3]
video2 = data[2]
2017-09-04 14:21:47 -05:00
}
2017-12-29 04:51:55 -06:00
const checkAttributesVideo1 = {
name: 'my super name for server 3',
category: 6,
licence: 5,
2018-04-23 07:39:52 -05:00
language: 'de',
2017-12-29 04:51:55 -06:00
nsfw: true,
description: 'my super description for server 3',
support: 'my super support text for server 3',
2018-03-12 05:06:15 -05:00
account: {
name: 'root',
host: 'localhost:' + servers[2].port
2018-03-12 05:06:15 -05:00
},
2017-12-29 04:51:55 -06:00
isLocal,
duration: 5,
2018-01-03 03:12:36 -06:00
commentsEnabled: true,
downloadEnabled: true,
2017-12-29 04:51:55 -06:00
tags: [ 'tag1p3' ],
privacy: VideoPrivacy.PUBLIC,
channel: {
displayName: 'Main root channel',
name: 'root_channel',
2017-12-29 04:51:55 -06:00
description: '',
isLocal
},
fixture: 'video_short3.webm',
files: [
{
resolution: 720,
size: 292677
}
]
2017-09-04 14:21:47 -05:00
}
2021-07-15 03:02:54 -05:00
await completeVideoCheck(server, video1, checkAttributesVideo1)
2017-12-29 04:51:55 -06:00
const checkAttributesVideo2 = {
name: 'my super name for server 3-2',
category: 7,
licence: 6,
2018-04-23 07:39:52 -05:00
language: 'ko',
2017-12-29 04:51:55 -06:00
nsfw: false,
description: 'my super description for server 3-2',
support: 'my super support text for server 3-2',
2018-03-12 05:06:15 -05:00
account: {
name: 'root',
host: 'localhost:' + servers[2].port
2018-03-12 05:06:15 -05:00
},
2018-01-03 03:12:36 -06:00
commentsEnabled: true,
downloadEnabled: true,
2017-12-29 04:51:55 -06:00
isLocal,
duration: 5,
tags: [ 'tag2p3', 'tag3p3', 'tag4p3' ],
privacy: VideoPrivacy.PUBLIC,
channel: {
displayName: 'Main root channel',
name: 'root_channel',
2017-12-29 04:51:55 -06:00
description: '',
isLocal
},
2017-12-29 07:32:51 -06:00
fixture: 'video_short.webm',
2017-12-29 04:51:55 -06:00
files: [
{
resolution: 720,
size: 218910
}
]
2017-09-04 14:21:47 -05:00
}
2021-07-15 03:02:54 -05:00
await completeVideoCheck(server, video2, checkAttributesVideo2)
2017-09-04 14:21:47 -05:00
}
})
})
2018-03-13 04:24:28 -05:00
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({ isLocal: true })
2018-03-13 04:24:28 -05:00
2021-07-15 03:02:54 -05:00
expect(total).to.equal(1)
expect(data).to.be.an('array')
expect(data.length).to.equal(1)
expect(data[0].name).to.equal('my super name for server 1')
2018-03-13 04:24:28 -05:00
})
it('Should list only local videos on server 2', async function () {
const { data, total } = await servers[1].videos.list({ isLocal: true })
2018-03-13 04:24:28 -05:00
2021-07-15 03:02:54 -05:00
expect(total).to.equal(1)
expect(data).to.be.an('array')
expect(data.length).to.equal(1)
expect(data[0].name).to.equal('my super name for server 2')
2018-03-13 04:24:28 -05:00
})
it('Should list only local videos on server 3', async function () {
const { data, total } = await servers[2].videos.list({ isLocal: true })
2018-03-13 04:24:28 -05:00
2021-07-15 03:02:54 -05:00
expect(total).to.equal(2)
expect(data).to.be.an('array')
expect(data.length).to.equal(2)
expect(data[0].name).to.equal('my super name for server 3')
expect(data[1].name).to.equal('my super name for server 3-2')
2018-03-13 04:24:28 -05:00
})
})
2017-09-04 14:21:47 -05:00
describe('Should seed the uploaded video', function () {
2017-11-17 08:20:42 -06:00
it('Should add the file 1 by asking server 3', async function () {
2022-01-03 04:01:39 -06:00
this.timeout(30000)
2017-09-04 14:21:47 -05:00
2021-07-16 02:04:35 -05:00
const { data } = await servers[2].videos.list()
2017-09-04 14:21:47 -05:00
2021-07-15 03:02:54 -05:00
const video = data[0]
toRemove.push(data[2])
toRemove.push(data[3])
2017-10-24 12:41:30 -05:00
2021-07-16 02:04:35 -05:00
const videoDetails = await servers[2].videos.get({ id: video.id })
2017-12-29 04:51:55 -06:00
const torrent = await webtorrentAdd(videoDetails.files[0].magnetUri, true)
2017-09-04 14:21:47 -05:00
expect(torrent.files).to.be.an('array')
expect(torrent.files.length).to.equal(1)
expect(torrent.files[0].path).to.exist.and.to.not.equal('')
})
2017-11-17 08:20:42 -06:00
it('Should add the file 2 by asking server 1', async function () {
2022-01-03 04:01:39 -06:00
this.timeout(30000)
2017-09-04 14:21:47 -05:00
2021-07-16 02:04:35 -05:00
const { data } = await servers[0].videos.list()
2017-09-04 14:21:47 -05:00
2021-07-15 03:02:54 -05:00
const video = data[1]
2021-07-16 02:04:35 -05:00
const videoDetails = await servers[0].videos.get({ id: video.id })
2017-09-04 14:21:47 -05:00
2017-12-29 04:51:55 -06:00
const torrent = await webtorrentAdd(videoDetails.files[0].magnetUri, true)
2017-09-04 14:21:47 -05:00
expect(torrent.files).to.be.an('array')
expect(torrent.files.length).to.equal(1)
expect(torrent.files[0].path).to.exist.and.to.not.equal('')
})
2017-11-17 08:20:42 -06:00
it('Should add the file 3 by asking server 2', async function () {
2022-01-03 04:01:39 -06:00
this.timeout(30000)
2017-09-04 14:21:47 -05:00
2021-07-16 02:04:35 -05:00
const { data } = await servers[1].videos.list()
2017-09-04 14:21:47 -05:00
2021-07-15 03:02:54 -05:00
const video = data[2]
2021-07-16 02:04:35 -05:00
const videoDetails = await servers[1].videos.get({ id: video.id })
2017-09-04 14:21:47 -05:00
2017-12-29 04:51:55 -06:00
const torrent = await webtorrentAdd(videoDetails.files[0].magnetUri, true)
2017-09-04 14:21:47 -05:00
expect(torrent.files).to.be.an('array')
expect(torrent.files.length).to.equal(1)
expect(torrent.files[0].path).to.exist.and.to.not.equal('')
})
2017-11-17 08:20:42 -06:00
it('Should add the file 3-2 by asking server 1', async function () {
2022-01-03 04:01:39 -06:00
this.timeout(30000)
2017-09-04 14:21:47 -05:00
2021-07-16 02:04:35 -05:00
const { data } = await servers[0].videos.list()
2017-09-04 14:21:47 -05:00
2021-07-15 03:02:54 -05:00
const video = data[3]
2021-07-16 02:04:35 -05:00
const videoDetails = await servers[0].videos.get({ id: video.id })
2017-09-04 14:21:47 -05:00
2017-10-24 12:41:30 -05:00
const torrent = await webtorrentAdd(videoDetails.files[0].magnetUri)
2017-09-04 14:21:47 -05:00
expect(torrent.files).to.be.an('array')
expect(torrent.files.length).to.equal(1)
expect(torrent.files[0].path).to.exist.and.to.not.equal('')
})
2017-11-17 08:20:42 -06:00
it('Should add the file 2 in 360p by asking server 1', async function () {
2022-01-03 04:01:39 -06:00
this.timeout(30000)
2021-07-16 02:04:35 -05:00
const { data } = await servers[0].videos.list()
2021-07-15 03:02:54 -05:00
const video = data.find(v => v.name === 'my super name for server 2')
2021-07-16 02:04:35 -05:00
const videoDetails = await servers[0].videos.get({ id: video.id })
2017-10-24 12:41:30 -05:00
2018-03-19 06:36:41 -05:00
const file = videoDetails.files.find(f => f.resolution.id === 360)
expect(file).not.to.be.undefined
const torrent = await webtorrentAdd(file.magnetUri)
expect(torrent.files).to.be.an('array')
expect(torrent.files.length).to.equal(1)
expect(torrent.files[0].path).to.exist.and.to.not.equal('')
})
2017-09-04 14:21:47 -05:00
})
describe('Should update video views, likes and dislikes', function () {
2017-11-17 08:20:42 -06:00
let localVideosServer3 = []
let remoteVideosServer1 = []
let remoteVideosServer2 = []
let remoteVideosServer3 = []
2017-09-04 14:21:47 -05:00
before(async function () {
2021-07-15 03:02:54 -05:00
{
2021-07-16 02:04:35 -05:00
const { data } = await servers[0].videos.list()
2021-07-15 03:02:54 -05:00
remoteVideosServer1 = data.filter(video => video.isLocal === false).map(video => video.uuid)
}
2017-09-04 14:21:47 -05:00
2021-07-15 03:02:54 -05:00
{
2021-07-16 02:04:35 -05:00
const { data } = await servers[1].videos.list()
2021-07-15 03:02:54 -05:00
remoteVideosServer2 = data.filter(video => video.isLocal === false).map(video => video.uuid)
}
2017-09-04 14:21:47 -05:00
2021-07-15 03:02:54 -05:00
{
2021-07-16 02:04:35 -05:00
const { data } = await servers[2].videos.list()
2021-07-15 03:02:54 -05:00
localVideosServer3 = data.filter(video => video.isLocal === true).map(video => video.uuid)
remoteVideosServer3 = data.filter(video => video.isLocal === false).map(video => video.uuid)
}
2017-09-04 14:21:47 -05:00
})
it('Should view multiple videos on owned servers', async function () {
2018-08-29 09:26:25 -05:00
this.timeout(30000)
2017-09-04 14:21:47 -05:00
2021-07-16 02:04:35 -05:00
await servers[2].videos.view({ id: localVideosServer3[0] })
await wait(1000)
2018-02-23 09:39:51 -06:00
2021-07-16 02:04:35 -05:00
await servers[2].videos.view({ id: localVideosServer3[0] })
await servers[2].videos.view({ id: localVideosServer3[1] })
2018-02-23 09:39:51 -06:00
await wait(1000)
2018-02-23 09:39:51 -06:00
2021-07-16 02:04:35 -05:00
await servers[2].videos.view({ id: localVideosServer3[0] })
await servers[2].videos.view({ id: localVideosServer3[0] })
2017-09-04 14:21:47 -05:00
await waitJobs(servers)
2017-09-04 14:21:47 -05:00
2018-08-29 09:26:25 -05:00
// Wait the repeatable job
await wait(6000)
await waitJobs(servers)
2017-09-04 14:21:47 -05:00
for (const server of servers) {
2021-07-16 02:04:35 -05:00
const { data } = await server.videos.list()
2017-09-04 14:21:47 -05:00
2021-07-15 03:02:54 -05:00
const video0 = data.find(v => v.uuid === localVideosServer3[0])
const video1 = data.find(v => v.uuid === localVideosServer3[1])
2017-10-24 12:41:30 -05:00
2017-11-30 02:21:11 -06:00
expect(video0.views).to.equal(3)
expect(video1.views).to.equal(1)
2017-09-04 14:21:47 -05:00
}
})
it('Should view multiple videos on each servers', async function () {
2019-07-24 02:21:22 -05:00
this.timeout(45000)
2017-09-04 14:21:47 -05:00
const tasks: Promise<any>[] = []
2021-07-16 02:04:35 -05:00
tasks.push(servers[0].videos.view({ id: remoteVideosServer1[0] }))
tasks.push(servers[1].videos.view({ id: remoteVideosServer2[0] }))
tasks.push(servers[1].videos.view({ id: remoteVideosServer2[0] }))
tasks.push(servers[2].videos.view({ id: remoteVideosServer3[0] }))
tasks.push(servers[2].videos.view({ id: remoteVideosServer3[1] }))
tasks.push(servers[2].videos.view({ id: remoteVideosServer3[1] }))
tasks.push(servers[2].videos.view({ id: remoteVideosServer3[1] }))
tasks.push(servers[2].videos.view({ id: localVideosServer3[1] }))
tasks.push(servers[2].videos.view({ id: localVideosServer3[1] }))
tasks.push(servers[2].videos.view({ id: localVideosServer3[1] }))
2017-09-04 14:21:47 -05:00
await Promise.all(tasks)
await waitJobs(servers)
2017-09-04 14:21:47 -05:00
2018-08-29 09:26:25 -05:00
// Wait the repeatable job
2019-07-24 02:21:22 -05:00
await wait(16000)
2018-08-29 09:26:25 -05:00
await waitJobs(servers)
2017-09-04 14:21:47 -05:00
let baseVideos = null
for (const server of servers) {
2021-07-16 02:04:35 -05:00
const { data } = await server.videos.list()
2017-09-04 14:21:47 -05:00
// Initialize base videos for future comparisons
if (baseVideos === null) {
2021-07-15 03:02:54 -05:00
baseVideos = data
2017-11-22 11:22:06 -06:00
continue
2017-09-04 14:21:47 -05:00
}
for (const baseVideo of baseVideos) {
2021-07-15 03:02:54 -05:00
const sameVideo = data.find(video => video.name === baseVideo.name)
2017-09-04 14:21:47 -05:00
expect(baseVideo.views).to.equal(sameVideo.views)
}
}
})
it('Should like and dislikes videos on different services', async function () {
2021-04-23 01:34:17 -05:00
this.timeout(50000)
2017-09-04 14:21:47 -05:00
2021-07-16 02:04:35 -05:00
await servers[0].videos.rate({ id: remoteVideosServer1[0], rating: 'like' })
2019-03-19 10:23:02 -05:00
await wait(500)
2021-07-16 02:04:35 -05:00
await servers[0].videos.rate({ id: remoteVideosServer1[0], rating: 'dislike' })
2019-03-19 10:23:02 -05:00
await wait(500)
2021-07-16 02:04:35 -05:00
await servers[0].videos.rate({ id: remoteVideosServer1[0], rating: 'like' })
await servers[2].videos.rate({ id: localVideosServer3[1], rating: 'like' })
2019-03-19 10:23:02 -05:00
await wait(500)
2021-07-16 02:04:35 -05:00
await servers[2].videos.rate({ id: localVideosServer3[1], rating: 'dislike' })
await servers[2].videos.rate({ id: remoteVideosServer3[1], rating: 'dislike' })
2019-03-19 10:23:02 -05:00
await wait(500)
2021-07-16 02:04:35 -05:00
await servers[2].videos.rate({ id: remoteVideosServer3[0], rating: 'like' })
2017-09-04 14:21:47 -05:00
await waitJobs(servers)
2020-11-18 07:15:25 -06:00
await wait(5000)
2021-07-13 01:33:02 -05:00
await waitJobs(servers)
2017-09-04 14:21:47 -05:00
let baseVideos = null
for (const server of servers) {
2021-07-16 02:04:35 -05:00
const { data } = await server.videos.list()
2017-09-04 14:21:47 -05:00
// Initialize base videos for future comparisons
if (baseVideos === null) {
2021-07-15 03:02:54 -05:00
baseVideos = data
2017-11-22 11:22:06 -06:00
continue
2017-09-04 14:21:47 -05:00
}
2017-11-22 11:22:06 -06:00
for (const baseVideo of baseVideos) {
2021-07-15 03:02:54 -05:00
const sameVideo = data.find(video => video.name === baseVideo.name)
2017-09-04 14:21:47 -05:00
expect(baseVideo.likes).to.equal(sameVideo.likes)
expect(baseVideo.dislikes).to.equal(sameVideo.dislikes)
2017-11-22 11:22:06 -06:00
}
2017-09-04 14:21:47 -05:00
}
})
})
describe('Should manipulate these videos', function () {
2021-11-10 07:25:33 -06:00
let updatedAtMin: Date
it('Should update video 3', async function () {
2022-01-03 04:01:39 -06:00
this.timeout(30000)
2017-09-04 14:21:47 -05:00
const attributes = {
name: 'my super video updated',
category: 10,
licence: 7,
2018-04-23 07:39:52 -05:00
language: 'fr',
2017-09-04 14:21:47 -05:00
nsfw: true,
description: 'my super description updated',
support: 'my super support text updated',
tags: [ 'tag_up_1', 'tag_up_2' ],
thumbnailfile: 'thumbnail.jpg',
2019-02-11 07:41:55 -06:00
originallyPublishedAt: '2019-02-11T13:38:14.449Z',
previewfile: 'preview.jpg'
2017-09-04 14:21:47 -05:00
}
2021-11-10 07:25:33 -06:00
updatedAtMin = new Date()
2021-07-16 02:04:35 -05:00
await servers[2].videos.update({ id: toRemove[0].id, attributes })
2017-09-04 14:21:47 -05:00
await waitJobs(servers)
2017-09-04 14:21:47 -05:00
})
2017-11-17 08:20:42 -06:00
it('Should have the video 3 updated on each server', async function () {
2022-01-03 04:01:39 -06:00
this.timeout(30000)
2017-09-04 14:21:47 -05:00
for (const server of servers) {
2021-07-16 02:04:35 -05:00
const { data } = await server.videos.list()
2017-09-04 14:21:47 -05:00
2021-07-15 03:02:54 -05:00
const videoUpdated = data.find(video => video.name === 'my super video updated')
2017-09-04 14:21:47 -05:00
expect(!!videoUpdated).to.be.true
2021-11-10 07:25:33 -06:00
expect(new Date(videoUpdated.updatedAt)).to.be.greaterThan(updatedAtMin)
const isLocal = server.url === 'http://localhost:' + servers[2].port
2017-12-29 04:51:55 -06:00
const checkAttributes = {
name: 'my super video updated',
category: 10,
licence: 7,
2018-04-23 07:39:52 -05:00
language: 'fr',
2017-12-29 04:51:55 -06:00
nsfw: true,
description: 'my super description updated',
support: 'my super support text updated',
2019-02-11 07:41:55 -06:00
originallyPublishedAt: '2019-02-11T13:38:14.449Z',
2018-03-12 05:06:15 -05:00
account: {
name: 'root',
host: 'localhost:' + servers[2].port
2018-03-12 05:06:15 -05:00
},
2017-12-29 04:51:55 -06:00
isLocal,
duration: 5,
2018-01-03 03:12:36 -06:00
commentsEnabled: true,
downloadEnabled: true,
2017-12-29 04:51:55 -06:00
tags: [ 'tag_up_1', 'tag_up_2' ],
privacy: VideoPrivacy.PUBLIC,
channel: {
displayName: 'Main root channel',
name: 'root_channel',
2017-12-29 04:51:55 -06:00
description: '',
isLocal
},
fixture: 'video_short3.webm',
files: [
{
resolution: 720,
size: 292677
}
],
thumbnailfile: 'thumbnail',
previewfile: 'preview'
2017-12-29 04:51:55 -06:00
}
2021-07-15 03:02:54 -05:00
await completeVideoCheck(server, videoUpdated, checkAttributes)
2017-09-04 14:21:47 -05:00
}
})
2021-11-10 07:34:02 -06:00
it('Should only update thumbnail and update updatedAt attribute', async function () {
2022-01-03 04:01:39 -06:00
this.timeout(30000)
2021-11-10 07:34:02 -06:00
const attributes = {
thumbnailfile: 'thumbnail.jpg'
}
updatedAtMin = new Date()
await servers[2].videos.update({ id: toRemove[0].id, attributes })
await waitJobs(servers)
for (const server of servers) {
const { data } = await server.videos.list()
const videoUpdated = data.find(video => video.name === 'my super video updated')
expect(new Date(videoUpdated.updatedAt)).to.be.greaterThan(updatedAtMin)
}
})
2021-07-22 07:28:03 -05:00
it('Should remove the videos 3 and 3-2 by asking server 3 and correctly delete files', async function () {
this.timeout(30000)
2017-09-04 14:21:47 -05:00
2021-07-22 07:28:03 -05:00
for (const id of [ toRemove[0].id, toRemove[1].id ]) {
await saveVideoInServers(servers, id)
2017-09-04 14:21:47 -05:00
2021-07-22 07:28:03 -05:00
await servers[2].videos.remove({ id })
2017-09-04 14:21:47 -05:00
2021-07-22 07:28:03 -05:00
await waitJobs(servers)
for (const server of servers) {
await checkVideoFilesWereRemoved({ server, video: server.store.videoDetails })
}
}
})
2017-11-17 08:20:42 -06:00
it('Should have videos 1 and 3 on each server', async function () {
2017-09-04 14:21:47 -05:00
for (const server of servers) {
2021-07-16 02:04:35 -05:00
const { data } = await server.videos.list()
2021-07-15 03:02:54 -05:00
expect(data).to.be.an('array')
expect(data.length).to.equal(2)
expect(data[0].name).not.to.equal(data[1].name)
expect(data[0].name).not.to.equal(toRemove[0].name)
expect(data[1].name).not.to.equal(toRemove[0].name)
expect(data[0].name).not.to.equal(toRemove[1].name)
expect(data[1].name).not.to.equal(toRemove[1].name)
videoUUID = data.find(video => video.name === 'my super name for server 1').uuid
2017-09-04 14:21:47 -05:00
}
})
2017-11-17 08:20:42 -06:00
it('Should get the same video by UUID on each server', async function () {
2017-09-04 14:21:47 -05:00
let baseVideo = null
for (const server of servers) {
2021-07-16 02:04:35 -05:00
const video = await server.videos.get({ id: videoUUID })
2017-09-04 14:21:47 -05:00
if (baseVideo === null) {
baseVideo = video
2017-11-22 11:22:06 -06:00
continue
2017-09-04 14:21:47 -05:00
}
expect(baseVideo.name).to.equal(video.name)
expect(baseVideo.uuid).to.equal(video.uuid)
2018-03-19 06:36:41 -05:00
expect(baseVideo.category.id).to.equal(video.category.id)
expect(baseVideo.language.id).to.equal(video.language.id)
expect(baseVideo.licence.id).to.equal(video.licence.id)
2017-09-04 14:21:47 -05:00
expect(baseVideo.nsfw).to.equal(video.nsfw)
2018-03-12 05:06:15 -05:00
expect(baseVideo.account.name).to.equal(video.account.name)
expect(baseVideo.account.displayName).to.equal(video.account.displayName)
expect(baseVideo.account.url).to.equal(video.account.url)
expect(baseVideo.account.host).to.equal(video.account.host)
2017-09-04 14:21:47 -05:00
expect(baseVideo.tags).to.deep.equal(video.tags)
}
})
2017-11-17 08:20:42 -06:00
it('Should get the preview from each server', async function () {
2017-09-04 14:21:47 -05:00
for (const server of servers) {
2021-07-16 02:04:35 -05:00
const video = await server.videos.get({ id: videoUUID })
2017-09-04 14:21:47 -05:00
2018-02-14 11:21:14 -06:00
await testImage(server.url, 'video_short1-preview.webm', video.previewPath)
2017-09-04 14:21:47 -05:00
}
})
})
2017-12-27 13:03:37 -06:00
describe('Should comment these videos', function () {
2018-03-27 03:26:52 -05:00
let childOfFirstChild: VideoCommentThreadTree
2017-12-27 13:03:37 -06:00
it('Should add comment (threads and replies)', async function () {
this.timeout(25000)
{
const text = 'my super first comment'
2021-07-16 02:04:35 -05:00
await servers[0].comments.createThread({ videoId: videoUUID, text })
2017-12-27 13:03:37 -06:00
}
{
const text = 'my super second comment'
2021-07-16 02:04:35 -05:00
await servers[2].comments.createThread({ videoId: videoUUID, text })
2017-12-27 13:03:37 -06:00
}
await waitJobs(servers)
2017-12-27 13:03:37 -06:00
{
2021-07-16 02:04:35 -05:00
const threadId = await servers[1].comments.findCommentId({ videoId: videoUUID, text: 'my super first comment' })
2017-12-27 13:03:37 -06:00
const text = 'my super answer to thread 1'
2021-07-16 02:04:35 -05:00
await servers[1].comments.addReply({ videoId: videoUUID, toCommentId: threadId, text })
2017-12-27 13:03:37 -06:00
}
await waitJobs(servers)
2017-12-27 13:03:37 -06:00
{
2021-07-16 02:04:35 -05:00
const threadId = await servers[2].comments.findCommentId({ videoId: videoUUID, text: 'my super first comment' })
2017-12-27 13:03:37 -06:00
2021-07-16 02:04:35 -05:00
const body = await servers[2].comments.getThread({ videoId: videoUUID, threadId })
2021-07-09 07:15:11 -05:00
const childCommentId = body.children[0].comment.id
2017-12-27 13:03:37 -06:00
const text3 = 'my second answer to thread 1'
2021-07-16 02:04:35 -05:00
await servers[2].comments.addReply({ videoId: videoUUID, toCommentId: threadId, text: text3 })
2017-12-27 13:03:37 -06:00
const text2 = 'my super answer to answer of thread 1'
2021-07-16 02:04:35 -05:00
await servers[2].comments.addReply({ videoId: videoUUID, toCommentId: childCommentId, text: text2 })
2017-12-27 13:03:37 -06:00
}
await waitJobs(servers)
2017-12-27 13:03:37 -06:00
})
it('Should have these threads', async function () {
for (const server of servers) {
2021-07-16 02:04:35 -05:00
const body = await server.comments.listThreads({ videoId: videoUUID })
2017-12-27 13:03:37 -06:00
2021-07-09 07:15:11 -05:00
expect(body.total).to.equal(2)
expect(body.data).to.be.an('array')
expect(body.data).to.have.lengthOf(2)
2017-12-27 13:03:37 -06:00
{
2021-07-09 07:15:11 -05:00
const comment = body.data.find(c => c.text === 'my super first comment')
2017-12-27 13:03:37 -06:00
expect(comment).to.not.be.undefined
expect(comment.inReplyToCommentId).to.be.null
expect(comment.account.name).to.equal('root')
expect(comment.account.host).to.equal('localhost:' + servers[0].port)
2017-12-27 13:03:37 -06:00
expect(comment.totalReplies).to.equal(3)
expect(dateIsValid(comment.createdAt as string)).to.be.true
expect(dateIsValid(comment.updatedAt as string)).to.be.true
}
{
2021-07-09 07:15:11 -05:00
const comment = body.data.find(c => c.text === 'my super second comment')
2017-12-27 13:03:37 -06:00
expect(comment).to.not.be.undefined
expect(comment.inReplyToCommentId).to.be.null
expect(comment.account.name).to.equal('root')
expect(comment.account.host).to.equal('localhost:' + servers[2].port)
2017-12-27 13:03:37 -06:00
expect(comment.totalReplies).to.equal(0)
expect(dateIsValid(comment.createdAt as string)).to.be.true
expect(dateIsValid(comment.updatedAt as string)).to.be.true
}
}
})
it('Should have these comments', async function () {
for (const server of servers) {
2021-07-16 02:04:35 -05:00
const body = await server.comments.listThreads({ videoId: videoUUID })
2021-07-09 07:15:11 -05:00
const threadId = body.data.find(c => c.text === 'my super first comment').id
2017-12-27 13:03:37 -06:00
2021-07-16 02:04:35 -05:00
const tree = await server.comments.getThread({ videoId: videoUUID, threadId })
2017-12-27 13:03:37 -06:00
expect(tree.comment.text).equal('my super first comment')
expect(tree.comment.account.name).equal('root')
expect(tree.comment.account.host).equal('localhost:' + servers[0].port)
2017-12-27 13:03:37 -06:00
expect(tree.children).to.have.lengthOf(2)
const firstChild = tree.children[0]
expect(firstChild.comment.text).to.equal('my super answer to thread 1')
expect(firstChild.comment.account.name).equal('root')
expect(firstChild.comment.account.host).equal('localhost:' + servers[1].port)
2017-12-27 13:03:37 -06:00
expect(firstChild.children).to.have.lengthOf(1)
2018-03-27 03:26:52 -05:00
childOfFirstChild = firstChild.children[0]
2017-12-27 13:03:37 -06:00
expect(childOfFirstChild.comment.text).to.equal('my super answer to answer of thread 1')
expect(childOfFirstChild.comment.account.name).equal('root')
expect(childOfFirstChild.comment.account.host).equal('localhost:' + servers[2].port)
2017-12-27 13:03:37 -06:00
expect(childOfFirstChild.children).to.have.lengthOf(0)
const secondChild = tree.children[1]
expect(secondChild.comment.text).to.equal('my second answer to thread 1')
expect(secondChild.comment.account.name).equal('root')
expect(secondChild.comment.account.host).equal('localhost:' + servers[2].port)
2017-12-27 13:03:37 -06:00
expect(secondChild.children).to.have.lengthOf(0)
}
})
2018-01-03 03:12:36 -06:00
2018-03-27 03:26:52 -05:00
it('Should delete a reply', async function () {
2022-01-03 04:01:39 -06:00
this.timeout(30000)
2018-03-27 03:26:52 -05:00
2021-07-16 02:04:35 -05:00
await servers[2].comments.delete({ videoId: videoUUID, commentId: childOfFirstChild.comment.id })
2018-03-27 03:26:52 -05:00
await waitJobs(servers)
2018-03-27 03:26:52 -05:00
})
it('Should have this comment marked as deleted', async function () {
2018-03-27 03:26:52 -05:00
for (const server of servers) {
2021-07-16 02:04:35 -05:00
const { data } = await server.comments.listThreads({ videoId: videoUUID })
2021-07-09 07:15:11 -05:00
const threadId = data.find(c => c.text === 'my super first comment').id
2018-03-27 03:26:52 -05:00
2021-07-16 02:04:35 -05:00
const tree = await server.comments.getThread({ videoId: videoUUID, threadId })
2018-03-27 03:26:52 -05:00
expect(tree.comment.text).equal('my super first comment')
const firstChild = tree.children[0]
expect(firstChild.comment.text).to.equal('my super answer to thread 1')
expect(firstChild.children).to.have.lengthOf(1)
const deletedComment = firstChild.children[0].comment
expect(deletedComment.isDeleted).to.be.true
expect(deletedComment.deletedAt).to.not.be.null
expect(deletedComment.account).to.be.null
expect(deletedComment.text).to.equal('')
2018-03-27 03:26:52 -05:00
const secondChild = tree.children[1]
expect(secondChild.comment.text).to.equal('my second answer to thread 1')
}
})
2018-01-04 04:19:16 -06:00
it('Should delete the thread comments', async function () {
2022-01-03 04:01:39 -06:00
this.timeout(30000)
2018-01-04 04:19:16 -06:00
2021-07-16 02:04:35 -05:00
const { data } = await servers[0].comments.listThreads({ videoId: videoUUID })
2021-07-09 07:15:11 -05:00
const commentId = data.find(c => c.text === 'my super first comment').id
2021-07-16 02:04:35 -05:00
await servers[0].comments.delete({ videoId: videoUUID, commentId })
2018-01-04 04:19:16 -06:00
await waitJobs(servers)
2018-01-04 04:19:16 -06:00
})
it('Should have the threads marked as deleted on other servers too', async function () {
2018-01-04 04:19:16 -06:00
for (const server of servers) {
2021-07-16 02:04:35 -05:00
const body = await server.comments.listThreads({ videoId: videoUUID })
2018-01-04 04:19:16 -06:00
2021-07-09 07:15:11 -05:00
expect(body.total).to.equal(2)
expect(body.data).to.be.an('array')
expect(body.data).to.have.lengthOf(2)
2018-01-04 04:19:16 -06:00
{
2021-07-09 07:15:11 -05:00
const comment = body.data[0]
2018-01-04 04:19:16 -06:00
expect(comment).to.not.be.undefined
expect(comment.inReplyToCommentId).to.be.null
expect(comment.account.name).to.equal('root')
expect(comment.account.host).to.equal('localhost:' + servers[2].port)
2018-01-04 04:19:16 -06:00
expect(comment.totalReplies).to.equal(0)
expect(dateIsValid(comment.createdAt as string)).to.be.true
expect(dateIsValid(comment.updatedAt as string)).to.be.true
}
{
2021-07-09 07:15:11 -05:00
const deletedComment = body.data[1]
expect(deletedComment).to.not.be.undefined
expect(deletedComment.isDeleted).to.be.true
expect(deletedComment.deletedAt).to.not.be.null
expect(deletedComment.text).to.equal('')
expect(deletedComment.inReplyToCommentId).to.be.null
expect(deletedComment.account).to.be.null
expect(deletedComment.totalReplies).to.equal(2)
expect(dateIsValid(deletedComment.createdAt as string)).to.be.true
expect(dateIsValid(deletedComment.updatedAt as string)).to.be.true
expect(dateIsValid(deletedComment.deletedAt as string)).to.be.true
}
2018-01-04 04:19:16 -06:00
}
})
it('Should delete a remote thread by the origin server', async function () {
this.timeout(5000)
2021-07-16 02:04:35 -05:00
const { data } = await servers[0].comments.listThreads({ videoId: videoUUID })
2021-07-09 07:15:11 -05:00
const commentId = data.find(c => c.text === 'my super second comment').id
2021-07-16 02:04:35 -05:00
await servers[0].comments.delete({ videoId: videoUUID, commentId })
await waitJobs(servers)
})
it('Should have the threads marked as deleted on other servers too', async function () {
for (const server of servers) {
2021-07-16 02:04:35 -05:00
const body = await server.comments.listThreads({ videoId: videoUUID })
2021-07-09 07:15:11 -05:00
expect(body.total).to.equal(2)
expect(body.data).to.have.lengthOf(2)
{
2021-07-09 07:15:11 -05:00
const comment = body.data[0]
expect(comment.text).to.equal('')
expect(comment.isDeleted).to.be.true
expect(comment.createdAt).to.not.be.null
expect(comment.deletedAt).to.not.be.null
expect(comment.account).to.be.null
expect(comment.totalReplies).to.equal(0)
}
{
2021-07-09 07:15:11 -05:00
const comment = body.data[1]
expect(comment.text).to.equal('')
expect(comment.isDeleted).to.be.true
expect(comment.createdAt).to.not.be.null
expect(comment.deletedAt).to.not.be.null
expect(comment.account).to.be.null
expect(comment.totalReplies).to.equal(2)
}
}
})
it('Should disable comments and download', async function () {
2018-01-03 03:12:36 -06:00
this.timeout(20000)
const attributes = {
commentsEnabled: false,
downloadEnabled: false
2018-01-03 03:12:36 -06:00
}
2021-07-16 02:04:35 -05:00
await servers[0].videos.update({ id: videoUUID, attributes })
2018-01-03 03:12:36 -06:00
await waitJobs(servers)
2018-01-03 03:12:36 -06:00
for (const server of servers) {
2021-07-16 02:04:35 -05:00
const video = await server.videos.get({ id: videoUUID })
2021-07-15 03:02:54 -05:00
expect(video.commentsEnabled).to.be.false
expect(video.downloadEnabled).to.be.false
2018-01-03 03:12:36 -06:00
const text = 'my super forbidden comment'
2021-07-16 02:04:35 -05:00
await server.comments.createThread({ videoId: videoUUID, text, expectedStatus: HttpStatusCode.CONFLICT_409 })
2018-01-03 03:12:36 -06:00
}
})
2017-12-27 13:03:37 -06:00
})
2017-12-08 10:31:21 -06:00
describe('With minimum parameters', function () {
it('Should upload and propagate the video', async function () {
this.timeout(60000)
2017-12-08 10:31:21 -06:00
const path = '/api/v1/videos/upload'
const req = request(servers[1].url)
.post(path)
.set('Accept', 'application/json')
.set('Authorization', 'Bearer ' + servers[1].accessToken)
.field('name', 'minimum parameters')
.field('privacy', '1')
.field('channelId', '1')
2021-06-14 09:52:22 -05:00
await req.attach('videofile', buildAbsoluteFixturePath('video_short.webm'))
.expect(HttpStatusCode.OK_200)
2017-12-08 10:31:21 -06:00
await waitJobs(servers)
2017-12-08 10:31:21 -06:00
for (const server of servers) {
2021-07-16 02:04:35 -05:00
const { data } = await server.videos.list()
2021-07-15 03:02:54 -05:00
const video = data.find(v => v.name === 'minimum parameters')
2017-12-08 10:31:21 -06:00
const isLocal = server.url === 'http://localhost:' + servers[1].port
2017-12-29 04:51:55 -06:00
const checkAttributes = {
name: 'minimum parameters',
category: null,
licence: null,
language: null,
nsfw: false,
description: null,
support: null,
2018-03-12 05:06:15 -05:00
account: {
name: 'root',
host: 'localhost:' + servers[1].port
2018-03-12 05:06:15 -05:00
},
2017-12-29 04:51:55 -06:00
isLocal,
duration: 5,
2019-09-18 10:20:37 -05:00
commentsEnabled: true,
2019-02-11 07:41:55 -06:00
downloadEnabled: true,
2020-01-31 09:56:52 -06:00
tags: [],
2017-12-29 04:51:55 -06:00
privacy: VideoPrivacy.PUBLIC,
channel: {
displayName: 'Main root channel',
name: 'root_channel',
2017-12-29 04:51:55 -06:00
description: '',
isLocal
},
fixture: 'video_short.webm',
files: [
{
resolution: 720,
2021-11-10 07:25:33 -06:00
size: 61000
2017-12-29 04:51:55 -06:00
},
{
resolution: 480,
2021-11-10 07:25:33 -06:00
size: 40000
2017-12-29 04:51:55 -06:00
},
{
resolution: 360,
2021-11-10 07:25:33 -06:00
size: 32000
2017-12-29 04:51:55 -06:00
},
{
resolution: 240,
2021-01-29 08:58:01 -06:00
size: 23000
2017-12-29 04:51:55 -06:00
}
]
}
2021-07-15 03:02:54 -05:00
await completeVideoCheck(server, video, checkAttributes)
2017-12-08 10:31:21 -06:00
}
})
})
2018-12-11 02:16:41 -06:00
describe('TMP directory', function () {
it('Should have an empty tmp directory', async function () {
for (const server of servers) {
await checkTmpIsEmpty(server)
}
})
})
2019-04-24 08:10:37 -05:00
after(async function () {
await cleanupTests(servers)
2017-09-04 14:21:47 -05:00
})
})