aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests')
-rw-r--r--server/tests/api/check-params/live.ts75
-rw-r--r--server/tests/api/check-params/search.ts25
-rw-r--r--server/tests/api/check-params/video-imports.ts53
-rw-r--r--server/tests/api/live/live-constraints.ts33
-rw-r--r--server/tests/api/live/live-permanent.ts35
-rw-r--r--server/tests/api/live/live-save-replay.ts21
-rw-r--r--server/tests/api/live/live-socket-messages.ts15
-rw-r--r--server/tests/api/live/live-views.ts15
-rw-r--r--server/tests/api/live/live.ts43
-rw-r--r--server/tests/api/notifications/moderation-notifications.ts20
-rw-r--r--server/tests/api/search/search-index.ts55
-rw-r--r--server/tests/api/search/search-videos.ts5
-rw-r--r--server/tests/api/server/auto-follows.ts9
-rw-r--r--server/tests/api/server/config.ts48
-rw-r--r--server/tests/api/server/follows-moderation.ts9
-rw-r--r--server/tests/api/server/homepage.ts5
-rw-r--r--server/tests/api/server/plugins.ts21
-rw-r--r--server/tests/api/server/stats.ts47
-rw-r--r--server/tests/api/users/users-verification.ts37
-rw-r--r--server/tests/api/users/users.ts9
-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
-rw-r--r--server/tests/cli/create-transcoding-job.ts5
-rw-r--r--server/tests/cli/plugins.ts8
-rw-r--r--server/tests/client.ts55
-rw-r--r--server/tests/plugins/external-auth.ts15
-rw-r--r--server/tests/plugins/filter-hooks.ts61
-rw-r--r--server/tests/plugins/id-and-pass-auth.ts15
-rw-r--r--server/tests/plugins/plugin-transcoding.ts50
32 files changed, 476 insertions, 485 deletions
diff --git a/server/tests/api/check-params/live.ts b/server/tests/api/check-params/live.ts
index 933d8abf2..7a623c169 100644
--- a/server/tests/api/check-params/live.ts
+++ b/server/tests/api/check-params/live.ts
@@ -19,7 +19,6 @@ import {
19 ServerInfo, 19 ServerInfo,
20 setAccessTokensToServers, 20 setAccessTokensToServers,
21 stopFfmpeg, 21 stopFfmpeg,
22 updateCustomSubConfig,
23 updateLive, 22 updateLive,
24 uploadVideoAndGetId, 23 uploadVideoAndGetId,
25 userLogin, 24 userLogin,
@@ -43,12 +42,14 @@ describe('Test video lives API validator', function () {
43 42
44 await setAccessTokensToServers([ server ]) 43 await setAccessTokensToServers([ server ])
45 44
46 await updateCustomSubConfig(server.url, server.accessToken, { 45 await server.configCommand.updateCustomSubConfig({
47 live: { 46 newConfig: {
48 enabled: true, 47 live: {
49 maxInstanceLives: 20, 48 enabled: true,
50 maxUserLives: 20, 49 maxInstanceLives: 20,
51 allowReplay: true 50 maxUserLives: 20,
51 allowReplay: true
52 }
52 } 53 }
53 }) 54 })
54 55
@@ -234,9 +235,11 @@ describe('Test video lives API validator', function () {
234 }) 235 })
235 236
236 it('Should forbid if live is disabled', async function () { 237 it('Should forbid if live is disabled', async function () {
237 await updateCustomSubConfig(server.url, server.accessToken, { 238 await server.configCommand.updateCustomSubConfig({
238 live: { 239 newConfig: {
239 enabled: false 240 live: {
241 enabled: false
242 }
240 } 243 }
241 }) 244 })
242 245
@@ -252,10 +255,12 @@ describe('Test video lives API validator', function () {
252 it('Should forbid to save replay if not enabled by the admin', async function () { 255 it('Should forbid to save replay if not enabled by the admin', async function () {
253 const fields = immutableAssign(baseCorrectParams, { saveReplay: true }) 256 const fields = immutableAssign(baseCorrectParams, { saveReplay: true })
254 257
255 await updateCustomSubConfig(server.url, server.accessToken, { 258 await server.configCommand.updateCustomSubConfig({
256 live: { 259 newConfig: {
257 enabled: true, 260 live: {
258 allowReplay: false 261 enabled: true,
262 allowReplay: false
263 }
259 } 264 }
260 }) 265 })
261 266
@@ -271,10 +276,12 @@ describe('Test video lives API validator', function () {
271 it('Should allow to save replay if enabled by the admin', async function () { 276 it('Should allow to save replay if enabled by the admin', async function () {
272 const fields = immutableAssign(baseCorrectParams, { saveReplay: true }) 277 const fields = immutableAssign(baseCorrectParams, { saveReplay: true })
273 278
274 await updateCustomSubConfig(server.url, server.accessToken, { 279 await server.configCommand.updateCustomSubConfig({
275 live: { 280 newConfig: {
276 enabled: true, 281 live: {
277 allowReplay: true 282 enabled: true,
283 allowReplay: true
284 }
278 } 285 }
279 }) 286 })
280 287
@@ -288,10 +295,12 @@ describe('Test video lives API validator', function () {
288 }) 295 })
289 296
290 it('Should not allow live if max instance lives is reached', async function () { 297 it('Should not allow live if max instance lives is reached', async function () {
291 await updateCustomSubConfig(server.url, server.accessToken, { 298 await server.configCommand.updateCustomSubConfig({
292 live: { 299 newConfig: {
293 enabled: true, 300 live: {
294 maxInstanceLives: 1 301 enabled: true,
302 maxInstanceLives: 1
303 }
295 } 304 }
296 }) 305 })
297 306
@@ -305,11 +314,13 @@ describe('Test video lives API validator', function () {
305 }) 314 })
306 315
307 it('Should not allow live if max user lives is reached', async function () { 316 it('Should not allow live if max user lives is reached', async function () {
308 await updateCustomSubConfig(server.url, server.accessToken, { 317 await server.configCommand.updateCustomSubConfig({
309 live: { 318 newConfig: {
310 enabled: true, 319 live: {
311 maxInstanceLives: 20, 320 enabled: true,
312 maxUserLives: 1 321 maxInstanceLives: 20,
322 maxUserLives: 1
323 }
313 } 324 }
314 }) 325 })
315 326
@@ -393,10 +404,12 @@ describe('Test video lives API validator', function () {
393 }) 404 })
394 405
395 it('Should fail to update replay status if replay is not allowed on the instance', async function () { 406 it('Should fail to update replay status if replay is not allowed on the instance', async function () {
396 await updateCustomSubConfig(server.url, server.accessToken, { 407 await server.configCommand.updateCustomSubConfig({
397 live: { 408 newConfig: {
398 enabled: true, 409 live: {
399 allowReplay: false 410 enabled: true,
411 allowReplay: false
412 }
400 } 413 }
401 }) 414 })
402 415
diff --git a/server/tests/api/check-params/search.ts b/server/tests/api/check-params/search.ts
index 20ad46cff..4a2fc1197 100644
--- a/server/tests/api/check-params/search.ts
+++ b/server/tests/api/check-params/search.ts
@@ -1,28 +1,27 @@
1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ 1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
2 2
3import 'mocha' 3import 'mocha'
4import { HttpStatusCode } from '@shared/core-utils'
4import { 5import {
6 checkBadCountPagination,
7 checkBadSortPagination,
8 checkBadStartPagination,
5 cleanupTests, 9 cleanupTests,
6 flushAndRunServer, 10 flushAndRunServer,
7 immutableAssign, 11 immutableAssign,
8 makeGetRequest, 12 makeGetRequest,
9 ServerInfo, 13 ServerInfo,
10 updateCustomSubConfig,
11 setAccessTokensToServers 14 setAccessTokensToServers
12} from '../../../../shared/extra-utils' 15} from '@shared/extra-utils'
13import {
14 checkBadCountPagination,
15 checkBadSortPagination,
16 checkBadStartPagination
17} from '../../../../shared/extra-utils/requests/check-api-params'
18import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
19 16
20function updateSearchIndex (server: ServerInfo, enabled: boolean, disableLocalSearch = false) { 17function updateSearchIndex (server: ServerInfo, enabled: boolean, disableLocalSearch = false) {
21 return updateCustomSubConfig(server.url, server.accessToken, { 18 return server.configCommand.updateCustomSubConfig({
22 search: { 19 newConfig: {
23 searchIndex: { 20 search: {
24 enabled, 21 searchIndex: {
25 disableLocalSearch 22 enabled,
23 disableLocalSearch
24 }
26 } 25 }
27 } 26 }
28 }) 27 })
diff --git a/server/tests/api/check-params/video-imports.ts b/server/tests/api/check-params/video-imports.ts
index a27b624d0..dae3860ef 100644
--- a/server/tests/api/check-params/video-imports.ts
+++ b/server/tests/api/check-params/video-imports.ts
@@ -2,9 +2,12 @@
2 2
3import 'mocha' 3import 'mocha'
4import { omit } from 'lodash' 4import { omit } from 'lodash'
5import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' 5import { HttpStatusCode } from '@shared/core-utils'
6import { 6import {
7 buildAbsoluteFixturePath, 7 buildAbsoluteFixturePath,
8 checkBadCountPagination,
9 checkBadSortPagination,
10 checkBadStartPagination,
8 cleanupTests, 11 cleanupTests,
9 createUser, 12 createUser,
10 flushAndRunServer, 13 flushAndRunServer,
@@ -15,16 +18,10 @@ import {
15 makeUploadRequest, 18 makeUploadRequest,
16 ServerInfo, 19 ServerInfo,
17 setAccessTokensToServers, 20 setAccessTokensToServers,
18 updateCustomSubConfig,
19 userLogin 21 userLogin
20} from '../../../../shared/extra-utils' 22} from '@shared/extra-utils'
21import { 23import { getGoodVideoUrl, getMagnetURI } from '@shared/extra-utils/videos/video-imports'
22 checkBadCountPagination, 24import { VideoPrivacy } from '@shared/models'
23 checkBadSortPagination,
24 checkBadStartPagination
25} from '../../../../shared/extra-utils/requests/check-api-params'
26import { getGoodVideoUrl, getMagnetURI } from '../../../../shared/extra-utils/videos/video-imports'
27import { VideoPrivacy } from '../../../../shared/models/videos/video-privacy.enum'
28 25
29describe('Test video imports API validator', function () { 26describe('Test video imports API validator', function () {
30 const path = '/api/v1/videos/imports' 27 const path = '/api/v1/videos/imports'
@@ -263,14 +260,16 @@ describe('Test video imports API validator', function () {
263 }) 260 })
264 261
265 it('Should forbid to import http videos', async function () { 262 it('Should forbid to import http videos', async function () {
266 await updateCustomSubConfig(server.url, server.accessToken, { 263 await server.configCommand.updateCustomSubConfig({
267 import: { 264 newConfig: {
268 videos: { 265 import: {
269 http: { 266 videos: {
270 enabled: false 267 http: {
271 }, 268 enabled: false
272 torrent: { 269 },
273 enabled: true 270 torrent: {
271 enabled: true
272 }
274 } 273 }
275 } 274 }
276 } 275 }
@@ -286,14 +285,16 @@ describe('Test video imports API validator', function () {
286 }) 285 })
287 286
288 it('Should forbid to import torrent videos', async function () { 287 it('Should forbid to import torrent videos', async function () {
289 await updateCustomSubConfig(server.url, server.accessToken, { 288 await server.configCommand.updateCustomSubConfig({
290 import: { 289 newConfig: {
291 videos: { 290 import: {
292 http: { 291 videos: {
293 enabled: true 292 http: {
294 }, 293 enabled: true
295 torrent: { 294 },
296 enabled: false 295 torrent: {
296 enabled: false
297 }
297 } 298 }
298 } 299 }
299 } 300 }
diff --git a/server/tests/api/live/live-constraints.ts b/server/tests/api/live/live-constraints.ts
index cc635de33..c64d10dcd 100644
--- a/server/tests/api/live/live-constraints.ts
+++ b/server/tests/api/live/live-constraints.ts
@@ -6,17 +6,16 @@ import { VideoDetails, VideoPrivacy } from '@shared/models'
6import { 6import {
7 checkLiveCleanup, 7 checkLiveCleanup,
8 cleanupTests, 8 cleanupTests,
9 ConfigCommand,
9 createLive, 10 createLive,
10 doubleFollow, 11 doubleFollow,
11 flushAndRunMultipleServers, 12 flushAndRunMultipleServers,
12 generateUser, 13 generateUser,
13 getCustomConfigResolutions,
14 getVideo, 14 getVideo,
15 runAndTestFfmpegStreamError, 15 runAndTestFfmpegStreamError,
16 ServerInfo, 16 ServerInfo,
17 setAccessTokensToServers, 17 setAccessTokensToServers,
18 setDefaultVideoChannel, 18 setDefaultVideoChannel,
19 updateCustomSubConfig,
20 updateUser, 19 updateUser,
21 wait, 20 wait,
22 waitJobs, 21 waitJobs,
@@ -80,12 +79,14 @@ describe('Test live constraints', function () {
80 await setAccessTokensToServers(servers) 79 await setAccessTokensToServers(servers)
81 await setDefaultVideoChannel(servers) 80 await setDefaultVideoChannel(servers)
82 81
83 await updateCustomSubConfig(servers[0].url, servers[0].accessToken, { 82 await servers[0].configCommand.updateCustomSubConfig({
84 live: { 83 newConfig: {
85 enabled: true, 84 live: {
86 allowReplay: true, 85 enabled: true,
87 transcoding: { 86 allowReplay: true,
88 enabled: false 87 transcoding: {
88 enabled: false
89 }
89 } 90 }
90 } 91 }
91 }) 92 })
@@ -157,14 +158,16 @@ describe('Test live constraints', function () {
157 it('Should have max duration limit', async function () { 158 it('Should have max duration limit', async function () {
158 this.timeout(60000) 159 this.timeout(60000)
159 160
160 await updateCustomSubConfig(servers[0].url, servers[0].accessToken, { 161 await servers[0].configCommand.updateCustomSubConfig({
161 live: { 162 newConfig: {
162 enabled: true, 163 live: {
163 allowReplay: true,
164 maxDuration: 1,
165 transcoding: {
166 enabled: true, 164 enabled: true,
167 resolutions: getCustomConfigResolutions(true) 165 allowReplay: true,
166 maxDuration: 1,
167 transcoding: {
168 enabled: true,
169 resolutions: ConfigCommand.getCustomConfigResolutions(true)
170 }
168 } 171 }
169 } 172 }
170 }) 173 })
diff --git a/server/tests/api/live/live-permanent.ts b/server/tests/api/live/live-permanent.ts
index 71b7d28a8..b9e37c834 100644
--- a/server/tests/api/live/live-permanent.ts
+++ b/server/tests/api/live/live-permanent.ts
@@ -5,10 +5,10 @@ import * as chai from 'chai'
5import { LiveVideoCreate, VideoDetails, VideoPrivacy, VideoState } from '@shared/models' 5import { LiveVideoCreate, VideoDetails, VideoPrivacy, VideoState } from '@shared/models'
6import { 6import {
7 cleanupTests, 7 cleanupTests,
8 ConfigCommand,
8 createLive, 9 createLive,
9 doubleFollow, 10 doubleFollow,
10 flushAndRunMultipleServers, 11 flushAndRunMultipleServers,
11 getCustomConfigResolutions,
12 getLive, 12 getLive,
13 getPlaylistsCount, 13 getPlaylistsCount,
14 getVideo, 14 getVideo,
@@ -17,7 +17,6 @@ import {
17 setAccessTokensToServers, 17 setAccessTokensToServers,
18 setDefaultVideoChannel, 18 setDefaultVideoChannel,
19 stopFfmpeg, 19 stopFfmpeg,
20 updateCustomSubConfig,
21 updateLive, 20 updateLive,
22 wait, 21 wait,
23 waitJobs, 22 waitJobs,
@@ -63,14 +62,16 @@ describe('Permanent live', function () {
63 // Server 1 and server 2 follow each other 62 // Server 1 and server 2 follow each other
64 await doubleFollow(servers[0], servers[1]) 63 await doubleFollow(servers[0], servers[1])
65 64
66 await updateCustomSubConfig(servers[0].url, servers[0].accessToken, { 65 await servers[0].configCommand.updateCustomSubConfig({
67 live: { 66 newConfig: {
68 enabled: true, 67 live: {
69 allowReplay: true,
70 maxDuration: -1,
71 transcoding: {
72 enabled: true, 68 enabled: true,
73 resolutions: getCustomConfigResolutions(true) 69 allowReplay: true,
70 maxDuration: -1,
71 transcoding: {
72 enabled: true,
73 resolutions: ConfigCommand.getCustomConfigResolutions(true)
74 }
74 } 75 }
75 } 76 }
76 }) 77 })
@@ -145,14 +146,16 @@ describe('Permanent live', function () {
145 it('Should be able to stream again in the permanent live', async function () { 146 it('Should be able to stream again in the permanent live', async function () {
146 this.timeout(20000) 147 this.timeout(20000)
147 148
148 await updateCustomSubConfig(servers[0].url, servers[0].accessToken, { 149 await servers[0].configCommand.updateCustomSubConfig({
149 live: { 150 newConfig: {
150 enabled: true, 151 live: {
151 allowReplay: true,
152 maxDuration: -1,
153 transcoding: {
154 enabled: true, 152 enabled: true,
155 resolutions: getCustomConfigResolutions(false) 153 allowReplay: true,
154 maxDuration: -1,
155 transcoding: {
156 enabled: true,
157 resolutions: ConfigCommand.getCustomConfigResolutions(false)
158 }
156 } 159 }
157 } 160 }
158 }) 161 })
diff --git a/server/tests/api/live/live-save-replay.ts b/server/tests/api/live/live-save-replay.ts
index 3d4736c8f..e74bc3e8d 100644
--- a/server/tests/api/live/live-save-replay.ts
+++ b/server/tests/api/live/live-save-replay.ts
@@ -9,10 +9,10 @@ import {
9 addVideoToBlacklist, 9 addVideoToBlacklist,
10 checkLiveCleanup, 10 checkLiveCleanup,
11 cleanupTests, 11 cleanupTests,
12 ConfigCommand,
12 createLive, 13 createLive,
13 doubleFollow, 14 doubleFollow,
14 flushAndRunMultipleServers, 15 flushAndRunMultipleServers,
15 getCustomConfigResolutions,
16 getVideo, 16 getVideo,
17 getVideosList, 17 getVideosList,
18 removeVideo, 18 removeVideo,
@@ -22,7 +22,6 @@ import {
22 setDefaultVideoChannel, 22 setDefaultVideoChannel,
23 stopFfmpeg, 23 stopFfmpeg,
24 testFfmpegStreamError, 24 testFfmpegStreamError,
25 updateCustomSubConfig,
26 updateVideo, 25 updateVideo,
27 wait, 26 wait,
28 waitJobs, 27 waitJobs,
@@ -102,14 +101,16 @@ describe('Save replay setting', function () {
102 // Server 1 and server 2 follow each other 101 // Server 1 and server 2 follow each other
103 await doubleFollow(servers[0], servers[1]) 102 await doubleFollow(servers[0], servers[1])
104 103
105 await updateCustomSubConfig(servers[0].url, servers[0].accessToken, { 104 await servers[0].configCommand.updateCustomSubConfig({
106 live: { 105 newConfig: {
107 enabled: true, 106 live: {
108 allowReplay: true, 107 enabled: true,
109 maxDuration: -1, 108 allowReplay: true,
110 transcoding: { 109 maxDuration: -1,
111 enabled: false, 110 transcoding: {
112 resolutions: getCustomConfigResolutions(true) 111 enabled: false,
112 resolutions: ConfigCommand.getCustomConfigResolutions(true)
113 }
113 } 114 }
114 } 115 }
115 }) 116 })
diff --git a/server/tests/api/live/live-socket-messages.ts b/server/tests/api/live/live-socket-messages.ts
index e00909ade..0159d5199 100644
--- a/server/tests/api/live/live-socket-messages.ts
+++ b/server/tests/api/live/live-socket-messages.ts
@@ -15,7 +15,6 @@ import {
15 setAccessTokensToServers, 15 setAccessTokensToServers,
16 setDefaultVideoChannel, 16 setDefaultVideoChannel,
17 stopFfmpeg, 17 stopFfmpeg,
18 updateCustomSubConfig,
19 viewVideo, 18 viewVideo,
20 wait, 19 wait,
21 waitJobs, 20 waitJobs,
@@ -37,12 +36,14 @@ describe('Test live', function () {
37 await setAccessTokensToServers(servers) 36 await setAccessTokensToServers(servers)
38 await setDefaultVideoChannel(servers) 37 await setDefaultVideoChannel(servers)
39 38
40 await updateCustomSubConfig(servers[0].url, servers[0].accessToken, { 39 await servers[0].configCommand.updateCustomSubConfig({
41 live: { 40 newConfig: {
42 enabled: true, 41 live: {
43 allowReplay: true, 42 enabled: true,
44 transcoding: { 43 allowReplay: true,
45 enabled: false 44 transcoding: {
45 enabled: false
46 }
46 } 47 }
47 } 48 }
48 }) 49 })
diff --git a/server/tests/api/live/live-views.ts b/server/tests/api/live/live-views.ts
index a44d21ffa..ca571c962 100644
--- a/server/tests/api/live/live-views.ts
+++ b/server/tests/api/live/live-views.ts
@@ -15,7 +15,6 @@ import {
15 setAccessTokensToServers, 15 setAccessTokensToServers,
16 setDefaultVideoChannel, 16 setDefaultVideoChannel,
17 stopFfmpeg, 17 stopFfmpeg,
18 updateCustomSubConfig,
19 viewVideo, 18 viewVideo,
20 wait, 19 wait,
21 waitJobs, 20 waitJobs,
@@ -36,12 +35,14 @@ describe('Test live', function () {
36 await setAccessTokensToServers(servers) 35 await setAccessTokensToServers(servers)
37 await setDefaultVideoChannel(servers) 36 await setDefaultVideoChannel(servers)
38 37
39 await updateCustomSubConfig(servers[0].url, servers[0].accessToken, { 38 await servers[0].configCommand.updateCustomSubConfig({
40 live: { 39 newConfig: {
41 enabled: true, 40 live: {
42 allowReplay: true, 41 enabled: true,
43 transcoding: { 42 allowReplay: true,
44 enabled: false 43 transcoding: {
44 enabled: false
45 }
45 } 46 }
46 } 47 }
47 }) 48 })
diff --git a/server/tests/api/live/live.ts b/server/tests/api/live/live.ts
index 50397924e..2c3102994 100644
--- a/server/tests/api/live/live.ts
+++ b/server/tests/api/live/live.ts
@@ -34,7 +34,6 @@ import {
34 stopFfmpeg, 34 stopFfmpeg,
35 testFfmpegStreamError, 35 testFfmpegStreamError,
36 testImage, 36 testImage,
37 updateCustomSubConfig,
38 updateLive, 37 updateLive,
39 uploadVideoAndGetId, 38 uploadVideoAndGetId,
40 wait, 39 wait,
@@ -59,12 +58,14 @@ describe('Test live', function () {
59 await setAccessTokensToServers(servers) 58 await setAccessTokensToServers(servers)
60 await setDefaultVideoChannel(servers) 59 await setDefaultVideoChannel(servers)
61 60
62 await updateCustomSubConfig(servers[0].url, servers[0].accessToken, { 61 await servers[0].configCommand.updateCustomSubConfig({
63 live: { 62 newConfig: {
64 enabled: true, 63 live: {
65 allowReplay: true, 64 enabled: true,
66 transcoding: { 65 allowReplay: true,
67 enabled: false 66 transcoding: {
67 enabled: false
68 }
68 } 69 }
69 } 70 }
70 }) 71 })
@@ -422,20 +423,22 @@ describe('Test live', function () {
422 } 423 }
423 424
424 function updateConf (resolutions: number[]) { 425 function updateConf (resolutions: number[]) {
425 return updateCustomSubConfig(servers[0].url, servers[0].accessToken, { 426 return servers[0].configCommand.updateCustomSubConfig({
426 live: { 427 newConfig: {
427 enabled: true, 428 live: {
428 allowReplay: true,
429 maxDuration: -1,
430 transcoding: {
431 enabled: true, 429 enabled: true,
432 resolutions: { 430 allowReplay: true,
433 '240p': resolutions.includes(240), 431 maxDuration: -1,
434 '360p': resolutions.includes(360), 432 transcoding: {
435 '480p': resolutions.includes(480), 433 enabled: true,
436 '720p': resolutions.includes(720), 434 resolutions: {
437 '1080p': resolutions.includes(1080), 435 '240p': resolutions.includes(240),
438 '2160p': resolutions.includes(2160) 436 '360p': resolutions.includes(360),
437 '480p': resolutions.includes(480),
438 '720p': resolutions.includes(720),
439 '1080p': resolutions.includes(1080),
440 '2160p': resolutions.includes(2160)
441 }
439 } 442 }
440 } 443 }
441 } 444 }
diff --git a/server/tests/api/notifications/moderation-notifications.ts b/server/tests/api/notifications/moderation-notifications.ts
index 9a93ce401..3e66e7517 100644
--- a/server/tests/api/notifications/moderation-notifications.ts
+++ b/server/tests/api/notifications/moderation-notifications.ts
@@ -23,7 +23,6 @@ import {
23 createUser, 23 createUser,
24 generateUserAccessToken, 24 generateUserAccessToken,
25 getAccount, 25 getAccount,
26 getCustomConfig,
27 getVideoCommentThreads, 26 getVideoCommentThreads,
28 getVideoIdFromUUID, 27 getVideoIdFromUUID,
29 immutableAssign, 28 immutableAssign,
@@ -34,8 +33,6 @@ import {
34 removeUserSubscription, 33 removeUserSubscription,
35 removeVideoFromBlacklist, 34 removeVideoFromBlacklist,
36 ServerInfo, 35 ServerInfo,
37 updateCustomConfig,
38 updateCustomSubConfig,
39 uploadVideo, 36 uploadVideo,
40 wait, 37 wait,
41 waitJobs 38 waitJobs
@@ -407,7 +404,7 @@ describe('Test moderation notifications', function () {
407 } 404 }
408 } 405 }
409 } 406 }
410 await updateCustomSubConfig(servers[0].url, servers[0].accessToken, config) 407 await servers[0].configCommand.updateCustomSubConfig({ newConfig: config })
411 408
412 await servers[2].followsCommand.follow({ targets: [ servers[0].url ] }) 409 await servers[2].followsCommand.follow({ targets: [ servers[0].url ] })
413 410
@@ -421,7 +418,7 @@ describe('Test moderation notifications', function () {
421 await checkAutoInstanceFollowing(immutableAssign(baseParams, userOverride), followerHost, followingHost, 'absence') 418 await checkAutoInstanceFollowing(immutableAssign(baseParams, userOverride), followerHost, followingHost, 'absence')
422 419
423 config.followings.instance.autoFollowBack.enabled = false 420 config.followings.instance.autoFollowBack.enabled = false
424 await updateCustomSubConfig(servers[0].url, servers[0].accessToken, config) 421 await servers[0].configCommand.updateCustomSubConfig({ newConfig: config })
425 await servers[0].followsCommand.unfollow({ target: servers[2] }) 422 await servers[0].followsCommand.unfollow({ target: servers[2] })
426 await servers[2].followsCommand.unfollow({ target: servers[0] }) 423 await servers[2].followsCommand.unfollow({ target: servers[0] })
427 }) 424 })
@@ -430,7 +427,7 @@ describe('Test moderation notifications', function () {
430 this.timeout(30000) 427 this.timeout(30000)
431 await servers[0].followsCommand.unfollow({ target: servers[1] }) 428 await servers[0].followsCommand.unfollow({ target: servers[1] })
432 429
433 await updateCustomSubConfig(servers[0].url, servers[0].accessToken, config) 430 await servers[0].configCommand.updateCustomSubConfig({ newConfig: config })
434 431
435 await wait(5000) 432 await wait(5000)
436 await waitJobs(servers) 433 await waitJobs(servers)
@@ -440,7 +437,7 @@ describe('Test moderation notifications', function () {
440 await checkAutoInstanceFollowing(baseParams, followerHost, followingHost, 'presence') 437 await checkAutoInstanceFollowing(baseParams, followerHost, followingHost, 'presence')
441 438
442 config.followings.instance.autoFollowIndex.enabled = false 439 config.followings.instance.autoFollowIndex.enabled = false
443 await updateCustomSubConfig(servers[0].url, servers[0].accessToken, config) 440 await servers[0].configCommand.updateCustomSubConfig({ newConfig: config })
444 await servers[0].followsCommand.unfollow({ target: servers[1] }) 441 await servers[0].followsCommand.unfollow({ target: servers[1] })
445 }) 442 })
446 }) 443 })
@@ -476,8 +473,8 @@ describe('Test moderation notifications', function () {
476 token: userAccessToken 473 token: userAccessToken
477 } 474 }
478 475
479 const resCustomConfig = await getCustomConfig(servers[0].url, servers[0].accessToken) 476 currentCustomConfig = await servers[0].configCommand.getCustomConfig()
480 currentCustomConfig = resCustomConfig.body 477
481 const autoBlacklistTestsCustomConfig = immutableAssign(currentCustomConfig, { 478 const autoBlacklistTestsCustomConfig = immutableAssign(currentCustomConfig, {
482 autoBlacklist: { 479 autoBlacklist: {
483 videos: { 480 videos: {
@@ -487,9 +484,10 @@ describe('Test moderation notifications', function () {
487 } 484 }
488 } 485 }
489 }) 486 })
487
490 // enable transcoding otherwise own publish notification after transcoding not expected 488 // enable transcoding otherwise own publish notification after transcoding not expected
491 autoBlacklistTestsCustomConfig.transcoding.enabled = true 489 autoBlacklistTestsCustomConfig.transcoding.enabled = true
492 await updateCustomConfig(servers[0].url, servers[0].accessToken, autoBlacklistTestsCustomConfig) 490 await servers[0].configCommand.updateCustomConfig({ newCustomConfig: autoBlacklistTestsCustomConfig })
493 491
494 await addUserSubscription(servers[0].url, servers[0].accessToken, 'user_1_channel@localhost:' + servers[0].port) 492 await addUserSubscription(servers[0].url, servers[0].accessToken, 'user_1_channel@localhost:' + servers[0].port)
495 await addUserSubscription(servers[1].url, servers[1].accessToken, 'user_1_channel@localhost:' + servers[0].port) 493 await addUserSubscription(servers[1].url, servers[1].accessToken, 'user_1_channel@localhost:' + servers[0].port)
@@ -612,7 +610,7 @@ describe('Test moderation notifications', function () {
612 }) 610 })
613 611
614 after(async () => { 612 after(async () => {
615 await updateCustomConfig(servers[0].url, servers[0].accessToken, currentCustomConfig) 613 await servers[0].configCommand.updateCustomConfig({ newCustomConfig: currentCustomConfig })
616 614
617 await removeUserSubscription(servers[0].url, servers[0].accessToken, 'user_1_channel@localhost:' + servers[0].port) 615 await removeUserSubscription(servers[0].url, servers[0].accessToken, 'user_1_channel@localhost:' + servers[0].port)
618 await removeUserSubscription(servers[1].url, servers[1].accessToken, 'user_1_channel@localhost:' + servers[0].port) 616 await removeUserSubscription(servers[1].url, servers[1].accessToken, 'user_1_channel@localhost:' + servers[0].port)
diff --git a/server/tests/api/search/search-index.ts b/server/tests/api/search/search-index.ts
index b2c0857a7..e4c5f5796 100644
--- a/server/tests/api/search/search-index.ts
+++ b/server/tests/api/search/search-index.ts
@@ -9,7 +9,6 @@ import {
9 SearchCommand, 9 SearchCommand,
10 ServerInfo, 10 ServerInfo,
11 setAccessTokensToServers, 11 setAccessTokensToServers,
12 updateCustomSubConfig,
13 uploadVideo 12 uploadVideo
14} from '@shared/extra-utils' 13} from '@shared/extra-utils'
15import { VideoPlaylistPrivacy, VideoPlaylistType, VideosSearchQuery } from '@shared/models' 14import { VideoPlaylistPrivacy, VideoPlaylistType, VideosSearchQuery } from '@shared/models'
@@ -39,12 +38,14 @@ describe('Test videos search', function () {
39 it('Should make a local videos search by default', async function () { 38 it('Should make a local videos search by default', async function () {
40 this.timeout(10000) 39 this.timeout(10000)
41 40
42 await updateCustomSubConfig(server.url, server.accessToken, { 41 await server.configCommand.updateCustomSubConfig({
43 search: { 42 newConfig: {
44 searchIndex: { 43 search: {
45 enabled: true, 44 searchIndex: {
46 isDefaultSearch: false, 45 enabled: true,
47 disableLocalSearch: false 46 isDefaultSearch: false,
47 disableLocalSearch: false
48 }
48 } 49 }
49 } 50 }
50 }) 51 })
@@ -64,12 +65,14 @@ describe('Test videos search', function () {
64 }) 65 })
65 66
66 it('Should make an index videos search by default', async function () { 67 it('Should make an index videos search by default', async function () {
67 await updateCustomSubConfig(server.url, server.accessToken, { 68 await server.configCommand.updateCustomSubConfig({
68 search: { 69 newConfig: {
69 searchIndex: { 70 search: {
70 enabled: true, 71 searchIndex: {
71 isDefaultSearch: true, 72 enabled: true,
72 disableLocalSearch: false 73 isDefaultSearch: true,
74 disableLocalSearch: false
75 }
73 } 76 }
74 } 77 }
75 }) 78 })
@@ -84,12 +87,14 @@ describe('Test videos search', function () {
84 }) 87 })
85 88
86 it('Should make an index videos search if local search is disabled', async function () { 89 it('Should make an index videos search if local search is disabled', async function () {
87 await updateCustomSubConfig(server.url, server.accessToken, { 90 await server.configCommand.updateCustomSubConfig({
88 search: { 91 newConfig: {
89 searchIndex: { 92 search: {
90 enabled: true, 93 searchIndex: {
91 isDefaultSearch: false, 94 enabled: true,
92 disableLocalSearch: true 95 isDefaultSearch: false,
96 disableLocalSearch: true
97 }
93 } 98 }
94 } 99 }
95 }) 100 })
@@ -216,7 +221,11 @@ describe('Test videos search', function () {
216 let nsfwUUID: string 221 let nsfwUUID: string
217 222
218 { 223 {
219 await updateCustomSubConfig(server.url, server.accessToken, { instance: { defaultNSFWPolicy: 'display' } }) 224 await server.configCommand.updateCustomSubConfig({
225 newConfig: {
226 instance: { defaultNSFWPolicy: 'display' }
227 }
228 })
220 229
221 const body = await command.searchVideos({ search: 'NSFW search index', sort: '-match' }) 230 const body = await command.searchVideos({ search: 'NSFW search index', sort: '-match' })
222 expect(body.data).to.have.length.greaterThan(0) 231 expect(body.data).to.have.length.greaterThan(0)
@@ -228,7 +237,11 @@ describe('Test videos search', function () {
228 } 237 }
229 238
230 { 239 {
231 await updateCustomSubConfig(server.url, server.accessToken, { instance: { defaultNSFWPolicy: 'do_not_list' } }) 240 await server.configCommand.updateCustomSubConfig({
241 newConfig: {
242 instance: { defaultNSFWPolicy: 'do_not_list' }
243 }
244 })
232 245
233 const body = await command.searchVideos({ search: 'NSFW search index', sort: '-match' }) 246 const body = await command.searchVideos({ search: 'NSFW search index', sort: '-match' })
234 247
diff --git a/server/tests/api/search/search-videos.ts b/server/tests/api/search/search-videos.ts
index f0482c7e0..7dc89c447 100644
--- a/server/tests/api/search/search-videos.ts
+++ b/server/tests/api/search/search-videos.ts
@@ -14,7 +14,6 @@ import {
14 setAccessTokensToServers, 14 setAccessTokensToServers,
15 setDefaultVideoChannel, 15 setDefaultVideoChannel,
16 stopFfmpeg, 16 stopFfmpeg,
17 updateCustomSubConfig,
18 uploadVideo, 17 uploadVideo,
19 wait, 18 wait,
20 waitUntilLivePublished 19 waitUntilLivePublished
@@ -486,13 +485,13 @@ describe('Test videos search', function () {
486 this.timeout(30000) 485 this.timeout(30000)
487 486
488 { 487 {
489 const options = { 488 const newConfig = {
490 search: { 489 search: {
491 searchIndex: { enabled: false } 490 searchIndex: { enabled: false }
492 }, 491 },
493 live: { enabled: true } 492 live: { enabled: true }
494 } 493 }
495 await updateCustomSubConfig(server.url, server.accessToken, options) 494 await server.configCommand.updateCustomSubConfig({ newConfig })
496 } 495 }
497 496
498 { 497 {
diff --git a/server/tests/api/server/auto-follows.ts b/server/tests/api/server/auto-follows.ts
index 02389b1e9..34c4f6882 100644
--- a/server/tests/api/server/auto-follows.ts
+++ b/server/tests/api/server/auto-follows.ts
@@ -8,7 +8,6 @@ import {
8 MockInstancesIndex, 8 MockInstancesIndex,
9 ServerInfo, 9 ServerInfo,
10 setAccessTokensToServers, 10 setAccessTokensToServers,
11 updateCustomSubConfig,
12 wait, 11 wait,
13 waitJobs 12 waitJobs
14} from '@shared/extra-utils' 13} from '@shared/extra-utils'
@@ -87,7 +86,7 @@ describe('Test auto follows', function () {
87 } 86 }
88 } 87 }
89 } 88 }
90 await updateCustomSubConfig(servers[1].url, servers[1].accessToken, config) 89 await servers[1].configCommand.updateCustomSubConfig({ newConfig: config })
91 90
92 await server1Follows2(servers) 91 await server1Follows2(servers)
93 92
@@ -112,7 +111,7 @@ describe('Test auto follows', function () {
112 } 111 }
113 } 112 }
114 } 113 }
115 await updateCustomSubConfig(servers[1].url, servers[1].accessToken, config) 114 await servers[1].configCommand.updateCustomSubConfig({ newConfig: config })
116 115
117 await server1Follows2(servers) 116 await server1Follows2(servers)
118 117
@@ -129,7 +128,7 @@ describe('Test auto follows', function () {
129 128
130 config.followings.instance.autoFollowBack.enabled = false 129 config.followings.instance.autoFollowBack.enabled = false
131 config.followers.instance.manualApproval = false 130 config.followers.instance.manualApproval = false
132 await updateCustomSubConfig(servers[1].url, servers[1].accessToken, config) 131 await servers[1].configCommand.updateCustomSubConfig({ newConfig: config })
133 }) 132 })
134 }) 133 })
135 134
@@ -166,7 +165,7 @@ describe('Test auto follows', function () {
166 } 165 }
167 } 166 }
168 } 167 }
169 await updateCustomSubConfig(servers[0].url, servers[0].accessToken, config) 168 await servers[0].configCommand.updateCustomSubConfig({ newConfig: config })
170 169
171 await wait(5000) 170 await wait(5000)
172 await waitJobs(servers) 171 await waitJobs(servers)
diff --git a/server/tests/api/server/config.ts b/server/tests/api/server/config.ts
index 19bf9582c..037628c9d 100644
--- a/server/tests/api/server/config.ts
+++ b/server/tests/api/server/config.ts
@@ -2,15 +2,10 @@
2 2
3import 'mocha' 3import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { About } from '../../../../shared/models/server/about.model' 5import { HttpStatusCode } from '@shared/core-utils'
6import { CustomConfig } from '../../../../shared/models/server/custom-config.model'
7import { 6import {
8 cleanupTests, 7 cleanupTests,
9 deleteCustomConfig,
10 flushAndRunServer, 8 flushAndRunServer,
11 getAbout,
12 getConfig,
13 getCustomConfig,
14 killallServers, 9 killallServers,
15 makeGetRequest, 10 makeGetRequest,
16 parallelTests, 11 parallelTests,
@@ -18,11 +13,9 @@ import {
18 reRunServer, 13 reRunServer,
19 ServerInfo, 14 ServerInfo,
20 setAccessTokensToServers, 15 setAccessTokensToServers,
21 updateCustomConfig,
22 uploadVideo 16 uploadVideo
23} from '../../../../shared/extra-utils' 17} from '@shared/extra-utils'
24import { ServerConfig } from '../../../../shared/models' 18import { CustomConfig } from '@shared/models'
25import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
26 19
27const expect = chai.expect 20const expect = chai.expect
28 21
@@ -213,7 +206,7 @@ function checkUpdatedConfig (data: CustomConfig) {
213} 206}
214 207
215describe('Test config', function () { 208describe('Test config', function () {
216 let server = null 209 let server: ServerInfo = null
217 210
218 before(async function () { 211 before(async function () {
219 this.timeout(30000) 212 this.timeout(30000)
@@ -223,8 +216,7 @@ describe('Test config', function () {
223 }) 216 })
224 217
225 it('Should have a correct config on a server with registration enabled', async function () { 218 it('Should have a correct config on a server with registration enabled', async function () {
226 const res = await getConfig(server.url) 219 const data = await server.configCommand.getConfig()
227 const data: ServerConfig = res.body
228 220
229 expect(data.signup.allowed).to.be.true 221 expect(data.signup.allowed).to.be.true
230 }) 222 })
@@ -238,15 +230,13 @@ describe('Test config', function () {
238 registerUser(server.url, 'user3', 'super password') 230 registerUser(server.url, 'user3', 'super password')
239 ]) 231 ])
240 232
241 const res = await getConfig(server.url) 233 const data = await server.configCommand.getConfig()
242 const data: ServerConfig = res.body
243 234
244 expect(data.signup.allowed).to.be.false 235 expect(data.signup.allowed).to.be.false
245 }) 236 })
246 237
247 it('Should have the correct video allowed extensions', async function () { 238 it('Should have the correct video allowed extensions', async function () {
248 const res = await getConfig(server.url) 239 const data = await server.configCommand.getConfig()
249 const data: ServerConfig = res.body
250 240
251 expect(data.video.file.extensions).to.have.lengthOf(3) 241 expect(data.video.file.extensions).to.have.lengthOf(3)
252 expect(data.video.file.extensions).to.contain('.mp4') 242 expect(data.video.file.extensions).to.contain('.mp4')
@@ -260,8 +250,7 @@ describe('Test config', function () {
260 }) 250 })
261 251
262 it('Should get the customized configuration', async function () { 252 it('Should get the customized configuration', async function () {
263 const res = await getCustomConfig(server.url, server.accessToken) 253 const data = await server.configCommand.getCustomConfig()
264 const data = res.body as CustomConfig
265 254
266 checkInitialConfig(server, data) 255 checkInitialConfig(server, data)
267 }) 256 })
@@ -438,19 +427,16 @@ describe('Test config', function () {
438 } 427 }
439 } 428 }
440 } 429 }
441 await updateCustomConfig(server.url, server.accessToken, newCustomConfig) 430 await server.configCommand.updateCustomConfig({ newCustomConfig })
442
443 const res = await getCustomConfig(server.url, server.accessToken)
444 const data = res.body
445 431
432 const data = await server.configCommand.getCustomConfig()
446 checkUpdatedConfig(data) 433 checkUpdatedConfig(data)
447 }) 434 })
448 435
449 it('Should have the correct updated video allowed extensions', async function () { 436 it('Should have the correct updated video allowed extensions', async function () {
450 this.timeout(10000) 437 this.timeout(10000)
451 438
452 const res = await getConfig(server.url) 439 const data = await server.configCommand.getConfig()
453 const data: ServerConfig = res.body
454 440
455 expect(data.video.file.extensions).to.have.length.above(4) 441 expect(data.video.file.extensions).to.have.length.above(4)
456 expect(data.video.file.extensions).to.contain('.mp4') 442 expect(data.video.file.extensions).to.contain('.mp4')
@@ -474,15 +460,13 @@ describe('Test config', function () {
474 460
475 await reRunServer(server) 461 await reRunServer(server)
476 462
477 const res = await getCustomConfig(server.url, server.accessToken) 463 const data = await server.configCommand.getCustomConfig()
478 const data = res.body
479 464
480 checkUpdatedConfig(data) 465 checkUpdatedConfig(data)
481 }) 466 })
482 467
483 it('Should fetch the about information', async function () { 468 it('Should fetch the about information', async function () {
484 const res = await getAbout(server.url) 469 const data = await server.configCommand.getAbout()
485 const data: About = res.body
486 470
487 expect(data.instance.name).to.equal('PeerTube updated') 471 expect(data.instance.name).to.equal('PeerTube updated')
488 expect(data.instance.shortDescription).to.equal('my short description') 472 expect(data.instance.shortDescription).to.equal('my short description')
@@ -504,11 +488,9 @@ describe('Test config', function () {
504 it('Should remove the custom configuration', async function () { 488 it('Should remove the custom configuration', async function () {
505 this.timeout(10000) 489 this.timeout(10000)
506 490
507 await deleteCustomConfig(server.url, server.accessToken) 491 await server.configCommand.deleteCustomConfig()
508
509 const res = await getCustomConfig(server.url, server.accessToken)
510 const data = res.body
511 492
493 const data = await server.configCommand.getCustomConfig()
512 checkInitialConfig(server, data) 494 checkInitialConfig(server, data)
513 }) 495 })
514 496
diff --git a/server/tests/api/server/follows-moderation.ts b/server/tests/api/server/follows-moderation.ts
index 4853b647d..6d6eca9a8 100644
--- a/server/tests/api/server/follows-moderation.ts
+++ b/server/tests/api/server/follows-moderation.ts
@@ -8,7 +8,6 @@ import {
8 FollowsCommand, 8 FollowsCommand,
9 ServerInfo, 9 ServerInfo,
10 setAccessTokensToServers, 10 setAccessTokensToServers,
11 updateCustomSubConfig,
12 waitJobs 11 waitJobs
13} from '@shared/extra-utils' 12} from '@shared/extra-utils'
14 13
@@ -94,7 +93,7 @@ describe('Test follows moderation', function () {
94 } 93 }
95 } 94 }
96 95
97 await updateCustomSubConfig(servers[1].url, servers[1].accessToken, subConfig) 96 await servers[1].configCommand.updateCustomSubConfig({ newConfig: subConfig })
98 97
99 await commands[0].follow({ targets: [ servers[1].url ] }) 98 await commands[0].follow({ targets: [ servers[1].url ] })
100 await waitJobs(servers) 99 await waitJobs(servers)
@@ -114,7 +113,7 @@ describe('Test follows moderation', function () {
114 } 113 }
115 } 114 }
116 115
117 await updateCustomSubConfig(servers[1].url, servers[1].accessToken, subConfig) 116 await servers[1].configCommand.updateCustomSubConfig({ newConfig: subConfig })
118 117
119 await commands[0].follow({ targets: [ servers[1].url ] }) 118 await commands[0].follow({ targets: [ servers[1].url ] })
120 await waitJobs(servers) 119 await waitJobs(servers)
@@ -137,8 +136,8 @@ describe('Test follows moderation', function () {
137 } 136 }
138 } 137 }
139 138
140 await updateCustomSubConfig(servers[1].url, servers[1].accessToken, subConfig) 139 await servers[1].configCommand.updateCustomSubConfig({ newConfig: subConfig })
141 await updateCustomSubConfig(servers[2].url, servers[2].accessToken, subConfig) 140 await servers[2].configCommand.updateCustomSubConfig({ newConfig: subConfig })
142 141
143 await commands[0].follow({ targets: [ servers[1].url ] }) 142 await commands[0].follow({ targets: [ servers[1].url ] })
144 await waitJobs(servers) 143 await waitJobs(servers)
diff --git a/server/tests/api/server/homepage.ts b/server/tests/api/server/homepage.ts
index 4a3ec0479..c08067f3c 100644
--- a/server/tests/api/server/homepage.ts
+++ b/server/tests/api/server/homepage.ts
@@ -3,12 +3,10 @@
3import 'mocha' 3import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { HttpStatusCode } from '@shared/core-utils' 5import { HttpStatusCode } from '@shared/core-utils'
6import { ServerConfig } from '@shared/models'
7import { 6import {
8 cleanupTests, 7 cleanupTests,
9 CustomPagesCommand, 8 CustomPagesCommand,
10 flushAndRunServer, 9 flushAndRunServer,
11 getConfig,
12 killallServers, 10 killallServers,
13 reRunServer, 11 reRunServer,
14 ServerInfo, 12 ServerInfo,
@@ -18,9 +16,8 @@ import {
18const expect = chai.expect 16const expect = chai.expect
19 17
20async function getHomepageState (server: ServerInfo) { 18async function getHomepageState (server: ServerInfo) {
21 const res = await getConfig(server.url) 19 const config = await server.configCommand.getConfig()
22 20
23 const config = res.body as ServerConfig
24 return config.homepage.enabled 21 return config.homepage.enabled
25} 22}
26 23
diff --git a/server/tests/api/server/plugins.ts b/server/tests/api/server/plugins.ts
index 1536997d5..528bbbe58 100644
--- a/server/tests/api/server/plugins.ts
+++ b/server/tests/api/server/plugins.ts
@@ -7,7 +7,6 @@ import {
7 cleanupTests, 7 cleanupTests,
8 closeAllSequelize, 8 closeAllSequelize,
9 flushAndRunServer, 9 flushAndRunServer,
10 getConfig,
11 getMyUserInformation, 10 getMyUserInformation,
12 killallServers, 11 killallServers,
13 PluginsCommand, 12 PluginsCommand,
@@ -16,12 +15,11 @@ import {
16 setAccessTokensToServers, 15 setAccessTokensToServers,
17 setPluginVersion, 16 setPluginVersion,
18 testHelloWorldRegisteredSettings, 17 testHelloWorldRegisteredSettings,
19 updateCustomSubConfig,
20 updateMyUser, 18 updateMyUser,
21 wait, 19 wait,
22 waitUntilLog 20 waitUntilLog
23} from '@shared/extra-utils' 21} from '@shared/extra-utils'
24import { PluginType, ServerConfig, User } from '@shared/models' 22import { PluginType, User } from '@shared/models'
25 23
26const expect = chai.expect 24const expect = chai.expect
27 25
@@ -102,8 +100,7 @@ describe('Test plugins', function () {
102 }) 100 })
103 101
104 it('Should have the plugin loaded in the configuration', async function () { 102 it('Should have the plugin loaded in the configuration', async function () {
105 const res = await getConfig(server.url) 103 const config = await server.configCommand.getConfig()
106 const config: ServerConfig = res.body
107 104
108 const theme = config.theme.registered.find(r => r.name === 'background-red') 105 const theme = config.theme.registered.find(r => r.name === 'background-red')
109 expect(theme).to.not.be.undefined 106 expect(theme).to.not.be.undefined
@@ -113,11 +110,13 @@ describe('Test plugins', function () {
113 }) 110 })
114 111
115 it('Should update the default theme in the configuration', async function () { 112 it('Should update the default theme in the configuration', async function () {
116 await updateCustomSubConfig(server.url, server.accessToken, { theme: { default: 'background-red' } }) 113 await server.configCommand.updateCustomSubConfig({
117 114 newConfig: {
118 const res = await getConfig(server.url) 115 theme: { default: 'background-red' }
119 const config: ServerConfig = res.body 116 }
117 })
120 118
119 const config = await server.configCommand.getConfig()
121 expect(config.theme.default).to.equal('background-red') 120 expect(config.theme.default).to.equal('background-red')
122 }) 121 })
123 122
@@ -302,9 +301,7 @@ describe('Test plugins', function () {
302 }) 301 })
303 302
304 it('Should have updated the configuration', async function () { 303 it('Should have updated the configuration', async function () {
305 // get /config (default theme + registered themes + registered plugins) 304 const config = await server.configCommand.getConfig()
306 const res = await getConfig(server.url)
307 const config: ServerConfig = res.body
308 305
309 expect(config.theme.default).to.equal('default') 306 expect(config.theme.default).to.equal('default')
310 307
diff --git a/server/tests/api/server/stats.ts b/server/tests/api/server/stats.ts
index 36114a297..f01188d67 100644
--- a/server/tests/api/server/stats.ts
+++ b/server/tests/api/server/stats.ts
@@ -12,7 +12,6 @@ import {
12 flushAndRunMultipleServers, 12 flushAndRunMultipleServers,
13 ServerInfo, 13 ServerInfo,
14 setAccessTokensToServers, 14 setAccessTokensToServers,
15 updateCustomSubConfig,
16 uploadVideo, 15 uploadVideo,
17 userLogin, 16 userLogin,
18 viewVideo, 17 viewVideo,
@@ -197,24 +196,26 @@ describe('Test stats (excluding redundancy)', function () {
197 it('Should correctly count video file sizes if transcoding is enabled', async function () { 196 it('Should correctly count video file sizes if transcoding is enabled', async function () {
198 this.timeout(60000) 197 this.timeout(60000)
199 198
200 await updateCustomSubConfig(servers[0].url, servers[0].accessToken, { 199 await servers[0].configCommand.updateCustomSubConfig({
201 transcoding: { 200 newConfig: {
202 enabled: true, 201 transcoding: {
203 webtorrent: { 202 enabled: true,
204 enabled: true 203 webtorrent: {
205 }, 204 enabled: true
206 hls: { 205 },
207 enabled: true 206 hls: {
208 }, 207 enabled: true
209 resolutions: { 208 },
210 '0p': false, 209 resolutions: {
211 '240p': false, 210 '0p': false,
212 '360p': false, 211 '240p': false,
213 '480p': false, 212 '360p': false,
214 '720p': false, 213 '480p': false,
215 '1080p': false, 214 '720p': false,
216 '1440p': false, 215 '1080p': false,
217 '2160p': false 216 '1440p': false,
217 '2160p': false
218 }
218 } 219 }
219 } 220 }
220 }) 221 })
@@ -238,9 +239,11 @@ describe('Test stats (excluding redundancy)', function () {
238 it('Should have the correct AP stats', async function () { 239 it('Should have the correct AP stats', async function () {
239 this.timeout(60000) 240 this.timeout(60000)
240 241
241 await updateCustomSubConfig(servers[0].url, servers[0].accessToken, { 242 await servers[0].configCommand.updateCustomSubConfig({
242 transcoding: { 243 newConfig: {
243 enabled: false 244 transcoding: {
245 enabled: false
246 }
244 } 247 }
245 }) 248 })
246 249
diff --git a/server/tests/api/users/users-verification.ts b/server/tests/api/users/users-verification.ts
index 265cd6050..23f81d804 100644
--- a/server/tests/api/users/users-verification.ts
+++ b/server/tests/api/users/users-verification.ts
@@ -11,7 +11,6 @@ import {
11 login, 11 login,
12 registerUser, 12 registerUser,
13 ServerInfo, 13 ServerInfo,
14 updateCustomSubConfig,
15 updateMyUser, 14 updateMyUser,
16 userLogin, 15 userLogin,
17 verifyEmail 16 verifyEmail
@@ -58,11 +57,13 @@ describe('Test users account verification', function () {
58 it('Should register user and send verification email if verification required', async function () { 57 it('Should register user and send verification email if verification required', async function () {
59 this.timeout(30000) 58 this.timeout(30000)
60 59
61 await updateCustomSubConfig(server.url, server.accessToken, { 60 await server.configCommand.updateCustomSubConfig({
62 signup: { 61 newConfig: {
63 enabled: true, 62 signup: {
64 requiresEmailVerification: true, 63 enabled: true,
65 limit: 10 64 requiresEmailVerification: true,
65 limit: 10
66 }
66 } 67 }
67 }) 68 })
68 69
@@ -148,11 +149,13 @@ describe('Test users account verification', function () {
148 149
149 it('Should register user not requiring email verification if setting not enabled', async function () { 150 it('Should register user not requiring email verification if setting not enabled', async function () {
150 this.timeout(5000) 151 this.timeout(5000)
151 await updateCustomSubConfig(server.url, server.accessToken, { 152 await server.configCommand.updateCustomSubConfig({
152 signup: { 153 newConfig: {
153 enabled: true, 154 signup: {
154 requiresEmailVerification: false, 155 enabled: true,
155 limit: 10 156 requiresEmailVerification: false,
157 limit: 10
158 }
156 } 159 }
157 }) 160 })
158 161
@@ -168,11 +171,13 @@ describe('Test users account verification', function () {
168 }) 171 })
169 172
170 it('Should allow login for user with unverified email when setting later enabled', async function () { 173 it('Should allow login for user with unverified email when setting later enabled', async function () {
171 await updateCustomSubConfig(server.url, server.accessToken, { 174 await server.configCommand.updateCustomSubConfig({
172 signup: { 175 newConfig: {
173 enabled: true, 176 signup: {
174 requiresEmailVerification: true, 177 enabled: true,
175 limit: 10 178 requiresEmailVerification: true,
179 limit: 10
180 }
176 } 181 }
177 }) 182 })
178 183
diff --git a/server/tests/api/users/users.ts b/server/tests/api/users/users.ts
index ba4183e08..33bcc8701 100644
--- a/server/tests/api/users/users.ts
+++ b/server/tests/api/users/users.ts
@@ -13,7 +13,6 @@ import {
13 flushAndRunServer, 13 flushAndRunServer,
14 getAccountRatings, 14 getAccountRatings,
15 getBlacklistedVideosList, 15 getBlacklistedVideosList,
16 getCustomConfig,
17 getMyUserInformation, 16 getMyUserInformation,
18 getMyUserVideoQuotaUsed, 17 getMyUserVideoQuotaUsed,
19 getMyUserVideoRating, 18 getMyUserVideoRating,
@@ -38,7 +37,6 @@ import {
38 setTokenField, 37 setTokenField,
39 testImage, 38 testImage,
40 unblockUser, 39 unblockUser,
41 updateCustomSubConfig,
42 updateMyAvatar, 40 updateMyAvatar,
43 updateMyUser, 41 updateMyUser,
44 updateUser, 42 updateUser,
@@ -46,7 +44,7 @@ import {
46 userLogin, 44 userLogin,
47 waitJobs 45 waitJobs
48} from '@shared/extra-utils' 46} from '@shared/extra-utils'
49import { AbuseState, CustomConfig, MyUser, OAuth2ErrorCode, User, UserAdminFlag, UserRole, Video, VideoPlaylistType } from '@shared/models' 47import { AbuseState, MyUser, OAuth2ErrorCode, User, UserAdminFlag, UserRole, Video, VideoPlaylistType } from '@shared/models'
50 48
51const expect = chai.expect 49const expect = chai.expect
52 50
@@ -418,12 +416,11 @@ describe('Test users', function () {
418 this.timeout(60000) 416 this.timeout(60000)
419 417
420 { 418 {
421 const res = await getCustomConfig(server.url, server.accessToken) 419 const config = await server.configCommand.getCustomConfig()
422 const config = res.body as CustomConfig
423 config.transcoding.webtorrent.enabled = false 420 config.transcoding.webtorrent.enabled = false
424 config.transcoding.hls.enabled = true 421 config.transcoding.hls.enabled = true
425 config.transcoding.enabled = true 422 config.transcoding.enabled = true
426 await updateCustomSubConfig(server.url, server.accessToken, config) 423 await server.configCommand.updateCustomSubConfig({ newConfig: config })
427 } 424 }
428 425
429 { 426 {
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',
diff --git a/server/tests/cli/create-transcoding-job.ts b/server/tests/cli/create-transcoding-job.ts
index be46dec25..e3211882d 100644
--- a/server/tests/cli/create-transcoding-job.ts
+++ b/server/tests/cli/create-transcoding-job.ts
@@ -10,7 +10,6 @@ import {
10 getVideosList, 10 getVideosList,
11 ServerInfo, 11 ServerInfo,
12 setAccessTokensToServers, 12 setAccessTokensToServers,
13 updateCustomSubConfig,
14 uploadVideo 13 uploadVideo
15} from '../../../shared/extra-utils' 14} from '../../../shared/extra-utils'
16import { waitJobs } from '../../../shared/extra-utils/server/jobs' 15import { waitJobs } from '../../../shared/extra-utils/server/jobs'
@@ -47,7 +46,7 @@ describe('Test create transcoding jobs', function () {
47 servers = await flushAndRunMultipleServers(2) 46 servers = await flushAndRunMultipleServers(2)
48 await setAccessTokensToServers(servers) 47 await setAccessTokensToServers(servers)
49 48
50 await updateCustomSubConfig(servers[0].url, servers[0].accessToken, config) 49 await servers[0].configCommand.updateCustomSubConfig({ newConfig: config })
51 50
52 await doubleFollow(servers[0], servers[1]) 51 await doubleFollow(servers[0], servers[1])
53 52
@@ -199,7 +198,7 @@ describe('Test create transcoding jobs', function () {
199 this.timeout(120000) 198 this.timeout(120000)
200 199
201 config.transcoding.hls.enabled = true 200 config.transcoding.hls.enabled = true
202 await updateCustomSubConfig(servers[0].url, servers[0].accessToken, config) 201 await servers[0].configCommand.updateCustomSubConfig({ newConfig: config })
203 202
204 await servers[0].cliCommand.execWithEnv(`npm run create-transcoding-job -- -v ${videosUUID[4]}`) 203 await servers[0].cliCommand.execWithEnv(`npm run create-transcoding-job -- -v ${videosUUID[4]}`)
205 204
diff --git a/server/tests/cli/plugins.ts b/server/tests/cli/plugins.ts
index 7b8746a5d..e5efae36b 100644
--- a/server/tests/cli/plugins.ts
+++ b/server/tests/cli/plugins.ts
@@ -5,14 +5,12 @@ import { expect } from 'chai'
5import { 5import {
6 cleanupTests, 6 cleanupTests,
7 flushAndRunServer, 7 flushAndRunServer,
8 getConfig,
9 killallServers, 8 killallServers,
10 PluginsCommand, 9 PluginsCommand,
11 reRunServer, 10 reRunServer,
12 ServerInfo, 11 ServerInfo,
13 setAccessTokensToServers 12 setAccessTokensToServers
14} from '../../../shared/extra-utils' 13} from '../../../shared/extra-utils'
15import { ServerConfig } from '../../../shared/models/server'
16 14
17describe('Test plugin scripts', function () { 15describe('Test plugin scripts', function () {
18 let server: ServerInfo 16 let server: ServerInfo
@@ -44,8 +42,7 @@ describe('Test plugin scripts', function () {
44 killallServers([ server ]) 42 killallServers([ server ])
45 await reRunServer(server) 43 await reRunServer(server)
46 44
47 const res = await getConfig(server.url) 45 const config = await server.configCommand.getConfig()
48 const config: ServerConfig = res.body
49 46
50 const plugin = config.plugin.registered 47 const plugin = config.plugin.registered
51 .find(p => p.name === 'test') 48 .find(p => p.name === 'test')
@@ -68,8 +65,7 @@ describe('Test plugin scripts', function () {
68 killallServers([ server ]) 65 killallServers([ server ])
69 await reRunServer(server) 66 await reRunServer(server)
70 67
71 const res = await getConfig(server.url) 68 const config = await server.configCommand.getConfig()
72 const config: ServerConfig = res.body
73 69
74 const plugin = config.plugin.registered 70 const plugin = config.plugin.registered
75 .find(p => p.name === 'test') 71 .find(p => p.name === 'test')
diff --git a/server/tests/client.ts b/server/tests/client.ts
index 7c4fb4e46..be7ce18b4 100644
--- a/server/tests/client.ts
+++ b/server/tests/client.ts
@@ -4,7 +4,7 @@ import 'mocha'
4import * as chai from 'chai' 4import * as chai from 'chai'
5import { omit } from 'lodash' 5import { omit } from 'lodash'
6import { HttpStatusCode } from '@shared/core-utils/miscs/http-error-codes' 6import { HttpStatusCode } from '@shared/core-utils/miscs/http-error-codes'
7import { Account, CustomConfig, HTMLServerConfig, ServerConfig, VideoPlaylistCreateResult, VideoPlaylistPrivacy } from '@shared/models' 7import { Account, HTMLServerConfig, ServerConfig, VideoPlaylistCreateResult, VideoPlaylistPrivacy } from '@shared/models'
8import { 8import {
9 addVideoInPlaylist, 9 addVideoInPlaylist,
10 cleanupTests, 10 cleanupTests,
@@ -12,16 +12,12 @@ import {
12 doubleFollow, 12 doubleFollow,
13 flushAndRunMultipleServers, 13 flushAndRunMultipleServers,
14 getAccount, 14 getAccount,
15 getConfig,
16 getCustomConfig,
17 getVideosList, 15 getVideosList,
18 makeGetRequest, 16 makeGetRequest,
19 makeHTMLRequest, 17 makeHTMLRequest,
20 ServerInfo, 18 ServerInfo,
21 setAccessTokensToServers, 19 setAccessTokensToServers,
22 setDefaultVideoChannel, 20 setDefaultVideoChannel,
23 updateCustomConfig,
24 updateCustomSubConfig,
25 updateMyUser, 21 updateMyUser,
26 updateVideoChannel, 22 updateVideoChannel,
27 uploadVideo, 23 uploadVideo,
@@ -307,14 +303,13 @@ describe('Test a client controllers', function () {
307 describe('Whitelisted', function () { 303 describe('Whitelisted', function () {
308 304
309 before(async function () { 305 before(async function () {
310 const res = await getCustomConfig(servers[0].url, servers[0].accessToken) 306 const config = await servers[0].configCommand.getCustomConfig()
311 const config = res.body as CustomConfig
312 config.services.twitter = { 307 config.services.twitter = {
313 username: '@Kuja', 308 username: '@Kuja',
314 whitelisted: true 309 whitelisted: true
315 } 310 }
316 311
317 await updateCustomConfig(servers[0].url, servers[0].accessToken, config) 312 await servers[0].configCommand.updateCustomConfig({ newCustomConfig: config })
318 }) 313 })
319 314
320 async function accountPageTest (path: string) { 315 async function accountPageTest (path: string) {
@@ -382,40 +377,42 @@ describe('Test a client controllers', function () {
382 describe('Index HTML', function () { 377 describe('Index HTML', function () {
383 378
384 it('Should have valid index html tags (title, description...)', async function () { 379 it('Should have valid index html tags (title, description...)', async function () {
385 const resConfig = await getConfig(servers[0].url) 380 const config = await servers[0].configCommand.getConfig()
386 const res = await makeHTMLRequest(servers[0].url, '/videos/trending') 381 const res = await makeHTMLRequest(servers[0].url, '/videos/trending')
387 382
388 const description = 'PeerTube, an ActivityPub-federated video streaming platform using P2P directly in your web browser.' 383 const description = 'PeerTube, an ActivityPub-federated video streaming platform using P2P directly in your web browser.'
389 checkIndexTags(res.text, 'PeerTube', description, '', resConfig.body) 384 checkIndexTags(res.text, 'PeerTube', description, '', config)
390 }) 385 })
391 386
392 it('Should update the customized configuration and have the correct index html tags', async function () { 387 it('Should update the customized configuration and have the correct index html tags', async function () {
393 await updateCustomSubConfig(servers[0].url, servers[0].accessToken, { 388 await servers[0].configCommand.updateCustomSubConfig({
394 instance: { 389 newConfig: {
395 name: 'PeerTube updated', 390 instance: {
396 shortDescription: 'my short description', 391 name: 'PeerTube updated',
397 description: 'my super description', 392 shortDescription: 'my short description',
398 terms: 'my super terms', 393 description: 'my super description',
399 defaultNSFWPolicy: 'blur', 394 terms: 'my super terms',
400 defaultClientRoute: '/videos/recently-added', 395 defaultNSFWPolicy: 'blur',
401 customizations: { 396 defaultClientRoute: '/videos/recently-added',
402 javascript: 'alert("coucou")', 397 customizations: {
403 css: 'body { background-color: red; }' 398 javascript: 'alert("coucou")',
399 css: 'body { background-color: red; }'
400 }
404 } 401 }
405 } 402 }
406 }) 403 })
407 404
408 const resConfig = await getConfig(servers[0].url) 405 const config = await servers[0].configCommand.getConfig()
409 const res = await makeHTMLRequest(servers[0].url, '/videos/trending') 406 const res = await makeHTMLRequest(servers[0].url, '/videos/trending')
410 407
411 checkIndexTags(res.text, 'PeerTube updated', 'my short description', 'body { background-color: red; }', resConfig.body) 408 checkIndexTags(res.text, 'PeerTube updated', 'my short description', 'body { background-color: red; }', config)
412 }) 409 })
413 410
414 it('Should have valid index html updated tags (title, description...)', async function () { 411 it('Should have valid index html updated tags (title, description...)', async function () {
415 const resConfig = await getConfig(servers[0].url) 412 const config = await servers[0].configCommand.getConfig()
416 const res = await makeHTMLRequest(servers[0].url, '/videos/trending') 413 const res = await makeHTMLRequest(servers[0].url, '/videos/trending')
417 414
418 checkIndexTags(res.text, 'PeerTube updated', 'my short description', 'body { background-color: red; }', resConfig.body) 415 checkIndexTags(res.text, 'PeerTube updated', 'my short description', 'body { background-color: red; }', config)
419 }) 416 })
420 417
421 it('Should use the original video URL for the canonical tag', async function () { 418 it('Should use the original video URL for the canonical tag', async function () {
@@ -428,7 +425,7 @@ describe('Test a client controllers', function () {
428 }) 425 })
429 426
430 it('Should use the original account URL for the canonical tag', async function () { 427 it('Should use the original account URL for the canonical tag', async function () {
431 const accountURLtest = (res) => { 428 const accountURLtest = res => {
432 expect(res.text).to.contain(`<link rel="canonical" href="${servers[0].url}/accounts/root" />`) 429 expect(res.text).to.contain(`<link rel="canonical" href="${servers[0].url}/accounts/root" />`)
433 } 430 }
434 431
@@ -438,7 +435,7 @@ describe('Test a client controllers', function () {
438 }) 435 })
439 436
440 it('Should use the original channel URL for the canonical tag', async function () { 437 it('Should use the original channel URL for the canonical tag', async function () {
441 const channelURLtests = (res) => { 438 const channelURLtests = res => {
442 expect(res.text).to.contain(`<link rel="canonical" href="${servers[0].url}/video-channels/root_channel" />`) 439 expect(res.text).to.contain(`<link rel="canonical" href="${servers[0].url}/video-channels/root_channel" />`)
443 } 440 }
444 441
@@ -460,10 +457,10 @@ describe('Test a client controllers', function () {
460 describe('Embed HTML', function () { 457 describe('Embed HTML', function () {
461 458
462 it('Should have the correct embed html tags', async function () { 459 it('Should have the correct embed html tags', async function () {
463 const resConfig = await getConfig(servers[0].url) 460 const config = await servers[0].configCommand.getConfig()
464 const res = await makeHTMLRequest(servers[0].url, servers[0].video.embedPath) 461 const res = await makeHTMLRequest(servers[0].url, servers[0].video.embedPath)
465 462
466 checkIndexTags(res.text, 'PeerTube updated', 'my short description', 'body { background-color: red; }', resConfig.body) 463 checkIndexTags(res.text, 'PeerTube updated', 'my short description', 'body { background-color: red; }', config)
467 }) 464 })
468 }) 465 })
469 466
diff --git a/server/tests/plugins/external-auth.ts b/server/tests/plugins/external-auth.ts
index 424302786..09a107ca2 100644
--- a/server/tests/plugins/external-auth.ts
+++ b/server/tests/plugins/external-auth.ts
@@ -8,7 +8,6 @@ import {
8 createUser, 8 createUser,
9 decodeQueryString, 9 decodeQueryString,
10 flushAndRunServer, 10 flushAndRunServer,
11 getConfig,
12 getMyUserInformation, 11 getMyUserInformation,
13 loginUsingExternalToken, 12 loginUsingExternalToken,
14 logout, 13 logout,
@@ -21,7 +20,7 @@ import {
21 wait, 20 wait,
22 waitUntilLog 21 waitUntilLog
23} from '@shared/extra-utils' 22} from '@shared/extra-utils'
24import { ServerConfig, User, UserRole } from '@shared/models' 23import { User, UserRole } from '@shared/models'
25 24
26async function loginExternal (options: { 25async function loginExternal (options: {
27 server: ServerInfo 26 server: ServerInfo
@@ -78,9 +77,7 @@ describe('Test external auth plugins', function () {
78 }) 77 })
79 78
80 it('Should display the correct configuration', async function () { 79 it('Should display the correct configuration', async function () {
81 const res = await getConfig(server.url) 80 const config = await server.configCommand.getConfig()
82
83 const config: ServerConfig = res.body
84 81
85 const auths = config.plugin.registeredExternalAuths 82 const auths = config.plugin.registeredExternalAuths
86 expect(auths).to.have.lengthOf(8) 83 expect(auths).to.have.lengthOf(8)
@@ -288,9 +285,7 @@ describe('Test external auth plugins', function () {
288 }) 285 })
289 286
290 it('Should have disabled this auth', async function () { 287 it('Should have disabled this auth', async function () {
291 const res = await getConfig(server.url) 288 const config = await server.configCommand.getConfig()
292
293 const config: ServerConfig = res.body
294 289
295 const auths = config.plugin.registeredExternalAuths 290 const auths = config.plugin.registeredExternalAuths
296 expect(auths).to.have.lengthOf(7) 291 expect(auths).to.have.lengthOf(7)
@@ -354,9 +349,7 @@ describe('Test external auth plugins', function () {
354 }) 349 })
355 350
356 it('Should display the correct configuration', async function () { 351 it('Should display the correct configuration', async function () {
357 const res = await getConfig(server.url) 352 const config = await server.configCommand.getConfig()
358
359 const config: ServerConfig = res.body
360 353
361 const auths = config.plugin.registeredExternalAuths 354 const auths = config.plugin.registeredExternalAuths
362 expect(auths).to.have.lengthOf(6) 355 expect(auths).to.have.lengthOf(6)
diff --git a/server/tests/plugins/filter-hooks.ts b/server/tests/plugins/filter-hooks.ts
index c51e96ab7..e254046bf 100644
--- a/server/tests/plugins/filter-hooks.ts
+++ b/server/tests/plugins/filter-hooks.ts
@@ -12,7 +12,6 @@ import {
12 doubleFollow, 12 doubleFollow,
13 flushAndRunMultipleServers, 13 flushAndRunMultipleServers,
14 getAccountVideos, 14 getAccountVideos,
15 getConfig,
16 getMyVideos, 15 getMyVideos,
17 getVideo, 16 getVideo,
18 getVideoChannelVideos, 17 getVideoChannelVideos,
@@ -28,7 +27,6 @@ import {
28 ServerInfo, 27 ServerInfo,
29 setAccessTokensToServers, 28 setAccessTokensToServers,
30 setDefaultVideoChannel, 29 setDefaultVideoChannel,
31 updateCustomSubConfig,
32 updateVideo, 30 updateVideo,
33 uploadVideo, 31 uploadVideo,
34 uploadVideoAndGetId, 32 uploadVideoAndGetId,
@@ -37,7 +35,6 @@ import {
37} from '@shared/extra-utils' 35} from '@shared/extra-utils'
38import { getGoodVideoUrl, getMyVideoImports, importVideo } from '@shared/extra-utils/videos/video-imports' 36import { getGoodVideoUrl, getMyVideoImports, importVideo } from '@shared/extra-utils/videos/video-imports'
39import { 37import {
40 ServerConfig,
41 VideoCommentThreadTree, 38 VideoCommentThreadTree,
42 VideoDetails, 39 VideoDetails,
43 VideoImport, 40 VideoImport,
@@ -72,13 +69,15 @@ describe('Test plugin filter hooks', function () {
72 const res = await getVideosList(servers[0].url) 69 const res = await getVideosList(servers[0].url)
73 videoUUID = res.body.data[0].uuid 70 videoUUID = res.body.data[0].uuid
74 71
75 await updateCustomSubConfig(servers[0].url, servers[0].accessToken, { 72 await servers[0].configCommand.updateCustomSubConfig({
76 live: { enabled: true }, 73 newConfig: {
77 signup: { enabled: true }, 74 live: { enabled: true },
78 import: { 75 signup: { enabled: true },
79 videos: { 76 import: {
80 http: { enabled: true }, 77 videos: {
81 torrent: { enabled: true } 78 http: { enabled: true },
79 torrent: { enabled: true }
80 }
82 } 81 }
83 } 82 }
84 }) 83 })
@@ -344,8 +343,8 @@ describe('Test plugin filter hooks', function () {
344 describe('Should run filter:api.user.signup.allowed.result', function () { 343 describe('Should run filter:api.user.signup.allowed.result', function () {
345 344
346 it('Should run on config endpoint', async function () { 345 it('Should run on config endpoint', async function () {
347 const res = await getConfig(servers[0].url) 346 const body = await servers[0].configCommand.getConfig()
348 expect((res.body as ServerConfig).signup.allowed).to.be.true 347 expect(body.signup.allowed).to.be.true
349 }) 348 })
350 349
351 it('Should allow a signup', async function () { 350 it('Should allow a signup', async function () {
@@ -365,13 +364,15 @@ describe('Test plugin filter hooks', function () {
365 before(async function () { 364 before(async function () {
366 this.timeout(120000) 365 this.timeout(120000)
367 366
368 await updateCustomSubConfig(servers[0].url, servers[0].accessToken, { 367 await servers[0].configCommand.updateCustomSubConfig({
369 transcoding: { 368 newConfig: {
370 webtorrent: { 369 transcoding: {
371 enabled: true 370 webtorrent: {
372 }, 371 enabled: true
373 hls: { 372 },
374 enabled: true 373 hls: {
374 enabled: true
375 }
375 } 376 }
376 } 377 }
377 }) 378 })
@@ -427,9 +428,11 @@ describe('Test plugin filter hooks', function () {
427 before(async function () { 428 before(async function () {
428 this.timeout(60000) 429 this.timeout(60000)
429 430
430 await updateCustomSubConfig(servers[0].url, servers[0].accessToken, { 431 await servers[0].configCommand.updateCustomSubConfig({
431 transcoding: { 432 newConfig: {
432 enabled: false 433 transcoding: {
434 enabled: false
435 }
433 } 436 }
434 }) 437 })
435 438
@@ -464,12 +467,14 @@ describe('Test plugin filter hooks', function () {
464 describe('Search filters', function () { 467 describe('Search filters', function () {
465 468
466 before(async function () { 469 before(async function () {
467 await updateCustomSubConfig(servers[0].url, servers[0].accessToken, { 470 await servers[0].configCommand.updateCustomSubConfig({
468 search: { 471 newConfig: {
469 searchIndex: { 472 search: {
470 enabled: true, 473 searchIndex: {
471 isDefaultSearch: false, 474 enabled: true,
472 disableLocalSearch: false 475 isDefaultSearch: false,
476 disableLocalSearch: false
477 }
473 } 478 }
474 } 479 }
475 }) 480 })
diff --git a/server/tests/plugins/id-and-pass-auth.ts b/server/tests/plugins/id-and-pass-auth.ts
index 545968040..99de28d3f 100644
--- a/server/tests/plugins/id-and-pass-auth.ts
+++ b/server/tests/plugins/id-and-pass-auth.ts
@@ -5,7 +5,6 @@ import { expect } from 'chai'
5import { 5import {
6 cleanupTests, 6 cleanupTests,
7 flushAndRunServer, 7 flushAndRunServer,
8 getConfig,
9 getMyUserInformation, 8 getMyUserInformation,
10 getUsersList, 9 getUsersList,
11 login, 10 login,
@@ -19,7 +18,7 @@ import {
19 wait, 18 wait,
20 waitUntilLog 19 waitUntilLog
21} from '@shared/extra-utils' 20} from '@shared/extra-utils'
22import { ServerConfig, User, UserRole } from '@shared/models' 21import { User, UserRole } from '@shared/models'
23 22
24describe('Test id and pass auth plugins', function () { 23describe('Test id and pass auth plugins', function () {
25 let server: ServerInfo 24 let server: ServerInfo
@@ -42,9 +41,7 @@ describe('Test id and pass auth plugins', function () {
42 }) 41 })
43 42
44 it('Should display the correct configuration', async function () { 43 it('Should display the correct configuration', async function () {
45 const res = await getConfig(server.url) 44 const config = await server.configCommand.getConfig()
46
47 const config: ServerConfig = res.body
48 45
49 const auths = config.plugin.registeredIdAndPassAuths 46 const auths = config.plugin.registeredIdAndPassAuths
50 expect(auths).to.have.lengthOf(8) 47 expect(auths).to.have.lengthOf(8)
@@ -190,9 +187,7 @@ describe('Test id and pass auth plugins', function () {
190 }) 187 })
191 188
192 it('Should have disabled this auth', async function () { 189 it('Should have disabled this auth', async function () {
193 const res = await getConfig(server.url) 190 const config = await server.configCommand.getConfig()
194
195 const config: ServerConfig = res.body
196 191
197 const auths = config.plugin.registeredIdAndPassAuths 192 const auths = config.plugin.registeredIdAndPassAuths
198 expect(auths).to.have.lengthOf(7) 193 expect(auths).to.have.lengthOf(7)
@@ -208,9 +203,7 @@ describe('Test id and pass auth plugins', function () {
208 }) 203 })
209 204
210 it('Should display the correct configuration', async function () { 205 it('Should display the correct configuration', async function () {
211 const res = await getConfig(server.url) 206 const config = await server.configCommand.getConfig()
212
213 const config: ServerConfig = res.body
214 207
215 const auths = config.plugin.registeredIdAndPassAuths 208 const auths = config.plugin.registeredIdAndPassAuths
216 expect(auths).to.have.lengthOf(6) 209 expect(auths).to.have.lengthOf(6)
diff --git a/server/tests/plugins/plugin-transcoding.ts b/server/tests/plugins/plugin-transcoding.ts
index f1ff91077..71c2adc72 100644
--- a/server/tests/plugins/plugin-transcoding.ts
+++ b/server/tests/plugins/plugin-transcoding.ts
@@ -9,7 +9,6 @@ import {
9 cleanupTests, 9 cleanupTests,
10 createLive, 10 createLive,
11 flushAndRunServer, 11 flushAndRunServer,
12 getConfig,
13 getVideo, 12 getVideo,
14 PluginsCommand, 13 PluginsCommand,
15 sendRTMPStreamInVideo, 14 sendRTMPStreamInVideo,
@@ -17,12 +16,11 @@ import {
17 setAccessTokensToServers, 16 setAccessTokensToServers,
18 setDefaultVideoChannel, 17 setDefaultVideoChannel,
19 testFfmpegStreamError, 18 testFfmpegStreamError,
20 updateCustomSubConfig,
21 uploadVideoAndGetId, 19 uploadVideoAndGetId,
22 waitJobs, 20 waitJobs,
23 waitUntilLivePublished 21 waitUntilLivePublished
24} from '@shared/extra-utils' 22} from '@shared/extra-utils'
25import { ServerConfig, VideoDetails, VideoPrivacy } from '@shared/models' 23import { VideoDetails, VideoPrivacy } from '@shared/models'
26 24
27async function createLiveWrapper (server: ServerInfo) { 25async function createLiveWrapper (server: ServerInfo) {
28 const liveAttributes = { 26 const liveAttributes = {
@@ -36,33 +34,35 @@ async function createLiveWrapper (server: ServerInfo) {
36} 34}
37 35
38function updateConf (server: ServerInfo, vodProfile: string, liveProfile: string) { 36function updateConf (server: ServerInfo, vodProfile: string, liveProfile: string) {
39 return updateCustomSubConfig(server.url, server.accessToken, { 37 return server.configCommand.updateCustomSubConfig({
40 transcoding: { 38 newConfig: {
41 enabled: true,
42 profile: vodProfile,
43 hls: {
44 enabled: true
45 },
46 webtorrent: {
47 enabled: true
48 },
49 resolutions: {
50 '240p': true,
51 '360p': false,
52 '480p': false,
53 '720p': true
54 }
55 },
56 live: {
57 transcoding: { 39 transcoding: {
58 profile: liveProfile,
59 enabled: true, 40 enabled: true,
41 profile: vodProfile,
42 hls: {
43 enabled: true
44 },
45 webtorrent: {
46 enabled: true
47 },
60 resolutions: { 48 resolutions: {
61 '240p': true, 49 '240p': true,
62 '360p': false, 50 '360p': false,
63 '480p': false, 51 '480p': false,
64 '720p': true 52 '720p': true
65 } 53 }
54 },
55 live: {
56 transcoding: {
57 profile: liveProfile,
58 enabled: true,
59 resolutions: {
60 '240p': true,
61 '360p': false,
62 '480p': false,
63 '720p': true
64 }
65 }
66 } 66 }
67 } 67 }
68 }) 68 })
@@ -113,8 +113,7 @@ describe('Test transcoding plugins', function () {
113 }) 113 })
114 114
115 it('Should have the appropriate available profiles', async function () { 115 it('Should have the appropriate available profiles', async function () {
116 const res = await getConfig(server.url) 116 const config = await server.configCommand.getConfig()
117 const config = res.body as ServerConfig
118 117
119 expect(config.transcoding.availableProfiles).to.have.members([ 'default', 'low-vod', 'input-options-vod', 'bad-scale-vod' ]) 118 expect(config.transcoding.availableProfiles).to.have.members([ 'default', 'low-vod', 'input-options-vod', 'bad-scale-vod' ])
120 expect(config.live.transcoding.availableProfiles).to.have.members([ 'default', 'low-live', 'input-options-live', 'bad-scale-live' ]) 119 expect(config.live.transcoding.availableProfiles).to.have.members([ 'default', 'low-live', 'input-options-live', 'bad-scale-live' ])
@@ -223,8 +222,7 @@ describe('Test transcoding plugins', function () {
223 222
224 await server.pluginsCommand.uninstall({ npmName: 'peertube-plugin-test-transcoding-one' }) 223 await server.pluginsCommand.uninstall({ npmName: 'peertube-plugin-test-transcoding-one' })
225 224
226 const res = await getConfig(server.url) 225 const config = await server.configCommand.getConfig()
227 const config = res.body as ServerConfig
228 226
229 expect(config.transcoding.availableProfiles).to.deep.equal([ 'default' ]) 227 expect(config.transcoding.availableProfiles).to.deep.equal([ 'default' ])
230 expect(config.live.transcoding.availableProfiles).to.deep.equal([ 'default' ]) 228 expect(config.live.transcoding.availableProfiles).to.deep.equal([ 'default' ])