From 65e6e2602c0d5521f3a6740f7469bb92830ecb53 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 7 Jul 2021 11:51:09 +0200 Subject: Introduce config command --- server/tests/api/check-params/live.ts | 75 +++++++++++-------- server/tests/api/check-params/search.ts | 25 +++---- server/tests/api/check-params/video-imports.ts | 53 ++++++------- server/tests/api/live/live-constraints.ts | 33 +++++---- server/tests/api/live/live-permanent.ts | 35 +++++---- server/tests/api/live/live-save-replay.ts | 21 +++--- server/tests/api/live/live-socket-messages.ts | 15 ++-- server/tests/api/live/live-views.ts | 15 ++-- server/tests/api/live/live.ts | 43 ++++++----- .../api/notifications/moderation-notifications.ts | 20 +++-- server/tests/api/search/search-index.ts | 55 ++++++++------ server/tests/api/search/search-videos.ts | 5 +- server/tests/api/server/auto-follows.ts | 9 +-- server/tests/api/server/config.ts | 48 ++++-------- server/tests/api/server/follows-moderation.ts | 9 +-- server/tests/api/server/homepage.ts | 5 +- server/tests/api/server/plugins.ts | 21 +++--- server/tests/api/server/stats.ts | 47 ++++++------ server/tests/api/users/users-verification.ts | 37 ++++++---- server/tests/api/users/users.ts | 9 +-- server/tests/api/videos/video-change-ownership.ts | 15 ++-- server/tests/api/videos/video-hls.ts | 41 ++++++----- server/tests/api/videos/video-imports.ts | 5 +- server/tests/api/videos/video-nsfw.ts | 25 ++----- server/tests/api/videos/video-transcoder.ts | 86 +++++++++++----------- 25 files changed, 381 insertions(+), 371 deletions(-) (limited to 'server/tests/api') 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 { ServerInfo, setAccessTokensToServers, stopFfmpeg, - updateCustomSubConfig, updateLive, uploadVideoAndGetId, userLogin, @@ -43,12 +42,14 @@ describe('Test video lives API validator', function () { await setAccessTokensToServers([ server ]) - await updateCustomSubConfig(server.url, server.accessToken, { - live: { - enabled: true, - maxInstanceLives: 20, - maxUserLives: 20, - allowReplay: true + await server.configCommand.updateCustomSubConfig({ + newConfig: { + live: { + enabled: true, + maxInstanceLives: 20, + maxUserLives: 20, + allowReplay: true + } } }) @@ -234,9 +235,11 @@ describe('Test video lives API validator', function () { }) it('Should forbid if live is disabled', async function () { - await updateCustomSubConfig(server.url, server.accessToken, { - live: { - enabled: false + await server.configCommand.updateCustomSubConfig({ + newConfig: { + live: { + enabled: false + } } }) @@ -252,10 +255,12 @@ describe('Test video lives API validator', function () { it('Should forbid to save replay if not enabled by the admin', async function () { const fields = immutableAssign(baseCorrectParams, { saveReplay: true }) - await updateCustomSubConfig(server.url, server.accessToken, { - live: { - enabled: true, - allowReplay: false + await server.configCommand.updateCustomSubConfig({ + newConfig: { + live: { + enabled: true, + allowReplay: false + } } }) @@ -271,10 +276,12 @@ describe('Test video lives API validator', function () { it('Should allow to save replay if enabled by the admin', async function () { const fields = immutableAssign(baseCorrectParams, { saveReplay: true }) - await updateCustomSubConfig(server.url, server.accessToken, { - live: { - enabled: true, - allowReplay: true + await server.configCommand.updateCustomSubConfig({ + newConfig: { + live: { + enabled: true, + allowReplay: true + } } }) @@ -288,10 +295,12 @@ describe('Test video lives API validator', function () { }) it('Should not allow live if max instance lives is reached', async function () { - await updateCustomSubConfig(server.url, server.accessToken, { - live: { - enabled: true, - maxInstanceLives: 1 + await server.configCommand.updateCustomSubConfig({ + newConfig: { + live: { + enabled: true, + maxInstanceLives: 1 + } } }) @@ -305,11 +314,13 @@ describe('Test video lives API validator', function () { }) it('Should not allow live if max user lives is reached', async function () { - await updateCustomSubConfig(server.url, server.accessToken, { - live: { - enabled: true, - maxInstanceLives: 20, - maxUserLives: 1 + await server.configCommand.updateCustomSubConfig({ + newConfig: { + live: { + enabled: true, + maxInstanceLives: 20, + maxUserLives: 1 + } } }) @@ -393,10 +404,12 @@ describe('Test video lives API validator', function () { }) it('Should fail to update replay status if replay is not allowed on the instance', async function () { - await updateCustomSubConfig(server.url, server.accessToken, { - live: { - enabled: true, - allowReplay: false + await server.configCommand.updateCustomSubConfig({ + newConfig: { + live: { + enabled: true, + allowReplay: false + } } }) 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 @@ /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ import 'mocha' +import { HttpStatusCode } from '@shared/core-utils' import { + checkBadCountPagination, + checkBadSortPagination, + checkBadStartPagination, cleanupTests, flushAndRunServer, immutableAssign, makeGetRequest, ServerInfo, - updateCustomSubConfig, setAccessTokensToServers -} from '../../../../shared/extra-utils' -import { - checkBadCountPagination, - checkBadSortPagination, - checkBadStartPagination -} from '../../../../shared/extra-utils/requests/check-api-params' -import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' +} from '@shared/extra-utils' function updateSearchIndex (server: ServerInfo, enabled: boolean, disableLocalSearch = false) { - return updateCustomSubConfig(server.url, server.accessToken, { - search: { - searchIndex: { - enabled, - disableLocalSearch + return server.configCommand.updateCustomSubConfig({ + newConfig: { + search: { + searchIndex: { + enabled, + disableLocalSearch + } } } }) 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 @@ import 'mocha' import { omit } from 'lodash' -import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' +import { HttpStatusCode } from '@shared/core-utils' import { buildAbsoluteFixturePath, + checkBadCountPagination, + checkBadSortPagination, + checkBadStartPagination, cleanupTests, createUser, flushAndRunServer, @@ -15,16 +18,10 @@ import { makeUploadRequest, ServerInfo, setAccessTokensToServers, - updateCustomSubConfig, userLogin -} from '../../../../shared/extra-utils' -import { - checkBadCountPagination, - checkBadSortPagination, - checkBadStartPagination -} from '../../../../shared/extra-utils/requests/check-api-params' -import { getGoodVideoUrl, getMagnetURI } from '../../../../shared/extra-utils/videos/video-imports' -import { VideoPrivacy } from '../../../../shared/models/videos/video-privacy.enum' +} from '@shared/extra-utils' +import { getGoodVideoUrl, getMagnetURI } from '@shared/extra-utils/videos/video-imports' +import { VideoPrivacy } from '@shared/models' describe('Test video imports API validator', function () { const path = '/api/v1/videos/imports' @@ -263,14 +260,16 @@ describe('Test video imports API validator', function () { }) it('Should forbid to import http videos', async function () { - await updateCustomSubConfig(server.url, server.accessToken, { - import: { - videos: { - http: { - enabled: false - }, - torrent: { - enabled: true + await server.configCommand.updateCustomSubConfig({ + newConfig: { + import: { + videos: { + http: { + enabled: false + }, + torrent: { + enabled: true + } } } } @@ -286,14 +285,16 @@ describe('Test video imports API validator', function () { }) it('Should forbid to import torrent videos', async function () { - await updateCustomSubConfig(server.url, server.accessToken, { - import: { - videos: { - http: { - enabled: true - }, - torrent: { - enabled: false + await server.configCommand.updateCustomSubConfig({ + newConfig: { + import: { + videos: { + http: { + enabled: true + }, + torrent: { + enabled: false + } } } } 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' import { checkLiveCleanup, cleanupTests, + ConfigCommand, createLive, doubleFollow, flushAndRunMultipleServers, generateUser, - getCustomConfigResolutions, getVideo, runAndTestFfmpegStreamError, ServerInfo, setAccessTokensToServers, setDefaultVideoChannel, - updateCustomSubConfig, updateUser, wait, waitJobs, @@ -80,12 +79,14 @@ describe('Test live constraints', function () { await setAccessTokensToServers(servers) await setDefaultVideoChannel(servers) - await updateCustomSubConfig(servers[0].url, servers[0].accessToken, { - live: { - enabled: true, - allowReplay: true, - transcoding: { - enabled: false + await servers[0].configCommand.updateCustomSubConfig({ + newConfig: { + live: { + enabled: true, + allowReplay: true, + transcoding: { + enabled: false + } } } }) @@ -157,14 +158,16 @@ describe('Test live constraints', function () { it('Should have max duration limit', async function () { this.timeout(60000) - await updateCustomSubConfig(servers[0].url, servers[0].accessToken, { - live: { - enabled: true, - allowReplay: true, - maxDuration: 1, - transcoding: { + await servers[0].configCommand.updateCustomSubConfig({ + newConfig: { + live: { enabled: true, - resolutions: getCustomConfigResolutions(true) + allowReplay: true, + maxDuration: 1, + transcoding: { + enabled: true, + resolutions: ConfigCommand.getCustomConfigResolutions(true) + } } } }) 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' import { LiveVideoCreate, VideoDetails, VideoPrivacy, VideoState } from '@shared/models' import { cleanupTests, + ConfigCommand, createLive, doubleFollow, flushAndRunMultipleServers, - getCustomConfigResolutions, getLive, getPlaylistsCount, getVideo, @@ -17,7 +17,6 @@ import { setAccessTokensToServers, setDefaultVideoChannel, stopFfmpeg, - updateCustomSubConfig, updateLive, wait, waitJobs, @@ -63,14 +62,16 @@ describe('Permanent live', function () { // Server 1 and server 2 follow each other await doubleFollow(servers[0], servers[1]) - await updateCustomSubConfig(servers[0].url, servers[0].accessToken, { - live: { - enabled: true, - allowReplay: true, - maxDuration: -1, - transcoding: { + await servers[0].configCommand.updateCustomSubConfig({ + newConfig: { + live: { enabled: true, - resolutions: getCustomConfigResolutions(true) + allowReplay: true, + maxDuration: -1, + transcoding: { + enabled: true, + resolutions: ConfigCommand.getCustomConfigResolutions(true) + } } } }) @@ -145,14 +146,16 @@ describe('Permanent live', function () { it('Should be able to stream again in the permanent live', async function () { this.timeout(20000) - await updateCustomSubConfig(servers[0].url, servers[0].accessToken, { - live: { - enabled: true, - allowReplay: true, - maxDuration: -1, - transcoding: { + await servers[0].configCommand.updateCustomSubConfig({ + newConfig: { + live: { enabled: true, - resolutions: getCustomConfigResolutions(false) + allowReplay: true, + maxDuration: -1, + transcoding: { + enabled: true, + resolutions: ConfigCommand.getCustomConfigResolutions(false) + } } } }) 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 { addVideoToBlacklist, checkLiveCleanup, cleanupTests, + ConfigCommand, createLive, doubleFollow, flushAndRunMultipleServers, - getCustomConfigResolutions, getVideo, getVideosList, removeVideo, @@ -22,7 +22,6 @@ import { setDefaultVideoChannel, stopFfmpeg, testFfmpegStreamError, - updateCustomSubConfig, updateVideo, wait, waitJobs, @@ -102,14 +101,16 @@ describe('Save replay setting', function () { // Server 1 and server 2 follow each other await doubleFollow(servers[0], servers[1]) - await updateCustomSubConfig(servers[0].url, servers[0].accessToken, { - live: { - enabled: true, - allowReplay: true, - maxDuration: -1, - transcoding: { - enabled: false, - resolutions: getCustomConfigResolutions(true) + await servers[0].configCommand.updateCustomSubConfig({ + newConfig: { + live: { + enabled: true, + allowReplay: true, + maxDuration: -1, + transcoding: { + enabled: false, + resolutions: ConfigCommand.getCustomConfigResolutions(true) + } } } }) 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 { setAccessTokensToServers, setDefaultVideoChannel, stopFfmpeg, - updateCustomSubConfig, viewVideo, wait, waitJobs, @@ -37,12 +36,14 @@ describe('Test live', function () { await setAccessTokensToServers(servers) await setDefaultVideoChannel(servers) - await updateCustomSubConfig(servers[0].url, servers[0].accessToken, { - live: { - enabled: true, - allowReplay: true, - transcoding: { - enabled: false + await servers[0].configCommand.updateCustomSubConfig({ + newConfig: { + live: { + enabled: true, + allowReplay: true, + transcoding: { + enabled: false + } } } }) 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 { setAccessTokensToServers, setDefaultVideoChannel, stopFfmpeg, - updateCustomSubConfig, viewVideo, wait, waitJobs, @@ -36,12 +35,14 @@ describe('Test live', function () { await setAccessTokensToServers(servers) await setDefaultVideoChannel(servers) - await updateCustomSubConfig(servers[0].url, servers[0].accessToken, { - live: { - enabled: true, - allowReplay: true, - transcoding: { - enabled: false + await servers[0].configCommand.updateCustomSubConfig({ + newConfig: { + live: { + enabled: true, + allowReplay: true, + transcoding: { + enabled: false + } } } }) 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 { stopFfmpeg, testFfmpegStreamError, testImage, - updateCustomSubConfig, updateLive, uploadVideoAndGetId, wait, @@ -59,12 +58,14 @@ describe('Test live', function () { await setAccessTokensToServers(servers) await setDefaultVideoChannel(servers) - await updateCustomSubConfig(servers[0].url, servers[0].accessToken, { - live: { - enabled: true, - allowReplay: true, - transcoding: { - enabled: false + await servers[0].configCommand.updateCustomSubConfig({ + newConfig: { + live: { + enabled: true, + allowReplay: true, + transcoding: { + enabled: false + } } } }) @@ -422,20 +423,22 @@ describe('Test live', function () { } function updateConf (resolutions: number[]) { - return updateCustomSubConfig(servers[0].url, servers[0].accessToken, { - live: { - enabled: true, - allowReplay: true, - maxDuration: -1, - transcoding: { + return servers[0].configCommand.updateCustomSubConfig({ + newConfig: { + live: { enabled: true, - resolutions: { - '240p': resolutions.includes(240), - '360p': resolutions.includes(360), - '480p': resolutions.includes(480), - '720p': resolutions.includes(720), - '1080p': resolutions.includes(1080), - '2160p': resolutions.includes(2160) + allowReplay: true, + maxDuration: -1, + transcoding: { + enabled: true, + resolutions: { + '240p': resolutions.includes(240), + '360p': resolutions.includes(360), + '480p': resolutions.includes(480), + '720p': resolutions.includes(720), + '1080p': resolutions.includes(1080), + '2160p': resolutions.includes(2160) + } } } } 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 { createUser, generateUserAccessToken, getAccount, - getCustomConfig, getVideoCommentThreads, getVideoIdFromUUID, immutableAssign, @@ -34,8 +33,6 @@ import { removeUserSubscription, removeVideoFromBlacklist, ServerInfo, - updateCustomConfig, - updateCustomSubConfig, uploadVideo, wait, waitJobs @@ -407,7 +404,7 @@ describe('Test moderation notifications', function () { } } } - await updateCustomSubConfig(servers[0].url, servers[0].accessToken, config) + await servers[0].configCommand.updateCustomSubConfig({ newConfig: config }) await servers[2].followsCommand.follow({ targets: [ servers[0].url ] }) @@ -421,7 +418,7 @@ describe('Test moderation notifications', function () { await checkAutoInstanceFollowing(immutableAssign(baseParams, userOverride), followerHost, followingHost, 'absence') config.followings.instance.autoFollowBack.enabled = false - await updateCustomSubConfig(servers[0].url, servers[0].accessToken, config) + await servers[0].configCommand.updateCustomSubConfig({ newConfig: config }) await servers[0].followsCommand.unfollow({ target: servers[2] }) await servers[2].followsCommand.unfollow({ target: servers[0] }) }) @@ -430,7 +427,7 @@ describe('Test moderation notifications', function () { this.timeout(30000) await servers[0].followsCommand.unfollow({ target: servers[1] }) - await updateCustomSubConfig(servers[0].url, servers[0].accessToken, config) + await servers[0].configCommand.updateCustomSubConfig({ newConfig: config }) await wait(5000) await waitJobs(servers) @@ -440,7 +437,7 @@ describe('Test moderation notifications', function () { await checkAutoInstanceFollowing(baseParams, followerHost, followingHost, 'presence') config.followings.instance.autoFollowIndex.enabled = false - await updateCustomSubConfig(servers[0].url, servers[0].accessToken, config) + await servers[0].configCommand.updateCustomSubConfig({ newConfig: config }) await servers[0].followsCommand.unfollow({ target: servers[1] }) }) }) @@ -476,8 +473,8 @@ describe('Test moderation notifications', function () { token: userAccessToken } - const resCustomConfig = await getCustomConfig(servers[0].url, servers[0].accessToken) - currentCustomConfig = resCustomConfig.body + currentCustomConfig = await servers[0].configCommand.getCustomConfig() + const autoBlacklistTestsCustomConfig = immutableAssign(currentCustomConfig, { autoBlacklist: { videos: { @@ -487,9 +484,10 @@ describe('Test moderation notifications', function () { } } }) + // enable transcoding otherwise own publish notification after transcoding not expected autoBlacklistTestsCustomConfig.transcoding.enabled = true - await updateCustomConfig(servers[0].url, servers[0].accessToken, autoBlacklistTestsCustomConfig) + await servers[0].configCommand.updateCustomConfig({ newCustomConfig: autoBlacklistTestsCustomConfig }) await addUserSubscription(servers[0].url, servers[0].accessToken, 'user_1_channel@localhost:' + servers[0].port) await addUserSubscription(servers[1].url, servers[1].accessToken, 'user_1_channel@localhost:' + servers[0].port) @@ -612,7 +610,7 @@ describe('Test moderation notifications', function () { }) after(async () => { - await updateCustomConfig(servers[0].url, servers[0].accessToken, currentCustomConfig) + await servers[0].configCommand.updateCustomConfig({ newCustomConfig: currentCustomConfig }) await removeUserSubscription(servers[0].url, servers[0].accessToken, 'user_1_channel@localhost:' + servers[0].port) 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 { SearchCommand, ServerInfo, setAccessTokensToServers, - updateCustomSubConfig, uploadVideo } from '@shared/extra-utils' import { VideoPlaylistPrivacy, VideoPlaylistType, VideosSearchQuery } from '@shared/models' @@ -39,12 +38,14 @@ describe('Test videos search', function () { it('Should make a local videos search by default', async function () { this.timeout(10000) - await updateCustomSubConfig(server.url, server.accessToken, { - search: { - searchIndex: { - enabled: true, - isDefaultSearch: false, - disableLocalSearch: false + await server.configCommand.updateCustomSubConfig({ + newConfig: { + search: { + searchIndex: { + enabled: true, + isDefaultSearch: false, + disableLocalSearch: false + } } } }) @@ -64,12 +65,14 @@ describe('Test videos search', function () { }) it('Should make an index videos search by default', async function () { - await updateCustomSubConfig(server.url, server.accessToken, { - search: { - searchIndex: { - enabled: true, - isDefaultSearch: true, - disableLocalSearch: false + await server.configCommand.updateCustomSubConfig({ + newConfig: { + search: { + searchIndex: { + enabled: true, + isDefaultSearch: true, + disableLocalSearch: false + } } } }) @@ -84,12 +87,14 @@ describe('Test videos search', function () { }) it('Should make an index videos search if local search is disabled', async function () { - await updateCustomSubConfig(server.url, server.accessToken, { - search: { - searchIndex: { - enabled: true, - isDefaultSearch: false, - disableLocalSearch: true + await server.configCommand.updateCustomSubConfig({ + newConfig: { + search: { + searchIndex: { + enabled: true, + isDefaultSearch: false, + disableLocalSearch: true + } } } }) @@ -216,7 +221,11 @@ describe('Test videos search', function () { let nsfwUUID: string { - await updateCustomSubConfig(server.url, server.accessToken, { instance: { defaultNSFWPolicy: 'display' } }) + await server.configCommand.updateCustomSubConfig({ + newConfig: { + instance: { defaultNSFWPolicy: 'display' } + } + }) const body = await command.searchVideos({ search: 'NSFW search index', sort: '-match' }) expect(body.data).to.have.length.greaterThan(0) @@ -228,7 +237,11 @@ describe('Test videos search', function () { } { - await updateCustomSubConfig(server.url, server.accessToken, { instance: { defaultNSFWPolicy: 'do_not_list' } }) + await server.configCommand.updateCustomSubConfig({ + newConfig: { + instance: { defaultNSFWPolicy: 'do_not_list' } + } + }) const body = await command.searchVideos({ search: 'NSFW search index', sort: '-match' }) 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 { setAccessTokensToServers, setDefaultVideoChannel, stopFfmpeg, - updateCustomSubConfig, uploadVideo, wait, waitUntilLivePublished @@ -486,13 +485,13 @@ describe('Test videos search', function () { this.timeout(30000) { - const options = { + const newConfig = { search: { searchIndex: { enabled: false } }, live: { enabled: true } } - await updateCustomSubConfig(server.url, server.accessToken, options) + await server.configCommand.updateCustomSubConfig({ newConfig }) } { 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 { MockInstancesIndex, ServerInfo, setAccessTokensToServers, - updateCustomSubConfig, wait, waitJobs } from '@shared/extra-utils' @@ -87,7 +86,7 @@ describe('Test auto follows', function () { } } } - await updateCustomSubConfig(servers[1].url, servers[1].accessToken, config) + await servers[1].configCommand.updateCustomSubConfig({ newConfig: config }) await server1Follows2(servers) @@ -112,7 +111,7 @@ describe('Test auto follows', function () { } } } - await updateCustomSubConfig(servers[1].url, servers[1].accessToken, config) + await servers[1].configCommand.updateCustomSubConfig({ newConfig: config }) await server1Follows2(servers) @@ -129,7 +128,7 @@ describe('Test auto follows', function () { config.followings.instance.autoFollowBack.enabled = false config.followers.instance.manualApproval = false - await updateCustomSubConfig(servers[1].url, servers[1].accessToken, config) + await servers[1].configCommand.updateCustomSubConfig({ newConfig: config }) }) }) @@ -166,7 +165,7 @@ describe('Test auto follows', function () { } } } - await updateCustomSubConfig(servers[0].url, servers[0].accessToken, config) + await servers[0].configCommand.updateCustomSubConfig({ newConfig: config }) await wait(5000) 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 @@ import 'mocha' import * as chai from 'chai' -import { About } from '../../../../shared/models/server/about.model' -import { CustomConfig } from '../../../../shared/models/server/custom-config.model' +import { HttpStatusCode } from '@shared/core-utils' import { cleanupTests, - deleteCustomConfig, flushAndRunServer, - getAbout, - getConfig, - getCustomConfig, killallServers, makeGetRequest, parallelTests, @@ -18,11 +13,9 @@ import { reRunServer, ServerInfo, setAccessTokensToServers, - updateCustomConfig, uploadVideo -} from '../../../../shared/extra-utils' -import { ServerConfig } from '../../../../shared/models' -import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' +} from '@shared/extra-utils' +import { CustomConfig } from '@shared/models' const expect = chai.expect @@ -213,7 +206,7 @@ function checkUpdatedConfig (data: CustomConfig) { } describe('Test config', function () { - let server = null + let server: ServerInfo = null before(async function () { this.timeout(30000) @@ -223,8 +216,7 @@ describe('Test config', function () { }) it('Should have a correct config on a server with registration enabled', async function () { - const res = await getConfig(server.url) - const data: ServerConfig = res.body + const data = await server.configCommand.getConfig() expect(data.signup.allowed).to.be.true }) @@ -238,15 +230,13 @@ describe('Test config', function () { registerUser(server.url, 'user3', 'super password') ]) - const res = await getConfig(server.url) - const data: ServerConfig = res.body + const data = await server.configCommand.getConfig() expect(data.signup.allowed).to.be.false }) it('Should have the correct video allowed extensions', async function () { - const res = await getConfig(server.url) - const data: ServerConfig = res.body + const data = await server.configCommand.getConfig() expect(data.video.file.extensions).to.have.lengthOf(3) expect(data.video.file.extensions).to.contain('.mp4') @@ -260,8 +250,7 @@ describe('Test config', function () { }) it('Should get the customized configuration', async function () { - const res = await getCustomConfig(server.url, server.accessToken) - const data = res.body as CustomConfig + const data = await server.configCommand.getCustomConfig() checkInitialConfig(server, data) }) @@ -438,19 +427,16 @@ describe('Test config', function () { } } } - await updateCustomConfig(server.url, server.accessToken, newCustomConfig) - - const res = await getCustomConfig(server.url, server.accessToken) - const data = res.body + await server.configCommand.updateCustomConfig({ newCustomConfig }) + const data = await server.configCommand.getCustomConfig() checkUpdatedConfig(data) }) it('Should have the correct updated video allowed extensions', async function () { this.timeout(10000) - const res = await getConfig(server.url) - const data: ServerConfig = res.body + const data = await server.configCommand.getConfig() expect(data.video.file.extensions).to.have.length.above(4) expect(data.video.file.extensions).to.contain('.mp4') @@ -474,15 +460,13 @@ describe('Test config', function () { await reRunServer(server) - const res = await getCustomConfig(server.url, server.accessToken) - const data = res.body + const data = await server.configCommand.getCustomConfig() checkUpdatedConfig(data) }) it('Should fetch the about information', async function () { - const res = await getAbout(server.url) - const data: About = res.body + const data = await server.configCommand.getAbout() expect(data.instance.name).to.equal('PeerTube updated') expect(data.instance.shortDescription).to.equal('my short description') @@ -504,11 +488,9 @@ describe('Test config', function () { it('Should remove the custom configuration', async function () { this.timeout(10000) - await deleteCustomConfig(server.url, server.accessToken) - - const res = await getCustomConfig(server.url, server.accessToken) - const data = res.body + await server.configCommand.deleteCustomConfig() + const data = await server.configCommand.getCustomConfig() checkInitialConfig(server, data) }) 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 { FollowsCommand, ServerInfo, setAccessTokensToServers, - updateCustomSubConfig, waitJobs } from '@shared/extra-utils' @@ -94,7 +93,7 @@ describe('Test follows moderation', function () { } } - await updateCustomSubConfig(servers[1].url, servers[1].accessToken, subConfig) + await servers[1].configCommand.updateCustomSubConfig({ newConfig: subConfig }) await commands[0].follow({ targets: [ servers[1].url ] }) await waitJobs(servers) @@ -114,7 +113,7 @@ describe('Test follows moderation', function () { } } - await updateCustomSubConfig(servers[1].url, servers[1].accessToken, subConfig) + await servers[1].configCommand.updateCustomSubConfig({ newConfig: subConfig }) await commands[0].follow({ targets: [ servers[1].url ] }) await waitJobs(servers) @@ -137,8 +136,8 @@ describe('Test follows moderation', function () { } } - await updateCustomSubConfig(servers[1].url, servers[1].accessToken, subConfig) - await updateCustomSubConfig(servers[2].url, servers[2].accessToken, subConfig) + await servers[1].configCommand.updateCustomSubConfig({ newConfig: subConfig }) + await servers[2].configCommand.updateCustomSubConfig({ newConfig: subConfig }) await commands[0].follow({ targets: [ servers[1].url ] }) 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 @@ import 'mocha' import * as chai from 'chai' import { HttpStatusCode } from '@shared/core-utils' -import { ServerConfig } from '@shared/models' import { cleanupTests, CustomPagesCommand, flushAndRunServer, - getConfig, killallServers, reRunServer, ServerInfo, @@ -18,9 +16,8 @@ import { const expect = chai.expect async function getHomepageState (server: ServerInfo) { - const res = await getConfig(server.url) + const config = await server.configCommand.getConfig() - const config = res.body as ServerConfig return config.homepage.enabled } 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 { cleanupTests, closeAllSequelize, flushAndRunServer, - getConfig, getMyUserInformation, killallServers, PluginsCommand, @@ -16,12 +15,11 @@ import { setAccessTokensToServers, setPluginVersion, testHelloWorldRegisteredSettings, - updateCustomSubConfig, updateMyUser, wait, waitUntilLog } from '@shared/extra-utils' -import { PluginType, ServerConfig, User } from '@shared/models' +import { PluginType, User } from '@shared/models' const expect = chai.expect @@ -102,8 +100,7 @@ describe('Test plugins', function () { }) it('Should have the plugin loaded in the configuration', async function () { - const res = await getConfig(server.url) - const config: ServerConfig = res.body + const config = await server.configCommand.getConfig() const theme = config.theme.registered.find(r => r.name === 'background-red') expect(theme).to.not.be.undefined @@ -113,11 +110,13 @@ describe('Test plugins', function () { }) it('Should update the default theme in the configuration', async function () { - await updateCustomSubConfig(server.url, server.accessToken, { theme: { default: 'background-red' } }) - - const res = await getConfig(server.url) - const config: ServerConfig = res.body + await server.configCommand.updateCustomSubConfig({ + newConfig: { + theme: { default: 'background-red' } + } + }) + const config = await server.configCommand.getConfig() expect(config.theme.default).to.equal('background-red') }) @@ -302,9 +301,7 @@ describe('Test plugins', function () { }) it('Should have updated the configuration', async function () { - // get /config (default theme + registered themes + registered plugins) - const res = await getConfig(server.url) - const config: ServerConfig = res.body + const config = await server.configCommand.getConfig() expect(config.theme.default).to.equal('default') 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 { flushAndRunMultipleServers, ServerInfo, setAccessTokensToServers, - updateCustomSubConfig, uploadVideo, userLogin, viewVideo, @@ -197,24 +196,26 @@ describe('Test stats (excluding redundancy)', function () { it('Should correctly count video file sizes if transcoding is enabled', async function () { this.timeout(60000) - await updateCustomSubConfig(servers[0].url, servers[0].accessToken, { - transcoding: { - enabled: true, - webtorrent: { - enabled: true - }, - hls: { - enabled: true - }, - resolutions: { - '0p': false, - '240p': false, - '360p': false, - '480p': false, - '720p': false, - '1080p': false, - '1440p': false, - '2160p': false + await servers[0].configCommand.updateCustomSubConfig({ + newConfig: { + transcoding: { + enabled: true, + webtorrent: { + enabled: true + }, + hls: { + enabled: true + }, + resolutions: { + '0p': false, + '240p': false, + '360p': false, + '480p': false, + '720p': false, + '1080p': false, + '1440p': false, + '2160p': false + } } } }) @@ -238,9 +239,11 @@ describe('Test stats (excluding redundancy)', function () { it('Should have the correct AP stats', async function () { this.timeout(60000) - await updateCustomSubConfig(servers[0].url, servers[0].accessToken, { - transcoding: { - enabled: false + await servers[0].configCommand.updateCustomSubConfig({ + newConfig: { + transcoding: { + enabled: false + } } }) 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 { login, registerUser, ServerInfo, - updateCustomSubConfig, updateMyUser, userLogin, verifyEmail @@ -58,11 +57,13 @@ describe('Test users account verification', function () { it('Should register user and send verification email if verification required', async function () { this.timeout(30000) - await updateCustomSubConfig(server.url, server.accessToken, { - signup: { - enabled: true, - requiresEmailVerification: true, - limit: 10 + await server.configCommand.updateCustomSubConfig({ + newConfig: { + signup: { + enabled: true, + requiresEmailVerification: true, + limit: 10 + } } }) @@ -148,11 +149,13 @@ describe('Test users account verification', function () { it('Should register user not requiring email verification if setting not enabled', async function () { this.timeout(5000) - await updateCustomSubConfig(server.url, server.accessToken, { - signup: { - enabled: true, - requiresEmailVerification: false, - limit: 10 + await server.configCommand.updateCustomSubConfig({ + newConfig: { + signup: { + enabled: true, + requiresEmailVerification: false, + limit: 10 + } } }) @@ -168,11 +171,13 @@ describe('Test users account verification', function () { }) it('Should allow login for user with unverified email when setting later enabled', async function () { - await updateCustomSubConfig(server.url, server.accessToken, { - signup: { - enabled: true, - requiresEmailVerification: true, - limit: 10 + await server.configCommand.updateCustomSubConfig({ + newConfig: { + signup: { + enabled: true, + requiresEmailVerification: true, + limit: 10 + } } }) 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 { flushAndRunServer, getAccountRatings, getBlacklistedVideosList, - getCustomConfig, getMyUserInformation, getMyUserVideoQuotaUsed, getMyUserVideoRating, @@ -38,7 +37,6 @@ import { setTokenField, testImage, unblockUser, - updateCustomSubConfig, updateMyAvatar, updateMyUser, updateUser, @@ -46,7 +44,7 @@ import { userLogin, waitJobs } from '@shared/extra-utils' -import { AbuseState, CustomConfig, MyUser, OAuth2ErrorCode, User, UserAdminFlag, UserRole, Video, VideoPlaylistType } from '@shared/models' +import { AbuseState, MyUser, OAuth2ErrorCode, User, UserAdminFlag, UserRole, Video, VideoPlaylistType } from '@shared/models' const expect = chai.expect @@ -418,12 +416,11 @@ describe('Test users', function () { this.timeout(60000) { - const res = await getCustomConfig(server.url, server.accessToken) - const config = res.body as CustomConfig + const config = await server.configCommand.getCustomConfig() config.transcoding.webtorrent.enabled = false config.transcoding.hls.enabled = true config.transcoding.enabled = true - await updateCustomSubConfig(server.url, server.accessToken, config) + await server.configCommand.updateCustomSubConfig({ newConfig: config }) } { 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 { ServerInfo, setAccessTokensToServers, setDefaultVideoChannel, - updateCustomSubConfig, uploadVideo, userLogin } from '../../../../shared/extra-utils' @@ -58,12 +57,14 @@ describe('Test video change ownership - nominal', function () { await setAccessTokensToServers(servers) await setDefaultVideoChannel(servers) - await updateCustomSubConfig(servers[0].url, servers[0].accessToken, { - transcoding: { - enabled: false - }, - live: { - enabled: true + await servers[0].configCommand.updateCustomSubConfig({ + newConfig: { + transcoding: { + enabled: false + }, + live: { + enabled: true + } } }) 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 @@ import 'mocha' import * as chai from 'chai' import { join } from 'path' +import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' import { checkDirectoryIsEmpty, checkResolutionsInMasterPlaylist, @@ -17,7 +18,6 @@ import { removeVideo, ServerInfo, setAccessTokensToServers, - updateCustomSubConfig, updateVideo, uploadVideo, waitJobs, @@ -26,7 +26,6 @@ import { import { VideoDetails } from '../../../../shared/models/videos' import { VideoStreamingPlaylistType } from '../../../../shared/models/videos/video-streaming-playlist.type' import { DEFAULT_AUDIO_RESOLUTION } from '../../../initializers/constants' -import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' const expect = chai.expect @@ -192,24 +191,26 @@ describe('Test HLS videos', function () { describe('With only HLS enabled', function () { before(async function () { - await updateCustomSubConfig(servers[0].url, servers[0].accessToken, { - transcoding: { - enabled: true, - allowAudioFiles: true, - resolutions: { - '240p': true, - '360p': true, - '480p': true, - '720p': true, - '1080p': true, - '1440p': true, - '2160p': true - }, - hls: { - enabled: true - }, - webtorrent: { - enabled: false + await servers[0].configCommand.updateCustomSubConfig({ + newConfig: { + transcoding: { + enabled: true, + allowAudioFiles: true, + resolutions: { + '240p': true, + '360p': true, + '480p': true, + '720p': true, + '1080p': true, + '1440p': true, + '2160p': true + }, + hls: { + enabled: true + }, + webtorrent: { + enabled: false + } } } }) 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 { listVideoCaptions, ServerInfo, setAccessTokensToServers, - testCaptionFile, - updateCustomSubConfig + testCaptionFile } from '../../../../shared/extra-utils' import { areHttpImportTestsDisabled, testImage } from '../../../../shared/extra-utils/miscs/miscs' import { waitJobs } from '../../../../shared/extra-utils/server/jobs' @@ -333,7 +332,7 @@ Ajouter un sous-titre est vraiment facile`) } } } - await updateCustomSubConfig(servers[0].url, servers[0].accessToken, config) + await servers[0].configCommand.updateCustomSubConfig({ newConfig: config }) const attributes = { 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 { createUser, flushAndRunServer, getAccountVideos, - getConfig, - getCustomConfig, getMyUserInformation, getMyVideos, getVideoChannelVideos, @@ -16,12 +14,11 @@ import { getVideosListWithToken, ServerInfo, setAccessTokensToServers, - updateCustomConfig, updateMyUser, uploadVideo, userLogin } from '@shared/extra-utils' -import { BooleanBothQuery, CustomConfig, ServerConfig, User, VideosOverview } from '@shared/models' +import { BooleanBothQuery, CustomConfig, User, VideosOverview } from '@shared/models' const expect = chai.expect @@ -97,16 +94,12 @@ describe('Test video NSFW policy', function () { await uploadVideo(server.url, server.accessToken, attributes) } - { - const res = await getCustomConfig(server.url, server.accessToken) - customConfig = res.body - } + customConfig = await server.configCommand.getCustomConfig() }) describe('Instance default NSFW policy', function () { it('Should display NSFW videos with display default NSFW policy', async function () { - const resConfig = await getConfig(server.url) - const serverConfig: ServerConfig = resConfig.body + const serverConfig = await server.configCommand.getConfig() expect(serverConfig.instance.defaultNSFWPolicy).to.equal('display') for (const res of await getVideosFunctions()) { @@ -121,10 +114,9 @@ describe('Test video NSFW policy', function () { it('Should not display NSFW videos with do_not_list default NSFW policy', async function () { customConfig.instance.defaultNSFWPolicy = 'do_not_list' - await updateCustomConfig(server.url, server.accessToken, customConfig) + await server.configCommand.updateCustomConfig({ newCustomConfig: customConfig }) - const resConfig = await getConfig(server.url) - const serverConfig: ServerConfig = resConfig.body + const serverConfig = await server.configCommand.getConfig() expect(serverConfig.instance.defaultNSFWPolicy).to.equal('do_not_list') for (const res of await getVideosFunctions()) { @@ -138,10 +130,9 @@ describe('Test video NSFW policy', function () { it('Should display NSFW videos with blur default NSFW policy', async function () { customConfig.instance.defaultNSFWPolicy = 'blur' - await updateCustomConfig(server.url, server.accessToken, customConfig) + await server.configCommand.updateCustomConfig({ newCustomConfig: customConfig }) - const resConfig = await getConfig(server.url) - const serverConfig: ServerConfig = resConfig.body + const serverConfig = await server.configCommand.getConfig() expect(serverConfig.instance.defaultNSFWPolicy).to.equal('blur') for (const res of await getVideosFunctions()) { @@ -172,7 +163,7 @@ describe('Test video NSFW policy', function () { it('Should display NSFW videos with blur user NSFW policy', async function () { customConfig.instance.defaultNSFWPolicy = 'do_not_list' - await updateCustomConfig(server.url, server.accessToken, customConfig) + await server.configCommand.updateCustomConfig({ newCustomConfig: customConfig }) for (const res of await getVideosFunctions(userAccessToken)) { 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' import { FfprobeData } from 'fluent-ffmpeg' import { omit } from 'lodash' import { join } from 'path' -import { Job } from '@shared/models' import { VIDEO_TRANSCODING_FPS } from '../../../../server/initializers/constants' import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' import { @@ -24,7 +23,6 @@ import { makeGetRequest, ServerInfo, setAccessTokensToServers, - updateCustomSubConfig, uploadVideo, uploadVideoAndGetId, waitJobs, @@ -43,22 +41,24 @@ import { const expect = chai.expect function updateConfigForTranscoding (server: ServerInfo) { - return updateCustomSubConfig(server.url, server.accessToken, { - transcoding: { - enabled: true, - allowAdditionalExtensions: true, - allowAudioFiles: true, - hls: { enabled: true }, - webtorrent: { enabled: true }, - resolutions: { - '0p': false, - '240p': true, - '360p': true, - '480p': true, - '720p': true, - '1080p': true, - '1440p': true, - '2160p': true + return server.configCommand.updateCustomSubConfig({ + newConfig: { + transcoding: { + enabled: true, + allowAdditionalExtensions: true, + allowAudioFiles: true, + hls: { enabled: true }, + webtorrent: { enabled: true }, + resolutions: { + '0p': false, + '240p': true, + '360p': true, + '480p': true, + '720p': true, + '1080p': true, + '1440p': true, + '2160p': true + } } } }) @@ -363,19 +363,21 @@ describe('Test video transcoding', function () { function runSuite (mode: 'legacy' | 'resumable') { before(async function () { - await updateCustomSubConfig(servers[1].url, servers[1].accessToken, { - transcoding: { - hls: { enabled: true }, - webtorrent: { enabled: true }, - resolutions: { - '0p': false, - '240p': false, - '360p': false, - '480p': false, - '720p': false, - '1080p': false, - '1440p': false, - '2160p': false + await servers[1].configCommand.updateCustomSubConfig({ + newConfig: { + transcoding: { + hls: { enabled: true }, + webtorrent: { enabled: true }, + resolutions: { + '0p': false, + '240p': false, + '360p': false, + '480p': false, + '720p': false, + '1080p': false, + '1440p': false, + '2160p': false + } } } }) @@ -434,14 +436,16 @@ describe('Test video transcoding', function () { it('Should upload an audio file and create an audio version only', async function () { this.timeout(60_000) - await updateCustomSubConfig(servers[1].url, servers[1].accessToken, { - transcoding: { - hls: { enabled: true }, - webtorrent: { enabled: true }, - resolutions: { - '0p': true, - '240p': false, - '360p': false + await servers[1].configCommand.updateCustomSubConfig({ + newConfig: { + transcoding: { + hls: { enabled: true }, + webtorrent: { enabled: true }, + resolutions: { + '0p': true, + '240p': false, + '360p': false + } } } }) @@ -601,7 +605,7 @@ describe('Test video transcoding', function () { it('Should not transcode to an higher bitrate than the original file', async function () { this.timeout(160_000) - const config = { + const newConfig = { transcoding: { enabled: true, resolutions: { @@ -617,7 +621,7 @@ describe('Test video transcoding', function () { hls: { enabled: true } } } - await updateCustomSubConfig(servers[1].url, servers[1].accessToken, config) + await servers[1].configCommand.updateCustomSubConfig({ newConfig }) const videoAttributes = { name: 'low bitrate', -- cgit v1.2.3