]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/api/server/config.ts
Fix various typos
[github/Chocobozzz/PeerTube.git] / server / tests / api / server / config.ts
index 8363318f61f3524478b158988efa0b58854fd444..0f2fb5493cf84ae70e2c249557fdfe76a4b4bdaa 100644 (file)
@@ -2,16 +2,16 @@
 
 import 'mocha'
 import * as chai from 'chai'
+import { parallelTests } from '@shared/core-utils'
+import { CustomConfig, HttpStatusCode } from '@shared/models'
 import {
   cleanupTests,
   createSingleServer,
   killallServers,
   makeGetRequest,
-  parallelTests,
   PeerTubeServer,
   setAccessTokensToServers
-} from '@shared/extra-utils'
-import { CustomConfig, HttpStatusCode } from '@shared/models'
+} from '@shared/server-commands'
 
 const expect = chai.expect
 
@@ -43,6 +43,9 @@ function checkInitialConfig (server: PeerTubeServer, data: CustomConfig) {
   expect(data.services.twitter.username).to.equal('@Chocobozzz')
   expect(data.services.twitter.whitelisted).to.be.false
 
+  expect(data.client.videos.miniature.preferAuthorDisplayName).to.be.false
+  expect(data.client.menu.login.redirectOnSingleExternalAuth).to.be.false
+
   expect(data.cache.previews.size).to.equal(1)
   expect(data.cache.captions.size).to.equal(1)
   expect(data.cache.torrents.size).to.equal(1)
@@ -58,12 +61,15 @@ function checkInitialConfig (server: PeerTubeServer, data: CustomConfig) {
   expect(data.user.videoQuota).to.equal(5242880)
   expect(data.user.videoQuotaDaily).to.equal(-1)
 
+  expect(data.videoChannels.maxPerUser).to.equal(20)
+
   expect(data.transcoding.enabled).to.be.false
   expect(data.transcoding.allowAdditionalExtensions).to.be.false
   expect(data.transcoding.allowAudioFiles).to.be.false
   expect(data.transcoding.threads).to.equal(2)
   expect(data.transcoding.concurrency).to.equal(2)
   expect(data.transcoding.profile).to.equal('default')
+  expect(data.transcoding.resolutions['144p']).to.be.false
   expect(data.transcoding.resolutions['240p']).to.be.true
   expect(data.transcoding.resolutions['360p']).to.be.true
   expect(data.transcoding.resolutions['480p']).to.be.true
@@ -76,12 +82,14 @@ function checkInitialConfig (server: PeerTubeServer, data: CustomConfig) {
 
   expect(data.live.enabled).to.be.false
   expect(data.live.allowReplay).to.be.false
+  expect(data.live.latencySetting.enabled).to.be.true
   expect(data.live.maxDuration).to.equal(-1)
   expect(data.live.maxInstanceLives).to.equal(20)
   expect(data.live.maxUserLives).to.equal(3)
   expect(data.live.transcoding.enabled).to.be.false
   expect(data.live.transcoding.threads).to.equal(2)
   expect(data.live.transcoding.profile).to.equal('default')
+  expect(data.live.transcoding.resolutions['144p']).to.be.false
   expect(data.live.transcoding.resolutions['240p']).to.be.false
   expect(data.live.transcoding.resolutions['360p']).to.be.false
   expect(data.live.transcoding.resolutions['480p']).to.be.false
@@ -90,6 +98,8 @@ function checkInitialConfig (server: PeerTubeServer, data: CustomConfig) {
   expect(data.live.transcoding.resolutions['1440p']).to.be.false
   expect(data.live.transcoding.resolutions['2160p']).to.be.false
 
+  expect(data.videoStudio.enabled).to.be.false
+
   expect(data.import.videos.concurrency).to.equal(2)
   expect(data.import.videos.http.enabled).to.be.true
   expect(data.import.videos.torrent.enabled).to.be.true
@@ -134,6 +144,9 @@ function checkUpdatedConfig (data: CustomConfig) {
   expect(data.services.twitter.username).to.equal('@Kuja')
   expect(data.services.twitter.whitelisted).to.be.true
 
+  expect(data.client.videos.miniature.preferAuthorDisplayName).to.be.true
+  expect(data.client.menu.login.redirectOnSingleExternalAuth).to.be.true
+
   expect(data.cache.previews.size).to.equal(2)
   expect(data.cache.captions.size).to.equal(3)
   expect(data.cache.torrents.size).to.equal(4)
@@ -153,12 +166,15 @@ function checkUpdatedConfig (data: CustomConfig) {
   expect(data.user.videoQuota).to.equal(5242881)
   expect(data.user.videoQuotaDaily).to.equal(318742)
 
+  expect(data.videoChannels.maxPerUser).to.equal(24)
+
   expect(data.transcoding.enabled).to.be.true
   expect(data.transcoding.threads).to.equal(1)
   expect(data.transcoding.concurrency).to.equal(3)
   expect(data.transcoding.allowAdditionalExtensions).to.be.true
   expect(data.transcoding.allowAudioFiles).to.be.true
   expect(data.transcoding.profile).to.equal('vod_profile')
+  expect(data.transcoding.resolutions['144p']).to.be.false
   expect(data.transcoding.resolutions['240p']).to.be.false
   expect(data.transcoding.resolutions['360p']).to.be.true
   expect(data.transcoding.resolutions['480p']).to.be.true
@@ -170,12 +186,14 @@ function checkUpdatedConfig (data: CustomConfig) {
 
   expect(data.live.enabled).to.be.true
   expect(data.live.allowReplay).to.be.true
+  expect(data.live.latencySetting.enabled).to.be.false
   expect(data.live.maxDuration).to.equal(5000)
   expect(data.live.maxInstanceLives).to.equal(-1)
   expect(data.live.maxUserLives).to.equal(10)
   expect(data.live.transcoding.enabled).to.be.true
   expect(data.live.transcoding.threads).to.equal(4)
   expect(data.live.transcoding.profile).to.equal('live_profile')
+  expect(data.live.transcoding.resolutions['144p']).to.be.true
   expect(data.live.transcoding.resolutions['240p']).to.be.true
   expect(data.live.transcoding.resolutions['360p']).to.be.true
   expect(data.live.transcoding.resolutions['480p']).to.be.true
@@ -183,6 +201,8 @@ function checkUpdatedConfig (data: CustomConfig) {
   expect(data.live.transcoding.resolutions['1080p']).to.be.true
   expect(data.live.transcoding.resolutions['2160p']).to.be.true
 
+  expect(data.videoStudio.enabled).to.be.true
+
   expect(data.import.videos.concurrency).to.equal(4)
   expect(data.import.videos.http.enabled).to.be.false
   expect(data.import.videos.torrent.enabled).to.be.false
@@ -238,6 +258,18 @@ const newCustomConfig: CustomConfig = {
       whitelisted: true
     }
   },
+  client: {
+    videos: {
+      miniature: {
+        preferAuthorDisplayName: true
+      }
+    },
+    menu: {
+      login: {
+        redirectOnSingleExternalAuth: true
+      }
+    }
+  },
   cache: {
     previews: {
       size: 2
@@ -265,6 +297,9 @@ const newCustomConfig: CustomConfig = {
     videoQuota: 5242881,
     videoQuotaDaily: 318742
   },
+  videoChannels: {
+    maxPerUser: 24
+  },
   transcoding: {
     enabled: true,
     allowAdditionalExtensions: true,
@@ -274,6 +309,7 @@ const newCustomConfig: CustomConfig = {
     profile: 'vod_profile',
     resolutions: {
       '0p': false,
+      '144p': false,
       '240p': false,
       '360p': true,
       '480p': true,
@@ -292,6 +328,9 @@ const newCustomConfig: CustomConfig = {
   live: {
     enabled: true,
     allowReplay: true,
+    latencySetting: {
+      enabled: false
+    },
     maxDuration: 5000,
     maxInstanceLives: -1,
     maxUserLives: 10,
@@ -300,6 +339,7 @@ const newCustomConfig: CustomConfig = {
       threads: 4,
       profile: 'live_profile',
       resolutions: {
+        '144p': true,
         '240p': true,
         '360p': true,
         '480p': true,
@@ -310,6 +350,9 @@ const newCustomConfig: CustomConfig = {
       }
     }
   },
+  videoStudio: {
+    enabled: true
+  },
   import: {
     videos: {
       concurrency: 4,
@@ -324,7 +367,7 @@ const newCustomConfig: CustomConfig = {
   trending: {
     videos: {
       algorithms: {
-        enabled: [ 'best', 'hot', 'most-viewed', 'most-liked' ],
+        enabled: [ 'hot', 'most-viewed', 'most-liked' ],
         default: 'hot'
       }
     }
@@ -379,14 +422,14 @@ describe('Test static config', function () {
   before(async function () {
     this.timeout(30000)
 
-    server = await createSingleServer(1, { webadmin: { configuration: { edit: { allowed: false } } } })
+    server = await createSingleServer(1, { webadmin: { configuration: { edition: { allowed: false } } } })
     await setAccessTokensToServers([ server ])
   })
 
   it('Should tell the client that edits are not allowed', async function () {
     const data = await server.config.getConfig()
 
-    expect(data.allowEdits).to.be.false
+    expect(data.webadmin.configuration.edition.allowed).to.be.false
   })
 
   it('Should error when client tries to update', async function () {