diff --git a/packages/tests/src/api/server/config.ts b/packages/tests/src/api/server/config.ts index 74ee275b0..179dc4b88 100644 --- a/packages/tests/src/api/server/config.ts +++ b/packages/tests/src/api/server/config.ts @@ -56,7 +56,7 @@ function checkInitialConfig (server: PeerTubeServer, data: CustomConfig) { expect(data.signup.requiresApproval).to.be.false expect(data.signup.requiresEmailVerification).to.be.false - expect(data.admin.email).to.equal('admin' + server.internalServerNumber + '@example.com') + expect(data.admin.email).to.equal(`admin${server.internalServerNumber}@example.com`) expect(data.contactForm.enabled).to.be.true expect(data.user.history.videos.enabled).to.be.true @@ -136,248 +136,250 @@ function checkInitialConfig (server: PeerTubeServer, data: CustomConfig) { expect(data.export.users.maxUserVideoQuota).to.equal(10737418240) } -const newCustomConfig: CustomConfig = { - instance: { - name: 'PeerTube updated', - shortDescription: 'my short description', - description: 'my super description', - terms: 'my super terms', - codeOfConduct: 'my super coc', +function buildNewCustomConfig (server: PeerTubeServer): CustomConfig { + return { + instance: { + name: 'PeerTube updated', + shortDescription: 'my short description', + description: 'my super description', + terms: 'my super terms', + codeOfConduct: 'my super coc', - creationReason: 'my super creation reason', - moderationInformation: 'my super moderation information', - administrator: 'Kuja', - maintenanceLifetime: 'forever', - businessModel: 'my super business model', - hardwareInformation: '2vCore 3GB RAM', + creationReason: 'my super creation reason', + moderationInformation: 'my super moderation information', + administrator: 'Kuja', + maintenanceLifetime: 'forever', + businessModel: 'my super business model', + hardwareInformation: '2vCore 3GB RAM', - languages: [ 'en', 'es' ], - categories: [ 1, 2 ], + languages: [ 'en', 'es' ], + categories: [ 1, 2 ], - isNSFW: true, - defaultNSFWPolicy: 'blur' as 'blur', + isNSFW: true, + defaultNSFWPolicy: 'blur' as 'blur', - defaultClientRoute: '/videos/recently-added', + defaultClientRoute: '/videos/recently-added', - customizations: { - javascript: 'alert("coucou")', - css: 'body { background-color: red; }' - } - }, - theme: { - default: 'default' - }, - services: { - twitter: { - username: '@Kuja' - } - }, - client: { - videos: { - miniature: { - preferAuthorDisplayName: true + customizations: { + javascript: 'alert("coucou")', + css: 'body { background-color: red; }' } }, - menu: { - login: { - redirectOnSingleExternalAuth: true + theme: { + default: 'default' + }, + services: { + twitter: { + username: '@Kuja' } - } - }, - cache: { - previews: { - size: 2 }, - captions: { - size: 3 - }, - torrents: { - size: 4 - }, - storyboards: { - size: 5 - } - }, - signup: { - enabled: false, - limit: 5, - requiresApproval: false, - requiresEmailVerification: false, - minimumAge: 10 - }, - admin: { - email: 'superadmin1@example.com' - }, - contactForm: { - enabled: false - }, - user: { - history: { + client: { videos: { - enabled: false + miniature: { + preferAuthorDisplayName: true + } + }, + menu: { + login: { + redirectOnSingleExternalAuth: true + } } }, - videoQuota: 5242881, - videoQuotaDaily: 318742, - defaultChannelName: 'Main $1 channel' - }, - videoChannels: { - maxPerUser: 24 - }, - transcoding: { - enabled: true, - remoteRunners: { - enabled: true + cache: { + previews: { + size: 2 + }, + captions: { + size: 3 + }, + torrents: { + size: 4 + }, + storyboards: { + size: 5 + } }, - originalFile: { - keep: true + signup: { + enabled: false, + limit: 5, + requiresApproval: false, + requiresEmailVerification: false, + minimumAge: 10 }, - allowAdditionalExtensions: true, - allowAudioFiles: true, - threads: 1, - concurrency: 3, - profile: 'vod_profile', - resolutions: { - '0p': false, - '144p': false, - '240p': false, - '360p': true, - '480p': true, - '720p': false, - '1080p': false, - '1440p': false, - '2160p': false + admin: { + email: `admin${server.internalServerNumber}@example.com` }, - alwaysTranscodeOriginalResolution: false, - webVideos: { - enabled: true - }, - hls: { - enabled: false - } - }, - live: { - enabled: true, - allowReplay: true, - latencySetting: { + contactForm: { enabled: false }, - maxDuration: 5000, - maxInstanceLives: -1, - maxUserLives: 10, + user: { + history: { + videos: { + enabled: false + } + }, + videoQuota: 5242881, + videoQuotaDaily: 318742, + defaultChannelName: 'Main $1 channel' + }, + videoChannels: { + maxPerUser: 24 + }, transcoding: { enabled: true, remoteRunners: { enabled: true }, - threads: 4, - profile: 'live_profile', + originalFile: { + keep: true + }, + allowAdditionalExtensions: true, + allowAudioFiles: true, + threads: 1, + concurrency: 3, + profile: 'vod_profile', resolutions: { - '144p': true, - '240p': true, + '0p': false, + '144p': false, + '240p': false, '360p': true, '480p': true, - '720p': true, - '1080p': true, - '1440p': true, - '2160p': true + '720p': false, + '1080p': false, + '1440p': false, + '2160p': false }, - alwaysTranscodeOriginalResolution: false - } - }, - videoStudio: { - enabled: true, - remoteRunners: { - enabled: true - } - }, - videoFile: { - update: { - enabled: true - } - }, - import: { - videos: { - concurrency: 4, - http: { - enabled: false + alwaysTranscodeOriginalResolution: false, + webVideos: { + enabled: true }, - torrent: { + hls: { enabled: false } }, - videoChannelSynchronization: { - enabled: false, - maxPerUser: 10 - }, - users: { - enabled: false - } - }, - trending: { - videos: { - algorithms: { - enabled: [ 'hot', 'most-viewed', 'most-liked' ], - default: 'hot' - } - } - }, - autoBlacklist: { - videos: { - ofUsers: { - enabled: true - } - } - }, - followers: { - instance: { - enabled: false, - manualApproval: true - } - }, - followings: { - instance: { - autoFollowBack: { - enabled: true - }, - autoFollowIndex: { - enabled: true, - indexUrl: 'https://updated.example.com' - } - } - }, - broadcastMessage: { - enabled: true, - level: 'error', - message: 'super bad message', - dismissable: true - }, - search: { - remoteUri: { - anonymous: true, - users: true - }, - searchIndex: { + live: { enabled: true, - url: 'https://search.joinpeertube.org', - disableLocalSearch: true, - isDefaultSearch: true - } - }, - storyboards: { - enabled: false - }, - export: { - users: { - enabled: false, - exportExpiration: 43, - maxUserVideoQuota: 42 + allowReplay: true, + latencySetting: { + enabled: false + }, + maxDuration: 5000, + maxInstanceLives: -1, + maxUserLives: 10, + transcoding: { + enabled: true, + remoteRunners: { + enabled: true + }, + threads: 4, + profile: 'live_profile', + resolutions: { + '144p': true, + '240p': true, + '360p': true, + '480p': true, + '720p': true, + '1080p': true, + '1440p': true, + '2160p': true + }, + alwaysTranscodeOriginalResolution: false + } + }, + videoStudio: { + enabled: true, + remoteRunners: { + enabled: true + } + }, + videoFile: { + update: { + enabled: true + } + }, + import: { + videos: { + concurrency: 4, + http: { + enabled: false + }, + torrent: { + enabled: false + } + }, + videoChannelSynchronization: { + enabled: false, + maxPerUser: 10 + }, + users: { + enabled: false + } + }, + trending: { + videos: { + algorithms: { + enabled: [ 'hot', 'most-viewed', 'most-liked' ], + default: 'hot' + } + } + }, + autoBlacklist: { + videos: { + ofUsers: { + enabled: true + } + } + }, + followers: { + instance: { + enabled: false, + manualApproval: true + } + }, + followings: { + instance: { + autoFollowBack: { + enabled: true + }, + autoFollowIndex: { + enabled: true, + indexUrl: 'https://updated.example.com' + } + } + }, + broadcastMessage: { + enabled: true, + level: 'error', + message: 'super bad message', + dismissable: true + }, + search: { + remoteUri: { + anonymous: true, + users: true + }, + searchIndex: { + enabled: true, + url: 'https://search.joinpeertube.org', + disableLocalSearch: true, + isDefaultSearch: true + } + }, + storyboards: { + enabled: false + }, + export: { + users: { + enabled: false, + exportExpiration: 43, + maxUserVideoQuota: 42 + } } } } describe('Test static config', function () { - let server: PeerTubeServer = null + let server: PeerTubeServer before(async function () { this.timeout(30000) @@ -393,7 +395,7 @@ describe('Test static config', function () { }) it('Should error when client tries to update', async function () { - await server.config.updateCustomConfig({ newCustomConfig, expectedStatus: 405 }) + await server.config.updateCustomConfig({ newCustomConfig: buildNewCustomConfig(server), expectedStatus: 405 }) }) after(async function () { @@ -464,10 +466,10 @@ describe('Test config', function () { }) it('Should update the customized configuration', async function () { - await server.config.updateCustomConfig({ newCustomConfig }) + await server.config.updateCustomConfig({ newCustomConfig: buildNewCustomConfig(server) }) const data = await server.config.getCustomConfig() - expect(data).to.deep.equal(newCustomConfig) + expect(data).to.deep.equal(buildNewCustomConfig(server)) }) it('Should have the correct updated video allowed extensions', async function () { @@ -499,7 +501,7 @@ describe('Test config', function () { const data = await server.config.getCustomConfig() - expect(data).to.deep.equal(newCustomConfig) + expect(data).to.deep.equal(buildNewCustomConfig(server)) }) it('Should fetch the about information', async function () {