diff options
Diffstat (limited to 'server/tests/api/videos/video-imports.ts')
-rw-r--r-- | server/tests/api/videos/video-imports.ts | 75 |
1 files changed, 66 insertions, 9 deletions
diff --git a/server/tests/api/videos/video-imports.ts b/server/tests/api/videos/video-imports.ts index 8d19a4274..61e7a81ee 100644 --- a/server/tests/api/videos/video-imports.ts +++ b/server/tests/api/videos/video-imports.ts | |||
@@ -14,12 +14,19 @@ import { | |||
14 | listVideoCaptions, | 14 | listVideoCaptions, |
15 | ServerInfo, | 15 | ServerInfo, |
16 | setAccessTokensToServers, | 16 | setAccessTokensToServers, |
17 | testCaptionFile | 17 | testCaptionFile, |
18 | updateCustomSubConfig | ||
18 | } from '../../../../shared/extra-utils' | 19 | } from '../../../../shared/extra-utils' |
19 | import { areHttpImportTestsDisabled, testImage } from '../../../../shared/extra-utils/miscs/miscs' | 20 | import { areHttpImportTestsDisabled, testImage } from '../../../../shared/extra-utils/miscs/miscs' |
20 | import { waitJobs } from '../../../../shared/extra-utils/server/jobs' | 21 | import { waitJobs } from '../../../../shared/extra-utils/server/jobs' |
21 | import { getMagnetURI, getMyVideoImports, getYoutubeVideoUrl, importVideo } from '../../../../shared/extra-utils/videos/video-imports' | 22 | import { |
22 | import { VideoCaption, VideoDetails, VideoImport, VideoPrivacy } from '../../../../shared/models/videos' | 23 | getMagnetURI, |
24 | getMyVideoImports, | ||
25 | getYoutubeHDRVideoUrl, | ||
26 | getYoutubeVideoUrl, | ||
27 | importVideo | ||
28 | } from '../../../../shared/extra-utils/videos/video-imports' | ||
29 | import { VideoCaption, VideoDetails, VideoImport, VideoPrivacy, VideoResolution } from '../../../../shared/models/videos' | ||
23 | 30 | ||
24 | const expect = chai.expect | 31 | const expect = chai.expect |
25 | 32 | ||
@@ -90,7 +97,7 @@ describe('Test video imports', function () { | |||
90 | } | 97 | } |
91 | 98 | ||
92 | before(async function () { | 99 | before(async function () { |
93 | this.timeout(30000) | 100 | this.timeout(30_000) |
94 | 101 | ||
95 | // Run servers | 102 | // Run servers |
96 | servers = await flushAndRunMultipleServers(2) | 103 | servers = await flushAndRunMultipleServers(2) |
@@ -111,7 +118,7 @@ describe('Test video imports', function () { | |||
111 | }) | 118 | }) |
112 | 119 | ||
113 | it('Should import videos on server 1', async function () { | 120 | it('Should import videos on server 1', async function () { |
114 | this.timeout(60000) | 121 | this.timeout(60_000) |
115 | 122 | ||
116 | const baseAttributes = { | 123 | const baseAttributes = { |
117 | channelId: channelIdServer1, | 124 | channelId: channelIdServer1, |
@@ -223,7 +230,7 @@ Ajouter un sous-titre est vraiment facile`) | |||
223 | }) | 230 | }) |
224 | 231 | ||
225 | it('Should have the video listed on the two instances', async function () { | 232 | it('Should have the video listed on the two instances', async function () { |
226 | this.timeout(120000) | 233 | this.timeout(120_000) |
227 | 234 | ||
228 | await waitJobs(servers) | 235 | await waitJobs(servers) |
229 | 236 | ||
@@ -238,7 +245,7 @@ Ajouter un sous-titre est vraiment facile`) | |||
238 | }) | 245 | }) |
239 | 246 | ||
240 | it('Should import a video on server 2 with some fields', async function () { | 247 | it('Should import a video on server 2 with some fields', async function () { |
241 | this.timeout(60000) | 248 | this.timeout(60_000) |
242 | 249 | ||
243 | const attributes = { | 250 | const attributes = { |
244 | targetUrl: getYoutubeVideoUrl(), | 251 | targetUrl: getYoutubeVideoUrl(), |
@@ -256,7 +263,7 @@ Ajouter un sous-titre est vraiment facile`) | |||
256 | }) | 263 | }) |
257 | 264 | ||
258 | it('Should have the videos listed on the two instances', async function () { | 265 | it('Should have the videos listed on the two instances', async function () { |
259 | this.timeout(120000) | 266 | this.timeout(120_000) |
260 | 267 | ||
261 | await waitJobs(servers) | 268 | await waitJobs(servers) |
262 | 269 | ||
@@ -273,7 +280,7 @@ Ajouter un sous-titre est vraiment facile`) | |||
273 | }) | 280 | }) |
274 | 281 | ||
275 | it('Should import a video that will be transcoded', async function () { | 282 | it('Should import a video that will be transcoded', async function () { |
276 | this.timeout(120000) | 283 | this.timeout(120_000) |
277 | 284 | ||
278 | const attributes = { | 285 | const attributes = { |
279 | name: 'transcoded video', | 286 | name: 'transcoded video', |
@@ -295,6 +302,56 @@ Ajouter un sous-titre est vraiment facile`) | |||
295 | } | 302 | } |
296 | }) | 303 | }) |
297 | 304 | ||
305 | it('Should import no HDR version on a HDR video', async function () { | ||
306 | this.timeout(120_000) | ||
307 | |||
308 | const config = { | ||
309 | transcoding: { | ||
310 | enabled: true, | ||
311 | resolutions: { | ||
312 | '240p': false, | ||
313 | '360p': false, | ||
314 | '480p': false, | ||
315 | '720p': false, | ||
316 | '1080p': true, // the resulting resolution shouldn't be higher than this, and not vp9.2/av01 | ||
317 | '1440p': false, | ||
318 | '2160p': false | ||
319 | }, | ||
320 | webtorrent: { enabled: true }, | ||
321 | hls: { enabled: false } | ||
322 | }, | ||
323 | import: { | ||
324 | videos: { | ||
325 | http: { | ||
326 | enabled: true | ||
327 | }, | ||
328 | torrent: { | ||
329 | enabled: true | ||
330 | } | ||
331 | } | ||
332 | } | ||
333 | } | ||
334 | await updateCustomSubConfig(servers[0].url, servers[0].accessToken, config) | ||
335 | |||
336 | const attributes = { | ||
337 | name: 'hdr video', | ||
338 | targetUrl: getYoutubeHDRVideoUrl(), | ||
339 | channelId: channelIdServer1, | ||
340 | privacy: VideoPrivacy.PUBLIC | ||
341 | } | ||
342 | const res1 = await importVideo(servers[0].url, servers[0].accessToken, attributes) | ||
343 | const videoUUID = res1.body.video.uuid | ||
344 | |||
345 | await waitJobs(servers) | ||
346 | |||
347 | // test resolution | ||
348 | const res2 = await getVideo(servers[0].url, videoUUID) | ||
349 | const video: VideoDetails = res2.body | ||
350 | expect(video.name).to.equal('hdr video') | ||
351 | const maxResolution = Math.max.apply(Math, video.files.map(function (o) { return o.resolution.id })) | ||
352 | expect(maxResolution, 'expected max resolution not met').to.equals(VideoResolution.H_1080P) | ||
353 | }) | ||
354 | |||
298 | after(async function () { | 355 | after(async function () { |
299 | await cleanupTests(servers) | 356 | await cleanupTests(servers) |
300 | }) | 357 | }) |