aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/cli/create-import-video-file-job.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/cli/create-import-video-file-job.ts')
-rw-r--r--server/tests/cli/create-import-video-file-job.ts52
1 files changed, 23 insertions, 29 deletions
diff --git a/server/tests/cli/create-import-video-file-job.ts b/server/tests/cli/create-import-video-file-job.ts
index 8a23a94de..b1d9da242 100644
--- a/server/tests/cli/create-import-video-file-job.ts
+++ b/server/tests/cli/create-import-video-file-job.ts
@@ -2,19 +2,8 @@
2 2
3import 'mocha' 3import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { VideoFile } from '@shared/models/videos/video-file.model' 5import { cleanupTests, doubleFollow, flushAndRunMultipleServers, ServerInfo, setAccessTokensToServers, waitJobs } from '@shared/extra-utils'
6import { 6import { VideoFile } from '@shared/models'
7 cleanupTests,
8 doubleFollow,
9 flushAndRunMultipleServers,
10 getVideo,
11 getVideosList,
12 ServerInfo,
13 setAccessTokensToServers,
14 uploadVideo
15} from '../../../shared/extra-utils'
16import { waitJobs } from '../../../shared/extra-utils/server/jobs'
17import { VideoDetails } from '../../../shared/models/videos'
18 7
19const expect = chai.expect 8const expect = chai.expect
20 9
@@ -45,10 +34,15 @@ describe('Test create import video jobs', function () {
45 await doubleFollow(servers[0], servers[1]) 34 await doubleFollow(servers[0], servers[1])
46 35
47 // Upload two videos for our needs 36 // Upload two videos for our needs
48 const res1 = await uploadVideo(servers[0].url, servers[0].accessToken, { name: 'video1' }) 37 {
49 video1UUID = res1.body.video.uuid 38 const { uuid } = await servers[0].videosCommand.upload({ attributes: { name: 'video1' } })
50 const res2 = await uploadVideo(servers[1].url, servers[1].accessToken, { name: 'video2' }) 39 video1UUID = uuid
51 video2UUID = res2.body.video.uuid 40 }
41
42 {
43 const { uuid } = await servers[1].videosCommand.upload({ attributes: { name: 'video2' } })
44 video2UUID = uuid
45 }
52 46
53 // Transcoding 47 // Transcoding
54 await waitJobs(servers) 48 await waitJobs(servers)
@@ -61,14 +55,14 @@ describe('Test create import video jobs', function () {
61 await waitJobs(servers) 55 await waitJobs(servers)
62 56
63 for (const server of servers) { 57 for (const server of servers) {
64 const { data: videos } = (await getVideosList(server.url)).body 58 const { data: videos } = await server.videosCommand.list()
65 expect(videos).to.have.lengthOf(2) 59 expect(videos).to.have.lengthOf(2)
66 60
67 const video = videos.find(({ uuid }) => uuid === video1UUID) 61 const video = videos.find(({ uuid }) => uuid === video1UUID)
68 const videoDetail: VideoDetails = (await getVideo(server.url, video.uuid)).body 62 const videoDetails = await server.videosCommand.get({ id: video.uuid })
69 63
70 expect(videoDetail.files).to.have.lengthOf(2) 64 expect(videoDetails.files).to.have.lengthOf(2)
71 const [ originalVideo, transcodedVideo ] = videoDetail.files 65 const [ originalVideo, transcodedVideo ] = videoDetails.files
72 assertVideoProperties(originalVideo, 720, 'webm', 218910) 66 assertVideoProperties(originalVideo, 720, 'webm', 218910)
73 assertVideoProperties(transcodedVideo, 480, 'webm', 69217) 67 assertVideoProperties(transcodedVideo, 480, 'webm', 69217)
74 } 68 }
@@ -81,14 +75,14 @@ describe('Test create import video jobs', function () {
81 await waitJobs(servers) 75 await waitJobs(servers)
82 76
83 for (const server of servers) { 77 for (const server of servers) {
84 const { data: videos } = (await getVideosList(server.url)).body 78 const { data: videos } = await server.videosCommand.list()
85 expect(videos).to.have.lengthOf(2) 79 expect(videos).to.have.lengthOf(2)
86 80
87 const video = videos.find(({ uuid }) => uuid === video2UUID) 81 const video = videos.find(({ uuid }) => uuid === video2UUID)
88 const videoDetail: VideoDetails = (await getVideo(server.url, video.uuid)).body 82 const videoDetails = await server.videosCommand.get({ id: video.uuid })
89 83
90 expect(videoDetail.files).to.have.lengthOf(4) 84 expect(videoDetails.files).to.have.lengthOf(4)
91 const [ originalVideo, transcodedVideo420, transcodedVideo320, transcodedVideo240 ] = videoDetail.files 85 const [ originalVideo, transcodedVideo420, transcodedVideo320, transcodedVideo240 ] = videoDetails.files
92 assertVideoProperties(originalVideo, 720, 'ogv', 140849) 86 assertVideoProperties(originalVideo, 720, 'ogv', 140849)
93 assertVideoProperties(transcodedVideo420, 480, 'mp4') 87 assertVideoProperties(transcodedVideo420, 480, 'mp4')
94 assertVideoProperties(transcodedVideo320, 360, 'mp4') 88 assertVideoProperties(transcodedVideo320, 360, 'mp4')
@@ -103,14 +97,14 @@ describe('Test create import video jobs', function () {
103 await waitJobs(servers) 97 await waitJobs(servers)
104 98
105 for (const server of servers) { 99 for (const server of servers) {
106 const { data: videos } = (await getVideosList(server.url)).body 100 const { data: videos } = await server.videosCommand.list()
107 expect(videos).to.have.lengthOf(2) 101 expect(videos).to.have.lengthOf(2)
108 102
109 const video = videos.find(({ uuid }) => uuid === video1UUID) 103 const video = videos.find(({ uuid }) => uuid === video1UUID)
110 const videoDetail: VideoDetails = (await getVideo(server.url, video.uuid)).body 104 const videoDetails = await server.videosCommand.get({ id: video.uuid })
111 105
112 expect(videoDetail.files).to.have.lengthOf(2) 106 expect(videoDetails.files).to.have.lengthOf(2)
113 const [ video720, video480 ] = videoDetail.files 107 const [ video720, video480 ] = videoDetails.files
114 assertVideoProperties(video720, 720, 'webm', 942961) 108 assertVideoProperties(video720, 720, 'webm', 942961)
115 assertVideoProperties(video480, 480, 'webm', 69217) 109 assertVideoProperties(video480, 480, 'webm', 69217)
116 } 110 }