aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/videos
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api/videos')
-rw-r--r--server/tests/api/videos/video-change-ownership.ts15
-rw-r--r--server/tests/api/videos/video-hls.ts41
-rw-r--r--server/tests/api/videos/video-imports.ts5
-rw-r--r--server/tests/api/videos/video-nsfw.ts25
-rw-r--r--server/tests/api/videos/video-transcoder.ts86
5 files changed, 84 insertions, 88 deletions
diff --git a/server/tests/api/videos/video-change-ownership.ts b/server/tests/api/videos/video-change-ownership.ts
index a3384851b..89dba14b1 100644
--- a/server/tests/api/videos/video-change-ownership.ts
+++ b/server/tests/api/videos/video-change-ownership.ts
@@ -20,7 +20,6 @@ import {
20 ServerInfo, 20 ServerInfo,
21 setAccessTokensToServers, 21 setAccessTokensToServers,
22 setDefaultVideoChannel, 22 setDefaultVideoChannel,
23 updateCustomSubConfig,
24 uploadVideo, 23 uploadVideo,
25 userLogin 24 userLogin
26} from '../../../../shared/extra-utils' 25} from '../../../../shared/extra-utils'
@@ -58,12 +57,14 @@ describe('Test video change ownership - nominal', function () {
58 await setAccessTokensToServers(servers) 57 await setAccessTokensToServers(servers)
59 await setDefaultVideoChannel(servers) 58 await setDefaultVideoChannel(servers)
60 59
61 await updateCustomSubConfig(servers[0].url, servers[0].accessToken, { 60 await servers[0].configCommand.updateCustomSubConfig({
62 transcoding: { 61 newConfig: {
63 enabled: false 62 transcoding: {
64 }, 63 enabled: false
65 live: { 64 },
66 enabled: true 65 live: {
66 enabled: true
67 }
67 } 68 }
68 }) 69 })
69 70
diff --git a/server/tests/api/videos/video-hls.ts b/server/tests/api/videos/video-hls.ts
index 03ac3f321..3821cfed0 100644
--- a/server/tests/api/videos/video-hls.ts
+++ b/server/tests/api/videos/video-hls.ts
@@ -3,6 +3,7 @@
3import 'mocha' 3import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { join } from 'path' 5import { join } from 'path'
6import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
6import { 7import {
7 checkDirectoryIsEmpty, 8 checkDirectoryIsEmpty,
8 checkResolutionsInMasterPlaylist, 9 checkResolutionsInMasterPlaylist,
@@ -17,7 +18,6 @@ import {
17 removeVideo, 18 removeVideo,
18 ServerInfo, 19 ServerInfo,
19 setAccessTokensToServers, 20 setAccessTokensToServers,
20 updateCustomSubConfig,
21 updateVideo, 21 updateVideo,
22 uploadVideo, 22 uploadVideo,
23 waitJobs, 23 waitJobs,
@@ -26,7 +26,6 @@ import {
26import { VideoDetails } from '../../../../shared/models/videos' 26import { VideoDetails } from '../../../../shared/models/videos'
27import { VideoStreamingPlaylistType } from '../../../../shared/models/videos/video-streaming-playlist.type' 27import { VideoStreamingPlaylistType } from '../../../../shared/models/videos/video-streaming-playlist.type'
28import { DEFAULT_AUDIO_RESOLUTION } from '../../../initializers/constants' 28import { DEFAULT_AUDIO_RESOLUTION } from '../../../initializers/constants'
29import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
30 29
31const expect = chai.expect 30const expect = chai.expect
32 31
@@ -192,24 +191,26 @@ describe('Test HLS videos', function () {
192 describe('With only HLS enabled', function () { 191 describe('With only HLS enabled', function () {
193 192
194 before(async function () { 193 before(async function () {
195 await updateCustomSubConfig(servers[0].url, servers[0].accessToken, { 194 await servers[0].configCommand.updateCustomSubConfig({
196 transcoding: { 195 newConfig: {
197 enabled: true, 196 transcoding: {
198 allowAudioFiles: true, 197 enabled: true,
199 resolutions: { 198 allowAudioFiles: true,
200 '240p': true, 199 resolutions: {
201 '360p': true, 200 '240p': true,
202 '480p': true, 201 '360p': true,
203 '720p': true, 202 '480p': true,
204 '1080p': true, 203 '720p': true,
205 '1440p': true, 204 '1080p': true,
206 '2160p': true 205 '1440p': true,
207 }, 206 '2160p': true
208 hls: { 207 },
209 enabled: true 208 hls: {
210 }, 209 enabled: true
211 webtorrent: { 210 },
212 enabled: false 211 webtorrent: {
212 enabled: false
213 }
213 } 214 }
214 } 215 }
215 }) 216 })
diff --git a/server/tests/api/videos/video-imports.ts b/server/tests/api/videos/video-imports.ts
index 80834ca86..a4a9132b4 100644
--- a/server/tests/api/videos/video-imports.ts
+++ b/server/tests/api/videos/video-imports.ts
@@ -14,8 +14,7 @@ import {
14 listVideoCaptions, 14 listVideoCaptions,
15 ServerInfo, 15 ServerInfo,
16 setAccessTokensToServers, 16 setAccessTokensToServers,
17 testCaptionFile, 17 testCaptionFile
18 updateCustomSubConfig
19} from '../../../../shared/extra-utils' 18} from '../../../../shared/extra-utils'
20import { areHttpImportTestsDisabled, testImage } from '../../../../shared/extra-utils/miscs/miscs' 19import { areHttpImportTestsDisabled, testImage } from '../../../../shared/extra-utils/miscs/miscs'
21import { waitJobs } from '../../../../shared/extra-utils/server/jobs' 20import { waitJobs } from '../../../../shared/extra-utils/server/jobs'
@@ -333,7 +332,7 @@ Ajouter un sous-titre est vraiment facile`)
333 } 332 }
334 } 333 }
335 } 334 }
336 await updateCustomSubConfig(servers[0].url, servers[0].accessToken, config) 335 await servers[0].configCommand.updateCustomSubConfig({ newConfig: config })
337 336
338 const attributes = { 337 const attributes = {
339 name: 'hdr video', 338 name: 'hdr video',
diff --git a/server/tests/api/videos/video-nsfw.ts b/server/tests/api/videos/video-nsfw.ts
index 24a4c6152..65813517d 100644
--- a/server/tests/api/videos/video-nsfw.ts
+++ b/server/tests/api/videos/video-nsfw.ts
@@ -7,8 +7,6 @@ import {
7 createUser, 7 createUser,
8 flushAndRunServer, 8 flushAndRunServer,
9 getAccountVideos, 9 getAccountVideos,
10 getConfig,
11 getCustomConfig,
12 getMyUserInformation, 10 getMyUserInformation,
13 getMyVideos, 11 getMyVideos,
14 getVideoChannelVideos, 12 getVideoChannelVideos,
@@ -16,12 +14,11 @@ import {
16 getVideosListWithToken, 14 getVideosListWithToken,
17 ServerInfo, 15 ServerInfo,
18 setAccessTokensToServers, 16 setAccessTokensToServers,
19 updateCustomConfig,
20 updateMyUser, 17 updateMyUser,
21 uploadVideo, 18 uploadVideo,
22 userLogin 19 userLogin
23} from '@shared/extra-utils' 20} from '@shared/extra-utils'
24import { BooleanBothQuery, CustomConfig, ServerConfig, User, VideosOverview } from '@shared/models' 21import { BooleanBothQuery, CustomConfig, User, VideosOverview } from '@shared/models'
25 22
26const expect = chai.expect 23const expect = chai.expect
27 24
@@ -97,16 +94,12 @@ describe('Test video NSFW policy', function () {
97 await uploadVideo(server.url, server.accessToken, attributes) 94 await uploadVideo(server.url, server.accessToken, attributes)
98 } 95 }
99 96
100 { 97 customConfig = await server.configCommand.getCustomConfig()
101 const res = await getCustomConfig(server.url, server.accessToken)
102 customConfig = res.body
103 }
104 }) 98 })
105 99
106 describe('Instance default NSFW policy', function () { 100 describe('Instance default NSFW policy', function () {
107 it('Should display NSFW videos with display default NSFW policy', async function () { 101 it('Should display NSFW videos with display default NSFW policy', async function () {
108 const resConfig = await getConfig(server.url) 102 const serverConfig = await server.configCommand.getConfig()
109 const serverConfig: ServerConfig = resConfig.body
110 expect(serverConfig.instance.defaultNSFWPolicy).to.equal('display') 103 expect(serverConfig.instance.defaultNSFWPolicy).to.equal('display')
111 104
112 for (const res of await getVideosFunctions()) { 105 for (const res of await getVideosFunctions()) {
@@ -121,10 +114,9 @@ describe('Test video NSFW policy', function () {
121 114
122 it('Should not display NSFW videos with do_not_list default NSFW policy', async function () { 115 it('Should not display NSFW videos with do_not_list default NSFW policy', async function () {
123 customConfig.instance.defaultNSFWPolicy = 'do_not_list' 116 customConfig.instance.defaultNSFWPolicy = 'do_not_list'
124 await updateCustomConfig(server.url, server.accessToken, customConfig) 117 await server.configCommand.updateCustomConfig({ newCustomConfig: customConfig })
125 118
126 const resConfig = await getConfig(server.url) 119 const serverConfig = await server.configCommand.getConfig()
127 const serverConfig: ServerConfig = resConfig.body
128 expect(serverConfig.instance.defaultNSFWPolicy).to.equal('do_not_list') 120 expect(serverConfig.instance.defaultNSFWPolicy).to.equal('do_not_list')
129 121
130 for (const res of await getVideosFunctions()) { 122 for (const res of await getVideosFunctions()) {
@@ -138,10 +130,9 @@ describe('Test video NSFW policy', function () {
138 130
139 it('Should display NSFW videos with blur default NSFW policy', async function () { 131 it('Should display NSFW videos with blur default NSFW policy', async function () {
140 customConfig.instance.defaultNSFWPolicy = 'blur' 132 customConfig.instance.defaultNSFWPolicy = 'blur'
141 await updateCustomConfig(server.url, server.accessToken, customConfig) 133 await server.configCommand.updateCustomConfig({ newCustomConfig: customConfig })
142 134
143 const resConfig = await getConfig(server.url) 135 const serverConfig = await server.configCommand.getConfig()
144 const serverConfig: ServerConfig = resConfig.body
145 expect(serverConfig.instance.defaultNSFWPolicy).to.equal('blur') 136 expect(serverConfig.instance.defaultNSFWPolicy).to.equal('blur')
146 137
147 for (const res of await getVideosFunctions()) { 138 for (const res of await getVideosFunctions()) {
@@ -172,7 +163,7 @@ describe('Test video NSFW policy', function () {
172 163
173 it('Should display NSFW videos with blur user NSFW policy', async function () { 164 it('Should display NSFW videos with blur user NSFW policy', async function () {
174 customConfig.instance.defaultNSFWPolicy = 'do_not_list' 165 customConfig.instance.defaultNSFWPolicy = 'do_not_list'
175 await updateCustomConfig(server.url, server.accessToken, customConfig) 166 await server.configCommand.updateCustomConfig({ newCustomConfig: customConfig })
176 167
177 for (const res of await getVideosFunctions(userAccessToken)) { 168 for (const res of await getVideosFunctions(userAccessToken)) {
178 expect(res.body.total).to.equal(2) 169 expect(res.body.total).to.equal(2)
diff --git a/server/tests/api/videos/video-transcoder.ts b/server/tests/api/videos/video-transcoder.ts
index c95053a29..e74fb5bef 100644
--- a/server/tests/api/videos/video-transcoder.ts
+++ b/server/tests/api/videos/video-transcoder.ts
@@ -5,7 +5,6 @@ import * as chai from 'chai'
5import { FfprobeData } from 'fluent-ffmpeg' 5import { FfprobeData } from 'fluent-ffmpeg'
6import { omit } from 'lodash' 6import { omit } from 'lodash'
7import { join } from 'path' 7import { join } from 'path'
8import { Job } from '@shared/models'
9import { VIDEO_TRANSCODING_FPS } from '../../../../server/initializers/constants' 8import { VIDEO_TRANSCODING_FPS } from '../../../../server/initializers/constants'
10import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' 9import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
11import { 10import {
@@ -24,7 +23,6 @@ import {
24 makeGetRequest, 23 makeGetRequest,
25 ServerInfo, 24 ServerInfo,
26 setAccessTokensToServers, 25 setAccessTokensToServers,
27 updateCustomSubConfig,
28 uploadVideo, 26 uploadVideo,
29 uploadVideoAndGetId, 27 uploadVideoAndGetId,
30 waitJobs, 28 waitJobs,
@@ -43,22 +41,24 @@ import {
43const expect = chai.expect 41const expect = chai.expect
44 42
45function updateConfigForTranscoding (server: ServerInfo) { 43function updateConfigForTranscoding (server: ServerInfo) {
46 return updateCustomSubConfig(server.url, server.accessToken, { 44 return server.configCommand.updateCustomSubConfig({
47 transcoding: { 45 newConfig: {
48 enabled: true, 46 transcoding: {
49 allowAdditionalExtensions: true, 47 enabled: true,
50 allowAudioFiles: true, 48 allowAdditionalExtensions: true,
51 hls: { enabled: true }, 49 allowAudioFiles: true,
52 webtorrent: { enabled: true }, 50 hls: { enabled: true },
53 resolutions: { 51 webtorrent: { enabled: true },
54 '0p': false, 52 resolutions: {
55 '240p': true, 53 '0p': false,
56 '360p': true, 54 '240p': true,
57 '480p': true, 55 '360p': true,
58 '720p': true, 56 '480p': true,
59 '1080p': true, 57 '720p': true,
60 '1440p': true, 58 '1080p': true,
61 '2160p': true 59 '1440p': true,
60 '2160p': true
61 }
62 } 62 }
63 } 63 }
64 }) 64 })
@@ -363,19 +363,21 @@ describe('Test video transcoding', function () {
363 function runSuite (mode: 'legacy' | 'resumable') { 363 function runSuite (mode: 'legacy' | 'resumable') {
364 364
365 before(async function () { 365 before(async function () {
366 await updateCustomSubConfig(servers[1].url, servers[1].accessToken, { 366 await servers[1].configCommand.updateCustomSubConfig({
367 transcoding: { 367 newConfig: {
368 hls: { enabled: true }, 368 transcoding: {
369 webtorrent: { enabled: true }, 369 hls: { enabled: true },
370 resolutions: { 370 webtorrent: { enabled: true },
371 '0p': false, 371 resolutions: {
372 '240p': false, 372 '0p': false,
373 '360p': false, 373 '240p': false,
374 '480p': false, 374 '360p': false,
375 '720p': false, 375 '480p': false,
376 '1080p': false, 376 '720p': false,
377 '1440p': false, 377 '1080p': false,
378 '2160p': false 378 '1440p': false,
379 '2160p': false
380 }
379 } 381 }
380 } 382 }
381 }) 383 })
@@ -434,14 +436,16 @@ describe('Test video transcoding', function () {
434 it('Should upload an audio file and create an audio version only', async function () { 436 it('Should upload an audio file and create an audio version only', async function () {
435 this.timeout(60_000) 437 this.timeout(60_000)
436 438
437 await updateCustomSubConfig(servers[1].url, servers[1].accessToken, { 439 await servers[1].configCommand.updateCustomSubConfig({
438 transcoding: { 440 newConfig: {
439 hls: { enabled: true }, 441 transcoding: {
440 webtorrent: { enabled: true }, 442 hls: { enabled: true },
441 resolutions: { 443 webtorrent: { enabled: true },
442 '0p': true, 444 resolutions: {
443 '240p': false, 445 '0p': true,
444 '360p': false 446 '240p': false,
447 '360p': false
448 }
445 } 449 }
446 } 450 }
447 }) 451 })
@@ -601,7 +605,7 @@ describe('Test video transcoding', function () {
601 it('Should not transcode to an higher bitrate than the original file', async function () { 605 it('Should not transcode to an higher bitrate than the original file', async function () {
602 this.timeout(160_000) 606 this.timeout(160_000)
603 607
604 const config = { 608 const newConfig = {
605 transcoding: { 609 transcoding: {
606 enabled: true, 610 enabled: true,
607 resolutions: { 611 resolutions: {
@@ -617,7 +621,7 @@ describe('Test video transcoding', function () {
617 hls: { enabled: true } 621 hls: { enabled: true }
618 } 622 }
619 } 623 }
620 await updateCustomSubConfig(servers[1].url, servers[1].accessToken, config) 624 await servers[1].configCommand.updateCustomSubConfig({ newConfig })
621 625
622 const videoAttributes = { 626 const videoAttributes = {
623 name: 'low bitrate', 627 name: 'low bitrate',