mirror of https://github.com/Chocobozzz/PeerTube
Improve a little bit completeVideoCheck
parent
f7e4f62870
commit
00ee54329a
|
@ -451,7 +451,6 @@ describe('Test follows', function () {
|
||||||
expect(video4).to.not.be.undefined
|
expect(video4).to.not.be.undefined
|
||||||
expect(video6).to.not.be.undefined
|
expect(video6).to.not.be.undefined
|
||||||
|
|
||||||
const isLocal = false
|
|
||||||
const checkAttributes = {
|
const checkAttributes = {
|
||||||
name: 'server3-4',
|
name: 'server3-4',
|
||||||
category: 2,
|
category: 2,
|
||||||
|
@ -464,7 +463,6 @@ describe('Test follows', function () {
|
||||||
name: 'root',
|
name: 'root',
|
||||||
host: servers[2].host
|
host: servers[2].host
|
||||||
},
|
},
|
||||||
isLocal,
|
|
||||||
commentsEnabled: true,
|
commentsEnabled: true,
|
||||||
downloadEnabled: true,
|
downloadEnabled: true,
|
||||||
duration: 5,
|
duration: 5,
|
||||||
|
@ -475,8 +473,7 @@ describe('Test follows', function () {
|
||||||
channel: {
|
channel: {
|
||||||
displayName: 'Main root channel',
|
displayName: 'Main root channel',
|
||||||
name: 'root_channel',
|
name: 'root_channel',
|
||||||
description: '',
|
description: ''
|
||||||
isLocal
|
|
||||||
},
|
},
|
||||||
fixture: 'video_short.webm',
|
fixture: 'video_short.webm',
|
||||||
files: [
|
files: [
|
||||||
|
|
|
@ -44,8 +44,37 @@ describe('Test handle downs', function () {
|
||||||
|
|
||||||
const unlistedVideoAttributes = { ...videoAttributes, privacy: VideoPrivacy.UNLISTED }
|
const unlistedVideoAttributes = { ...videoAttributes, privacy: VideoPrivacy.UNLISTED }
|
||||||
|
|
||||||
let checkAttributes: any
|
const checkAttributes = {
|
||||||
let unlistedCheckAttributes: any
|
name: 'my super name for server 1',
|
||||||
|
category: 5,
|
||||||
|
licence: 4,
|
||||||
|
language: 'ja',
|
||||||
|
nsfw: true,
|
||||||
|
description: 'my super description for server 1',
|
||||||
|
support: 'my super support text for server 1',
|
||||||
|
account: {
|
||||||
|
name: 'root',
|
||||||
|
host: ''
|
||||||
|
},
|
||||||
|
duration: 10,
|
||||||
|
tags: [ 'tag1p1', 'tag2p1' ],
|
||||||
|
privacy: VideoPrivacy.PUBLIC,
|
||||||
|
commentsEnabled: true,
|
||||||
|
downloadEnabled: true,
|
||||||
|
channel: {
|
||||||
|
name: 'root_channel',
|
||||||
|
displayName: 'Main root channel',
|
||||||
|
description: ''
|
||||||
|
},
|
||||||
|
fixture: 'video_short1.webm',
|
||||||
|
files: [
|
||||||
|
{
|
||||||
|
resolution: 720,
|
||||||
|
size: 572456
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
const unlistedCheckAttributes = { ...checkAttributes, privacy: VideoPrivacy.UNLISTED }
|
||||||
|
|
||||||
let commentCommands: CommentsCommand[]
|
let commentCommands: CommentsCommand[]
|
||||||
|
|
||||||
|
@ -55,39 +84,8 @@ describe('Test handle downs', function () {
|
||||||
servers = await createMultipleServers(3)
|
servers = await createMultipleServers(3)
|
||||||
commentCommands = servers.map(s => s.comments)
|
commentCommands = servers.map(s => s.comments)
|
||||||
|
|
||||||
checkAttributes = {
|
checkAttributes.account.host = servers[0].host
|
||||||
name: 'my super name for server 1',
|
unlistedCheckAttributes.account.host = servers[0].host
|
||||||
category: 5,
|
|
||||||
licence: 4,
|
|
||||||
language: 'ja',
|
|
||||||
nsfw: true,
|
|
||||||
description: 'my super description for server 1',
|
|
||||||
support: 'my super support text for server 1',
|
|
||||||
account: {
|
|
||||||
name: 'root',
|
|
||||||
host: servers[0].host
|
|
||||||
},
|
|
||||||
isLocal: false,
|
|
||||||
duration: 10,
|
|
||||||
tags: [ 'tag1p1', 'tag2p1' ],
|
|
||||||
privacy: VideoPrivacy.PUBLIC,
|
|
||||||
commentsEnabled: true,
|
|
||||||
downloadEnabled: true,
|
|
||||||
channel: {
|
|
||||||
name: 'root_channel',
|
|
||||||
displayName: 'Main root channel',
|
|
||||||
description: '',
|
|
||||||
isLocal: false
|
|
||||||
},
|
|
||||||
fixture: 'video_short1.webm',
|
|
||||||
files: [
|
|
||||||
{
|
|
||||||
resolution: 720,
|
|
||||||
size: 572456
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
unlistedCheckAttributes = { ...checkAttributes, privacy: VideoPrivacy.UNLISTED }
|
|
||||||
|
|
||||||
// Get the access tokens
|
// Get the access tokens
|
||||||
await setAccessTokensToServers(servers)
|
await setAccessTokensToServers(servers)
|
||||||
|
|
|
@ -388,15 +388,13 @@ function runTest (withObjectStorage: boolean) {
|
||||||
name: 'noah_remote',
|
name: 'noah_remote',
|
||||||
host: remoteServer.host
|
host: remoteServer.host
|
||||||
},
|
},
|
||||||
isLocal: checkServer === remoteServer,
|
|
||||||
likes: 0,
|
likes: 0,
|
||||||
dislikes: 0,
|
dislikes: 0,
|
||||||
duration: 5,
|
duration: 5,
|
||||||
channel: {
|
channel: {
|
||||||
displayName: 'noah display name',
|
displayName: 'noah display name',
|
||||||
name: 'noah_second_channel',
|
name: 'noah_second_channel',
|
||||||
description: 'noah description',
|
description: 'noah description'
|
||||||
isLocal: checkServer === remoteServer
|
|
||||||
},
|
},
|
||||||
fixture: 'video_short.webm',
|
fixture: 'video_short.webm',
|
||||||
files: [
|
files: [
|
||||||
|
|
|
@ -90,7 +90,6 @@ describe('Test multiple servers', function () {
|
||||||
// All servers should have this video
|
// All servers should have this video
|
||||||
let publishedAt: string = null
|
let publishedAt: string = null
|
||||||
for (const server of servers) {
|
for (const server of servers) {
|
||||||
const isLocal = server.port === servers[0].port
|
|
||||||
const checkAttributes = {
|
const checkAttributes = {
|
||||||
name: 'my super name for server 1',
|
name: 'my super name for server 1',
|
||||||
category: 5,
|
category: 5,
|
||||||
|
@ -104,7 +103,6 @@ describe('Test multiple servers', function () {
|
||||||
name: 'root',
|
name: 'root',
|
||||||
host: servers[0].host
|
host: servers[0].host
|
||||||
},
|
},
|
||||||
isLocal,
|
|
||||||
publishedAt,
|
publishedAt,
|
||||||
duration: 10,
|
duration: 10,
|
||||||
tags: [ 'tag1p1', 'tag2p1' ],
|
tags: [ 'tag1p1', 'tag2p1' ],
|
||||||
|
@ -114,8 +112,7 @@ describe('Test multiple servers', function () {
|
||||||
channel: {
|
channel: {
|
||||||
displayName: 'my channel',
|
displayName: 'my channel',
|
||||||
name: 'super_channel_name',
|
name: 'super_channel_name',
|
||||||
description: 'super channel',
|
description: 'super channel'
|
||||||
isLocal
|
|
||||||
},
|
},
|
||||||
fixture: 'video_short1.webm',
|
fixture: 'video_short1.webm',
|
||||||
files: [
|
files: [
|
||||||
|
@ -182,7 +179,6 @@ describe('Test multiple servers', function () {
|
||||||
|
|
||||||
// All servers should have this video
|
// All servers should have this video
|
||||||
for (const server of servers) {
|
for (const server of servers) {
|
||||||
const isLocal = server.url === servers[1].url
|
|
||||||
const checkAttributes = {
|
const checkAttributes = {
|
||||||
name: 'my super name for server 2',
|
name: 'my super name for server 2',
|
||||||
category: 4,
|
category: 4,
|
||||||
|
@ -195,7 +191,6 @@ describe('Test multiple servers', function () {
|
||||||
name: 'user1',
|
name: 'user1',
|
||||||
host: servers[1].host
|
host: servers[1].host
|
||||||
},
|
},
|
||||||
isLocal,
|
|
||||||
commentsEnabled: true,
|
commentsEnabled: true,
|
||||||
downloadEnabled: true,
|
downloadEnabled: true,
|
||||||
duration: 5,
|
duration: 5,
|
||||||
|
@ -204,8 +199,7 @@ describe('Test multiple servers', function () {
|
||||||
channel: {
|
channel: {
|
||||||
displayName: 'Main user1 channel',
|
displayName: 'Main user1 channel',
|
||||||
name: 'user1_channel',
|
name: 'user1_channel',
|
||||||
description: 'super channel',
|
description: 'super channel'
|
||||||
isLocal
|
|
||||||
},
|
},
|
||||||
fixture: 'video_short2.webm',
|
fixture: 'video_short2.webm',
|
||||||
files: [
|
files: [
|
||||||
|
@ -276,7 +270,6 @@ describe('Test multiple servers', function () {
|
||||||
|
|
||||||
// All servers should have this video
|
// All servers should have this video
|
||||||
for (const server of servers) {
|
for (const server of servers) {
|
||||||
const isLocal = server.url === servers[2].url
|
|
||||||
const { data } = await server.videos.list()
|
const { data } = await server.videos.list()
|
||||||
|
|
||||||
expect(data).to.be.an('array')
|
expect(data).to.be.an('array')
|
||||||
|
@ -305,7 +298,6 @@ describe('Test multiple servers', function () {
|
||||||
name: 'root',
|
name: 'root',
|
||||||
host: servers[2].host
|
host: servers[2].host
|
||||||
},
|
},
|
||||||
isLocal,
|
|
||||||
duration: 5,
|
duration: 5,
|
||||||
commentsEnabled: true,
|
commentsEnabled: true,
|
||||||
downloadEnabled: true,
|
downloadEnabled: true,
|
||||||
|
@ -314,8 +306,7 @@ describe('Test multiple servers', function () {
|
||||||
channel: {
|
channel: {
|
||||||
displayName: 'Main root channel',
|
displayName: 'Main root channel',
|
||||||
name: 'root_channel',
|
name: 'root_channel',
|
||||||
description: '',
|
description: ''
|
||||||
isLocal
|
|
||||||
},
|
},
|
||||||
fixture: 'video_short3.webm',
|
fixture: 'video_short3.webm',
|
||||||
files: [
|
files: [
|
||||||
|
@ -341,15 +332,13 @@ describe('Test multiple servers', function () {
|
||||||
},
|
},
|
||||||
commentsEnabled: true,
|
commentsEnabled: true,
|
||||||
downloadEnabled: true,
|
downloadEnabled: true,
|
||||||
isLocal,
|
|
||||||
duration: 5,
|
duration: 5,
|
||||||
tags: [ 'tag2p3', 'tag3p3', 'tag4p3' ],
|
tags: [ 'tag2p3', 'tag3p3', 'tag4p3' ],
|
||||||
privacy: VideoPrivacy.PUBLIC,
|
privacy: VideoPrivacy.PUBLIC,
|
||||||
channel: {
|
channel: {
|
||||||
displayName: 'Main root channel',
|
displayName: 'Main root channel',
|
||||||
name: 'root_channel',
|
name: 'root_channel',
|
||||||
description: '',
|
description: ''
|
||||||
isLocal
|
|
||||||
},
|
},
|
||||||
fixture: 'video_short.webm',
|
fixture: 'video_short.webm',
|
||||||
files: [
|
files: [
|
||||||
|
@ -638,7 +627,6 @@ describe('Test multiple servers', function () {
|
||||||
|
|
||||||
expect(new Date(videoUpdated.updatedAt)).to.be.greaterThan(updatedAtMin)
|
expect(new Date(videoUpdated.updatedAt)).to.be.greaterThan(updatedAtMin)
|
||||||
|
|
||||||
const isLocal = server.url === servers[2].url
|
|
||||||
const checkAttributes = {
|
const checkAttributes = {
|
||||||
name: 'my super video updated',
|
name: 'my super video updated',
|
||||||
category: 10,
|
category: 10,
|
||||||
|
@ -652,7 +640,6 @@ describe('Test multiple servers', function () {
|
||||||
name: 'root',
|
name: 'root',
|
||||||
host: servers[2].host
|
host: servers[2].host
|
||||||
},
|
},
|
||||||
isLocal,
|
|
||||||
duration: 5,
|
duration: 5,
|
||||||
commentsEnabled: true,
|
commentsEnabled: true,
|
||||||
downloadEnabled: true,
|
downloadEnabled: true,
|
||||||
|
@ -661,8 +648,7 @@ describe('Test multiple servers', function () {
|
||||||
channel: {
|
channel: {
|
||||||
displayName: 'Main root channel',
|
displayName: 'Main root channel',
|
||||||
name: 'root_channel',
|
name: 'root_channel',
|
||||||
description: '',
|
description: ''
|
||||||
isLocal
|
|
||||||
},
|
},
|
||||||
fixture: 'video_short3.webm',
|
fixture: 'video_short3.webm',
|
||||||
files: [
|
files: [
|
||||||
|
|
|
@ -36,7 +36,6 @@ describe('Test a single server', function () {
|
||||||
name: 'root',
|
name: 'root',
|
||||||
host: server.host
|
host: server.host
|
||||||
},
|
},
|
||||||
isLocal: true,
|
|
||||||
duration: 5,
|
duration: 5,
|
||||||
tags: [ 'tag1', 'tag2', 'tag3' ],
|
tags: [ 'tag1', 'tag2', 'tag3' ],
|
||||||
privacy: VideoPrivacy.PUBLIC,
|
privacy: VideoPrivacy.PUBLIC,
|
||||||
|
@ -45,8 +44,7 @@ describe('Test a single server', function () {
|
||||||
channel: {
|
channel: {
|
||||||
displayName: 'Main root channel',
|
displayName: 'Main root channel',
|
||||||
name: 'root_channel',
|
name: 'root_channel',
|
||||||
description: '',
|
description: ''
|
||||||
isLocal: true
|
|
||||||
},
|
},
|
||||||
fixture: 'video_short.webm',
|
fixture: 'video_short.webm',
|
||||||
files: [
|
files: [
|
||||||
|
@ -69,7 +67,6 @@ describe('Test a single server', function () {
|
||||||
name: 'root',
|
name: 'root',
|
||||||
host: server.host
|
host: server.host
|
||||||
},
|
},
|
||||||
isLocal: true,
|
|
||||||
tags: [ 'tagup1', 'tagup2' ],
|
tags: [ 'tagup1', 'tagup2' ],
|
||||||
privacy: VideoPrivacy.PUBLIC,
|
privacy: VideoPrivacy.PUBLIC,
|
||||||
duration: 5,
|
duration: 5,
|
||||||
|
@ -78,8 +75,7 @@ describe('Test a single server', function () {
|
||||||
channel: {
|
channel: {
|
||||||
name: 'root_channel',
|
name: 'root_channel',
|
||||||
displayName: 'Main root channel',
|
displayName: 'Main root channel',
|
||||||
description: '',
|
description: ''
|
||||||
isLocal: true
|
|
||||||
},
|
},
|
||||||
fixture: 'video_short3.webm',
|
fixture: 'video_short3.webm',
|
||||||
files: [
|
files: [
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { expect } from 'chai'
|
||||||
import { pathExists } from 'fs-extra/esm'
|
import { pathExists } from 'fs-extra/esm'
|
||||||
import { readdir } from 'fs/promises'
|
import { readdir } from 'fs/promises'
|
||||||
import { basename, join } from 'path'
|
import { basename, join } from 'path'
|
||||||
import { pick, uuidRegex } from '@peertube/peertube-core-utils'
|
import { uuidRegex } from '@peertube/peertube-core-utils'
|
||||||
import { HttpStatusCode, HttpStatusCodeType, VideoCaption, VideoDetails, VideoPrivacy, VideoResolution } from '@peertube/peertube-models'
|
import { HttpStatusCode, HttpStatusCodeType, VideoCaption, VideoDetails, VideoPrivacy, VideoResolution } from '@peertube/peertube-models'
|
||||||
import {
|
import {
|
||||||
loadLanguages,
|
loadLanguages,
|
||||||
|
@ -17,8 +17,9 @@ import { getLowercaseExtension } from '@peertube/peertube-node-utils'
|
||||||
import { makeRawRequest, PeerTubeServer, VideoEdit, waitJobs } from '@peertube/peertube-server-commands'
|
import { makeRawRequest, PeerTubeServer, VideoEdit, waitJobs } from '@peertube/peertube-server-commands'
|
||||||
import { dateIsValid, expectStartWith, testImageGeneratedByFFmpeg } from './checks.js'
|
import { dateIsValid, expectStartWith, testImageGeneratedByFFmpeg } from './checks.js'
|
||||||
import { checkWebTorrentWorks } from './webtorrent.js'
|
import { checkWebTorrentWorks } from './webtorrent.js'
|
||||||
|
import { completeCheckHlsPlaylist } from './streaming-playlists.js'
|
||||||
|
|
||||||
async function completeWebVideoFilesCheck (options: {
|
export async function completeWebVideoFilesCheck (options: {
|
||||||
server: PeerTubeServer
|
server: PeerTubeServer
|
||||||
originServer: PeerTubeServer
|
originServer: PeerTubeServer
|
||||||
videoUUID: string
|
videoUUID: string
|
||||||
|
@ -109,10 +110,12 @@ async function completeWebVideoFilesCheck (options: {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function completeVideoCheck (options: {
|
export async function completeVideoCheck (options: {
|
||||||
server: PeerTubeServer
|
server: PeerTubeServer
|
||||||
originServer: PeerTubeServer
|
originServer: PeerTubeServer
|
||||||
|
|
||||||
videoUUID: string
|
videoUUID: string
|
||||||
|
|
||||||
objectStorageBaseUrl?: string
|
objectStorageBaseUrl?: string
|
||||||
|
|
||||||
attributes: {
|
attributes: {
|
||||||
|
@ -124,32 +127,41 @@ async function completeVideoCheck (options: {
|
||||||
commentsEnabled: boolean
|
commentsEnabled: boolean
|
||||||
downloadEnabled: boolean
|
downloadEnabled: boolean
|
||||||
description: string
|
description: string
|
||||||
publishedAt?: string
|
|
||||||
support: string
|
support: string
|
||||||
|
duration: number
|
||||||
|
tags: string[]
|
||||||
|
privacy: number
|
||||||
|
|
||||||
|
publishedAt?: string
|
||||||
originallyPublishedAt?: string
|
originallyPublishedAt?: string
|
||||||
|
|
||||||
account: {
|
account: {
|
||||||
name: string
|
name: string
|
||||||
host: string
|
host: string
|
||||||
}
|
}
|
||||||
isLocal: boolean
|
|
||||||
tags: string[]
|
|
||||||
privacy: number
|
|
||||||
likes?: number
|
likes?: number
|
||||||
dislikes?: number
|
dislikes?: number
|
||||||
duration: number
|
|
||||||
channel: {
|
channel: {
|
||||||
displayName: string
|
displayName: string
|
||||||
name: string
|
name: string
|
||||||
description: string
|
description: string
|
||||||
isLocal: boolean
|
|
||||||
}
|
}
|
||||||
fixture: string
|
fixture: string
|
||||||
files: {
|
|
||||||
|
thumbnailfile?: string
|
||||||
|
previewfile?: string
|
||||||
|
|
||||||
|
files?: {
|
||||||
resolution: number
|
resolution: number
|
||||||
size: number
|
size: number
|
||||||
}[]
|
}[]
|
||||||
thumbnailfile?: string
|
|
||||||
previewfile?: string
|
hls?: {
|
||||||
|
hlsOnly: boolean
|
||||||
|
resolutions: number[]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}) {
|
}) {
|
||||||
const { attributes, originServer, server, videoUUID, objectStorageBaseUrl } = options
|
const { attributes, originServer, server, videoUUID, objectStorageBaseUrl } = options
|
||||||
|
@ -164,24 +176,30 @@ async function completeVideoCheck (options: {
|
||||||
expect(video.name).to.equal(attributes.name)
|
expect(video.name).to.equal(attributes.name)
|
||||||
expect(video.category.id).to.equal(attributes.category)
|
expect(video.category.id).to.equal(attributes.category)
|
||||||
expect(video.category.label).to.equal(attributes.category !== null ? VIDEO_CATEGORIES[attributes.category] : 'Unknown')
|
expect(video.category.label).to.equal(attributes.category !== null ? VIDEO_CATEGORIES[attributes.category] : 'Unknown')
|
||||||
|
|
||||||
expect(video.licence.id).to.equal(attributes.licence)
|
expect(video.licence.id).to.equal(attributes.licence)
|
||||||
expect(video.licence.label).to.equal(attributes.licence !== null ? VIDEO_LICENCES[attributes.licence] : 'Unknown')
|
expect(video.licence.label).to.equal(attributes.licence !== null ? VIDEO_LICENCES[attributes.licence] : 'Unknown')
|
||||||
|
|
||||||
expect(video.language.id).to.equal(attributes.language)
|
expect(video.language.id).to.equal(attributes.language)
|
||||||
expect(video.language.label).to.equal(attributes.language !== null ? VIDEO_LANGUAGES[attributes.language] : 'Unknown')
|
expect(video.language.label).to.equal(attributes.language !== null ? VIDEO_LANGUAGES[attributes.language] : 'Unknown')
|
||||||
|
|
||||||
expect(video.privacy.id).to.deep.equal(attributes.privacy)
|
expect(video.privacy.id).to.deep.equal(attributes.privacy)
|
||||||
expect(video.privacy.label).to.deep.equal(VIDEO_PRIVACIES[attributes.privacy])
|
expect(video.privacy.label).to.deep.equal(VIDEO_PRIVACIES[attributes.privacy])
|
||||||
|
|
||||||
expect(video.nsfw).to.equal(attributes.nsfw)
|
expect(video.nsfw).to.equal(attributes.nsfw)
|
||||||
expect(video.description).to.equal(attributes.description)
|
expect(video.description).to.equal(attributes.description)
|
||||||
expect(video.account.id).to.be.a('number')
|
|
||||||
expect(video.account.host).to.equal(attributes.account.host)
|
|
||||||
expect(video.account.name).to.equal(attributes.account.name)
|
|
||||||
expect(video.channel.displayName).to.equal(attributes.channel.displayName)
|
|
||||||
expect(video.channel.name).to.equal(attributes.channel.name)
|
|
||||||
expect(video.likes).to.equal(attributes.likes)
|
expect(video.likes).to.equal(attributes.likes)
|
||||||
expect(video.dislikes).to.equal(attributes.dislikes)
|
expect(video.dislikes).to.equal(attributes.dislikes)
|
||||||
expect(video.isLocal).to.equal(attributes.isLocal)
|
|
||||||
|
expect(video.isLocal).to.equal(server.url === originServer.url)
|
||||||
expect(video.duration).to.equal(attributes.duration)
|
expect(video.duration).to.equal(attributes.duration)
|
||||||
expect(video.url).to.contain(originServer.host)
|
expect(video.url).to.contain(originServer.host)
|
||||||
|
expect(video.tags).to.deep.equal(attributes.tags)
|
||||||
|
|
||||||
|
expect(video.commentsEnabled).to.equal(attributes.commentsEnabled)
|
||||||
|
expect(video.downloadEnabled).to.equal(attributes.downloadEnabled)
|
||||||
|
|
||||||
expect(dateIsValid(video.createdAt)).to.be.true
|
expect(dateIsValid(video.createdAt)).to.be.true
|
||||||
expect(dateIsValid(video.publishedAt)).to.be.true
|
expect(dateIsValid(video.publishedAt)).to.be.true
|
||||||
expect(dateIsValid(video.updatedAt)).to.be.true
|
expect(dateIsValid(video.updatedAt)).to.be.true
|
||||||
|
@ -196,18 +214,16 @@ async function completeVideoCheck (options: {
|
||||||
expect(video.originallyPublishedAt).to.be.null
|
expect(video.originallyPublishedAt).to.be.null
|
||||||
}
|
}
|
||||||
|
|
||||||
expect(video.files).to.have.lengthOf(attributes.files.length)
|
expect(video.account.id).to.be.a('number')
|
||||||
expect(video.tags).to.deep.equal(attributes.tags)
|
|
||||||
expect(video.account.name).to.equal(attributes.account.name)
|
expect(video.account.name).to.equal(attributes.account.name)
|
||||||
expect(video.account.host).to.equal(attributes.account.host)
|
expect(video.account.host).to.equal(attributes.account.host)
|
||||||
|
|
||||||
expect(video.channel.displayName).to.equal(attributes.channel.displayName)
|
expect(video.channel.displayName).to.equal(attributes.channel.displayName)
|
||||||
expect(video.channel.name).to.equal(attributes.channel.name)
|
expect(video.channel.name).to.equal(attributes.channel.name)
|
||||||
expect(video.channel.host).to.equal(attributes.account.host)
|
expect(video.channel.host).to.equal(attributes.account.host)
|
||||||
expect(video.channel.isLocal).to.equal(attributes.channel.isLocal)
|
expect(video.channel.isLocal).to.equal(server.url === originServer.url)
|
||||||
expect(video.channel.createdAt).to.exist
|
expect(video.channel.createdAt).to.exist
|
||||||
expect(dateIsValid(video.channel.updatedAt.toString())).to.be.true
|
expect(dateIsValid(video.channel.updatedAt.toString())).to.be.true
|
||||||
expect(video.commentsEnabled).to.equal(attributes.commentsEnabled)
|
|
||||||
expect(video.downloadEnabled).to.equal(attributes.downloadEnabled)
|
|
||||||
|
|
||||||
expect(video.thumbnailPath).to.exist
|
expect(video.thumbnailPath).to.exist
|
||||||
await testImageGeneratedByFFmpeg(server.url, attributes.thumbnailfile || attributes.fixture, video.thumbnailPath)
|
await testImageGeneratedByFFmpeg(server.url, attributes.thumbnailfile || attributes.fixture, video.thumbnailPath)
|
||||||
|
@ -217,16 +233,30 @@ async function completeVideoCheck (options: {
|
||||||
await testImageGeneratedByFFmpeg(server.url, attributes.previewfile, video.previewPath)
|
await testImageGeneratedByFFmpeg(server.url, attributes.previewfile, video.previewPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
await completeWebVideoFilesCheck({
|
if (attributes.files) {
|
||||||
server,
|
await completeWebVideoFilesCheck({
|
||||||
originServer,
|
server,
|
||||||
videoUUID: video.uuid,
|
originServer,
|
||||||
objectStorageBaseUrl,
|
videoUUID: video.uuid,
|
||||||
...pick(attributes, [ 'fixture', 'files' ])
|
objectStorageBaseUrl,
|
||||||
})
|
|
||||||
|
files: attributes.files,
|
||||||
|
fixture: attributes.fixture
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
if (attributes.hls) {
|
||||||
|
await completeCheckHlsPlaylist({
|
||||||
|
objectStorageBaseUrl,
|
||||||
|
servers: [ server ],
|
||||||
|
videoUUID: video.uuid,
|
||||||
|
hlsOnly: attributes.hls.hlsOnly,
|
||||||
|
resolutions: attributes.hls.resolutions
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function checkVideoFilesWereRemoved (options: {
|
export async function checkVideoFilesWereRemoved (options: {
|
||||||
server: PeerTubeServer
|
server: PeerTubeServer
|
||||||
video: VideoDetails
|
video: VideoDetails
|
||||||
captions?: VideoCaption[]
|
captions?: VideoCaption[]
|
||||||
|
@ -280,13 +310,13 @@ async function checkVideoFilesWereRemoved (options: {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function saveVideoInServers (servers: PeerTubeServer[], uuid: string) {
|
export async function saveVideoInServers (servers: PeerTubeServer[], uuid: string) {
|
||||||
for (const server of servers) {
|
for (const server of servers) {
|
||||||
server.store.videoDetails = await server.videos.get({ id: uuid })
|
server.store.videoDetails = await server.videos.get({ id: uuid })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkUploadVideoParam (options: {
|
export function checkUploadVideoParam (options: {
|
||||||
server: PeerTubeServer
|
server: PeerTubeServer
|
||||||
token: string
|
token: string
|
||||||
attributes: Partial<VideoEdit>
|
attributes: Partial<VideoEdit>
|
||||||
|
@ -310,7 +340,7 @@ function checkUploadVideoParam (options: {
|
||||||
}
|
}
|
||||||
|
|
||||||
// serverNumber starts from 1
|
// serverNumber starts from 1
|
||||||
async function uploadRandomVideoOnServers (
|
export async function uploadRandomVideoOnServers (
|
||||||
servers: PeerTubeServer[],
|
servers: PeerTubeServer[],
|
||||||
serverNumber: number,
|
serverNumber: number,
|
||||||
additionalParams?: VideoEdit & { prefixName?: string }
|
additionalParams?: VideoEdit & { prefixName?: string }
|
||||||
|
@ -322,14 +352,3 @@ async function uploadRandomVideoOnServers (
|
||||||
|
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
export {
|
|
||||||
completeVideoCheck,
|
|
||||||
completeWebVideoFilesCheck,
|
|
||||||
checkUploadVideoParam,
|
|
||||||
uploadRandomVideoOnServers,
|
|
||||||
checkVideoFilesWereRemoved,
|
|
||||||
saveVideoInServers
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue