From 28be89161aab245526d64f6fb7dd29391a97fe0a Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 7 Jun 2018 09:43:18 +0200 Subject: Improve create import file job Fix federation of .ogv videos --- server/tests/cli/create-import-video-file-job.ts | 31 +++++++++++++++--------- 1 file changed, 19 insertions(+), 12 deletions(-) (limited to 'server/tests/cli') diff --git a/server/tests/cli/create-import-video-file-job.ts b/server/tests/cli/create-import-video-file-job.ts index d486db600..251088882 100644 --- a/server/tests/cli/create-import-video-file-job.ts +++ b/server/tests/cli/create-import-video-file-job.ts @@ -3,29 +3,31 @@ import 'mocha' import * as chai from 'chai' import { VideoDetails, VideoFile } from '../../../shared/models/videos' -const expect = chai.expect - import { + doubleFollow, execCLI, + flushAndRunMultipleServers, flushTests, getEnvCli, + getVideo, getVideosList, killallServers, - parseTorrentVideo, - runServer, ServerInfo, setAccessTokensToServers, uploadVideo, - wait, - getVideo, flushAndRunMultipleServers, doubleFollow + wait } from '../utils' -function assertVideoProperties (video: VideoFile, resolution: number, extname: string) { +const expect = chai.expect + +function assertVideoProperties (video: VideoFile, resolution: number, extname: string, size?: number) { expect(video).to.have.nested.property('resolution.id', resolution) expect(video).to.have.property('magnetUri').that.includes(`.${extname}`) expect(video).to.have.property('torrentUrl').that.includes(`-${resolution}.torrent`) expect(video).to.have.property('fileUrl').that.includes(`.${extname}`) expect(video).to.have.property('size').that.is.above(0) + + if (size) expect(video.size).to.equal(size) } describe('Test create import video jobs', function () { @@ -51,6 +53,7 @@ describe('Test create import video jobs', function () { const res2 = await uploadVideo(servers[1].url, servers[1].accessToken, { name: 'video2' }) video2UUID = res2.body.video.uuid + // Transcoding await wait(40000) }) @@ -60,12 +63,11 @@ describe('Test create import video jobs', function () { await wait(30000) + let magnetUri: string for (const server of servers) { const { data: videos } = (await getVideosList(server.url)).body expect(videos).to.have.lengthOf(2) - let infoHashes: { [ id: number ]: string } = {} - const video = videos.find(({ uuid }) => uuid === video1UUID) const videoDetail: VideoDetails = (await getVideo(server.url, video.uuid)).body @@ -73,6 +75,9 @@ describe('Test create import video jobs', function () { const [originalVideo, transcodedVideo] = videoDetail.files assertVideoProperties(originalVideo, 720, 'webm') assertVideoProperties(transcodedVideo, 480, 'webm') + + if (!magnetUri) magnetUri = transcodedVideo.magnetUri + else expect(transcodedVideo.magnetUri).to.equal(magnetUri) } }) @@ -82,21 +87,23 @@ describe('Test create import video jobs', function () { await wait(30000) + let magnetUri: string for (const server of servers.reverse()) { const { data: videos } = (await getVideosList(server.url)).body expect(videos).to.have.lengthOf(2) - let infoHashes: { [ id: number ]: string } - const video = videos.find(({ uuid }) => uuid === video2UUID) const videoDetail: VideoDetails = (await getVideo(server.url, video.uuid)).body expect(videoDetail.files).to.have.lengthOf(4) const [originalVideo, transcodedVideo420, transcodedVideo320, transcodedVideo240] = videoDetail.files - assertVideoProperties(originalVideo, 720, 'ogv') + assertVideoProperties(originalVideo, 720, 'ogv', 140849) assertVideoProperties(transcodedVideo420, 480, 'mp4') assertVideoProperties(transcodedVideo320, 360, 'mp4') assertVideoProperties(transcodedVideo240, 240, 'mp4') + + if (!magnetUri) magnetUri = originalVideo.magnetUri + else expect(originalVideo.magnetUri).to.equal(magnetUri) } }) -- cgit v1.2.3