aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/videos/video-imports.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api/videos/video-imports.ts')
-rw-r--r--server/tests/api/videos/video-imports.ts44
1 files changed, 22 insertions, 22 deletions
diff --git a/server/tests/api/videos/video-imports.ts b/server/tests/api/videos/video-imports.ts
index 31fdfe12e..8b6542aa4 100644
--- a/server/tests/api/videos/video-imports.ts
+++ b/server/tests/api/videos/video-imports.ts
@@ -26,7 +26,7 @@ describe('Test video imports', function () {
26 if (areHttpImportTestsDisabled()) return 26 if (areHttpImportTestsDisabled()) return
27 27
28 async function checkVideosServer1 (server: ServerInfo, idHttp: string, idMagnet: string, idTorrent: string) { 28 async function checkVideosServer1 (server: ServerInfo, idHttp: string, idMagnet: string, idTorrent: string) {
29 const videoHttp = await server.videosCommand.get({ id: idHttp }) 29 const videoHttp = await server.videos.get({ id: idHttp })
30 30
31 expect(videoHttp.name).to.equal('small video - youtube') 31 expect(videoHttp.name).to.equal('small video - youtube')
32 // FIXME: youtube-dl seems broken 32 // FIXME: youtube-dl seems broken
@@ -43,8 +43,8 @@ describe('Test video imports', function () {
43 expect(originallyPublishedAt.getMonth()).to.equal(0) 43 expect(originallyPublishedAt.getMonth()).to.equal(0)
44 expect(originallyPublishedAt.getFullYear()).to.equal(2019) 44 expect(originallyPublishedAt.getFullYear()).to.equal(2019)
45 45
46 const videoMagnet = await server.videosCommand.get({ id: idMagnet }) 46 const videoMagnet = await server.videos.get({ id: idMagnet })
47 const videoTorrent = await server.videosCommand.get({ id: idTorrent }) 47 const videoTorrent = await server.videos.get({ id: idTorrent })
48 48
49 for (const video of [ videoMagnet, videoTorrent ]) { 49 for (const video of [ videoMagnet, videoTorrent ]) {
50 expect(video.category.label).to.equal('Misc') 50 expect(video.category.label).to.equal('Misc')
@@ -59,12 +59,12 @@ describe('Test video imports', function () {
59 expect(videoTorrent.name).to.contain('你好 世界 720p.mp4') 59 expect(videoTorrent.name).to.contain('你好 世界 720p.mp4')
60 expect(videoMagnet.name).to.contain('super peertube2 video') 60 expect(videoMagnet.name).to.contain('super peertube2 video')
61 61
62 const bodyCaptions = await server.captionsCommand.listVideoCaptions({ videoId: idHttp }) 62 const bodyCaptions = await server.captions.listVideoCaptions({ videoId: idHttp })
63 expect(bodyCaptions.total).to.equal(2) 63 expect(bodyCaptions.total).to.equal(2)
64 } 64 }
65 65
66 async function checkVideoServer2 (server: ServerInfo, id: number | string) { 66 async function checkVideoServer2 (server: ServerInfo, id: number | string) {
67 const video = await server.videosCommand.get({ id }) 67 const video = await server.videos.get({ id })
68 68
69 expect(video.name).to.equal('my super name') 69 expect(video.name).to.equal('my super name')
70 expect(video.category.label).to.equal('Entertainment') 70 expect(video.category.label).to.equal('Entertainment')
@@ -76,7 +76,7 @@ describe('Test video imports', function () {
76 76
77 expect(video.files).to.have.lengthOf(1) 77 expect(video.files).to.have.lengthOf(1)
78 78
79 const bodyCaptions = await server.captionsCommand.listVideoCaptions({ videoId: id }) 79 const bodyCaptions = await server.captions.listVideoCaptions({ videoId: id })
80 expect(bodyCaptions.total).to.equal(2) 80 expect(bodyCaptions.total).to.equal(2)
81 } 81 }
82 82
@@ -89,12 +89,12 @@ describe('Test video imports', function () {
89 await setAccessTokensToServers(servers) 89 await setAccessTokensToServers(servers)
90 90
91 { 91 {
92 const { videoChannels } = await servers[0].usersCommand.getMyInfo() 92 const { videoChannels } = await servers[0].users.getMyInfo()
93 channelIdServer1 = videoChannels[0].id 93 channelIdServer1 = videoChannels[0].id
94 } 94 }
95 95
96 { 96 {
97 const { videoChannels } = await servers[1].usersCommand.getMyInfo() 97 const { videoChannels } = await servers[1].users.getMyInfo()
98 channelIdServer2 = videoChannels[0].id 98 channelIdServer2 = videoChannels[0].id
99 } 99 }
100 100
@@ -111,7 +111,7 @@ describe('Test video imports', function () {
111 111
112 { 112 {
113 const attributes = { ...baseAttributes, targetUrl: ImportsCommand.getYoutubeVideoUrl() } 113 const attributes = { ...baseAttributes, targetUrl: ImportsCommand.getYoutubeVideoUrl() }
114 const { video } = await servers[0].importsCommand.importVideo({ attributes }) 114 const { video } = await servers[0].imports.importVideo({ attributes })
115 expect(video.name).to.equal('small video - youtube') 115 expect(video.name).to.equal('small video - youtube')
116 116
117 expect(video.thumbnailPath).to.match(new RegExp(`^/static/thumbnails/.+.jpg$`)) 117 expect(video.thumbnailPath).to.match(new RegExp(`^/static/thumbnails/.+.jpg$`))
@@ -120,7 +120,7 @@ describe('Test video imports', function () {
120 await testImage(servers[0].url, 'video_import_thumbnail', video.thumbnailPath) 120 await testImage(servers[0].url, 'video_import_thumbnail', video.thumbnailPath)
121 await testImage(servers[0].url, 'video_import_preview', video.previewPath) 121 await testImage(servers[0].url, 'video_import_preview', video.previewPath)
122 122
123 const bodyCaptions = await servers[0].captionsCommand.listVideoCaptions({ videoId: video.id }) 123 const bodyCaptions = await servers[0].captions.listVideoCaptions({ videoId: video.id })
124 const videoCaptions = bodyCaptions.data 124 const videoCaptions = bodyCaptions.data
125 expect(videoCaptions).to.have.lengthOf(2) 125 expect(videoCaptions).to.have.lengthOf(2)
126 126
@@ -166,7 +166,7 @@ Ajouter un sous-titre est vraiment facile`)
166 description: 'this is a super torrent description', 166 description: 'this is a super torrent description',
167 tags: [ 'tag_torrent1', 'tag_torrent2' ] 167 tags: [ 'tag_torrent1', 'tag_torrent2' ]
168 } 168 }
169 const { video } = await servers[0].importsCommand.importVideo({ attributes }) 169 const { video } = await servers[0].imports.importVideo({ attributes })
170 expect(video.name).to.equal('super peertube2 video') 170 expect(video.name).to.equal('super peertube2 video')
171 } 171 }
172 172
@@ -177,13 +177,13 @@ Ajouter un sous-titre est vraiment facile`)
177 description: 'this is a super torrent description', 177 description: 'this is a super torrent description',
178 tags: [ 'tag_torrent1', 'tag_torrent2' ] 178 tags: [ 'tag_torrent1', 'tag_torrent2' ]
179 } 179 }
180 const { video } = await servers[0].importsCommand.importVideo({ attributes }) 180 const { video } = await servers[0].imports.importVideo({ attributes })
181 expect(video.name).to.equal('你好 世界 720p.mp4') 181 expect(video.name).to.equal('你好 世界 720p.mp4')
182 } 182 }
183 }) 183 })
184 184
185 it('Should list the videos to import in my videos on server 1', async function () { 185 it('Should list the videos to import in my videos on server 1', async function () {
186 const { total, data } = await servers[0].videosCommand.listMyVideos({ sort: 'createdAt' }) 186 const { total, data } = await servers[0].videos.listMyVideos({ sort: 'createdAt' })
187 187
188 expect(total).to.equal(3) 188 expect(total).to.equal(3)
189 189
@@ -194,7 +194,7 @@ Ajouter un sous-titre est vraiment facile`)
194 }) 194 })
195 195
196 it('Should list the videos to import in my imports on server 1', async function () { 196 it('Should list the videos to import in my imports on server 1', async function () {
197 const { total, data: videoImports } = await servers[0].importsCommand.getMyVideoImports({ sort: '-createdAt' }) 197 const { total, data: videoImports } = await servers[0].imports.getMyVideoImports({ sort: '-createdAt' })
198 expect(total).to.equal(3) 198 expect(total).to.equal(3)
199 199
200 expect(videoImports).to.have.lengthOf(3) 200 expect(videoImports).to.have.lengthOf(3)
@@ -221,7 +221,7 @@ Ajouter un sous-titre est vraiment facile`)
221 await waitJobs(servers) 221 await waitJobs(servers)
222 222
223 for (const server of servers) { 223 for (const server of servers) {
224 const { total, data } = await server.videosCommand.list() 224 const { total, data } = await server.videos.list()
225 expect(total).to.equal(3) 225 expect(total).to.equal(3)
226 expect(data).to.have.lengthOf(3) 226 expect(data).to.have.lengthOf(3)
227 227
@@ -244,7 +244,7 @@ Ajouter un sous-titre est vraiment facile`)
244 description: 'my super description', 244 description: 'my super description',
245 tags: [ 'supertag1', 'supertag2' ] 245 tags: [ 'supertag1', 'supertag2' ]
246 } 246 }
247 const { video } = await servers[1].importsCommand.importVideo({ attributes }) 247 const { video } = await servers[1].imports.importVideo({ attributes })
248 expect(video.name).to.equal('my super name') 248 expect(video.name).to.equal('my super name')
249 }) 249 })
250 250
@@ -254,7 +254,7 @@ Ajouter un sous-titre est vraiment facile`)
254 await waitJobs(servers) 254 await waitJobs(servers)
255 255
256 for (const server of servers) { 256 for (const server of servers) {
257 const { total, data } = await server.videosCommand.list() 257 const { total, data } = await server.videos.list()
258 expect(total).to.equal(4) 258 expect(total).to.equal(4)
259 expect(data).to.have.lengthOf(4) 259 expect(data).to.have.lengthOf(4)
260 260
@@ -274,13 +274,13 @@ Ajouter un sous-titre est vraiment facile`)
274 channelId: channelIdServer2, 274 channelId: channelIdServer2,
275 privacy: VideoPrivacy.PUBLIC 275 privacy: VideoPrivacy.PUBLIC
276 } 276 }
277 const { video } = await servers[1].importsCommand.importVideo({ attributes }) 277 const { video } = await servers[1].imports.importVideo({ attributes })
278 const videoUUID = video.uuid 278 const videoUUID = video.uuid
279 279
280 await waitJobs(servers) 280 await waitJobs(servers)
281 281
282 for (const server of servers) { 282 for (const server of servers) {
283 const video = await server.videosCommand.get({ id: videoUUID }) 283 const video = await server.videos.get({ id: videoUUID })
284 284
285 expect(video.name).to.equal('transcoded video') 285 expect(video.name).to.equal('transcoded video')
286 expect(video.files).to.have.lengthOf(4) 286 expect(video.files).to.have.lengthOf(4)
@@ -316,7 +316,7 @@ Ajouter un sous-titre est vraiment facile`)
316 } 316 }
317 } 317 }
318 } 318 }
319 await servers[0].configCommand.updateCustomSubConfig({ newConfig: config }) 319 await servers[0].config.updateCustomSubConfig({ newConfig: config })
320 320
321 const attributes = { 321 const attributes = {
322 name: 'hdr video', 322 name: 'hdr video',
@@ -324,13 +324,13 @@ Ajouter un sous-titre est vraiment facile`)
324 channelId: channelIdServer1, 324 channelId: channelIdServer1,
325 privacy: VideoPrivacy.PUBLIC 325 privacy: VideoPrivacy.PUBLIC
326 } 326 }
327 const { video: videoImported } = await servers[0].importsCommand.importVideo({ attributes }) 327 const { video: videoImported } = await servers[0].imports.importVideo({ attributes })
328 const videoUUID = videoImported.uuid 328 const videoUUID = videoImported.uuid
329 329
330 await waitJobs(servers) 330 await waitJobs(servers)
331 331
332 // test resolution 332 // test resolution
333 const video = await servers[0].videosCommand.get({ id: videoUUID }) 333 const video = await servers[0].videos.get({ id: videoUUID })
334 expect(video.name).to.equal('hdr video') 334 expect(video.name).to.equal('hdr video')
335 const maxResolution = Math.max.apply(Math, video.files.map(function (o) { return o.resolution.id })) 335 const maxResolution = Math.max.apply(Math, video.files.map(function (o) { return o.resolution.id }))
336 expect(maxResolution, 'expected max resolution not met').to.equals(VideoResolution.H_1080P) 336 expect(maxResolution, 'expected max resolution not met').to.equals(VideoResolution.H_1080P)