import { expect } from 'chai'
import { existsSync, readFile } from 'fs'
import * as parseTorrent from 'parse-torrent'
-import { extname, isAbsolute, join } from 'path'
+import { extname, join } from 'path'
import * as request from 'supertest'
import {
buildAbsoluteFixturePath,
channelId: defaultChannelId,
nsfw: true,
description: 'my super description',
+ support: 'my super support text',
tags: [ 'tag' ],
privacy: VideoPrivacy.PUBLIC,
commentsEnabled: true,
req.field('licence', attributes.licence.toString())
}
+ for (let i = 0; i < attributes.tags.length; i++) {
+ req.field('tags[' + i + ']', attributes.tags[i])
+ }
+
if (attributes.thumbnailfile !== undefined) {
req.attach('thumbnailfile', buildAbsoluteFixturePath(attributes.thumbnailfile))
}
req.attach('previewfile', buildAbsoluteFixturePath(attributes.previewfile))
}
- for (let i = 0; i < attributes.tags.length; i++) {
- req.field('tags[' + i + ']', attributes.tags[i])
- }
-
return req.attach('videofile', buildAbsoluteFixturePath(attributes.fixture))
.expect(specialStatus)
}
nsfw: boolean
commentsEnabled: boolean
description: string
- host: string
- account: string
+ support: string
+ account: {
+ name: string
+ host: string
+ }
isLocal: boolean,
tags: string[],
privacy: number,
expect(video.languageLabel).to.equal(VIDEO_LANGUAGES[attributes.language] || 'Unknown')
expect(video.nsfw).to.equal(attributes.nsfw)
expect(video.description).to.equal(attributes.description)
- expect(video.serverHost).to.equal(attributes.host)
- expect(video.accountName).to.equal(attributes.account)
+ expect(video.account.host).to.equal(attributes.account.host)
+ expect(video.account.name).to.equal(attributes.account.name)
expect(video.likes).to.equal(attributes.likes)
expect(video.dislikes).to.equal(attributes.dislikes)
expect(video.isLocal).to.equal(attributes.isLocal)
expect(videoDetails.tags).to.deep.equal(attributes.tags)
expect(videoDetails.privacy).to.deep.equal(attributes.privacy)
expect(videoDetails.privacyLabel).to.deep.equal(VIDEO_PRIVACIES[attributes.privacy])
- expect(videoDetails.account.name).to.equal(attributes.account)
+ expect(videoDetails.account.name).to.equal(attributes.account.name)
+ expect(videoDetails.account.host).to.equal(attributes.account.host)
expect(videoDetails.commentsEnabled).to.equal(attributes.commentsEnabled)
expect(videoDetails.channel.displayName).to.equal(attributes.channel.name)
let extension = extname(attributes.fixture)
// Transcoding enabled on server 2, extension will always be .mp4
- if (attributes.host === 'localhost:9002') extension = '.mp4'
+ if (attributes.account.host === 'localhost:9002') extension = '.mp4'
const magnetUri = file.magnetUri
expect(file.magnetUri).to.have.lengthOf.above(2)
- expect(file.torrentUrl).to.equal(`http://${attributes.host}/static/torrents/${videoDetails.uuid}-${file.resolution}.torrent`)
- expect(file.fileUrl).to.equal(`http://${attributes.host}/static/webseed/${videoDetails.uuid}-${file.resolution}${extension}`)
+ expect(file.torrentUrl).to.equal(`http://${attributes.account.host}/static/torrents/${videoDetails.uuid}-${file.resolution}.torrent`)
+ expect(file.fileUrl).to.equal(`http://${attributes.account.host}/static/webseed/${videoDetails.uuid}-${file.resolution}${extension}`)
expect(file.resolution).to.equal(attributeFile.resolution)
expect(file.resolutionLabel).to.equal(attributeFile.resolution + 'p')
expect(file.size).to.be.above(minSize).and.below(maxSize)
{
- const test = await testImage(url, attributes.thumbnailfile || attributes.fixture, videoDetails.thumbnailPath)
- expect(test).to.equal(true)
+ await testImage(url, attributes.thumbnailfile || attributes.fixture, videoDetails.thumbnailPath)
}
if (attributes.previewfile) {
- const test = await testImage(url, attributes.previewfile, videoDetails.previewPath)
- expect(test).to.equal(true)
+ await testImage(url, attributes.previewfile, videoDetails.previewPath)
}
const torrent = await webtorrentAdd(magnetUri, true)