]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/api/check-params/config.ts
Merge branch 'release/3.1.0' into develop
[github/Chocobozzz/PeerTube.git] / server / tests / api / check-params / config.ts
index 2882ceb7c26c909f2f3bd1cb82351ff042f0a151..004aa65b37ac2bbb5d8ae6ed4eaed0dfee53f122 100644 (file)
@@ -16,6 +16,7 @@ import {
   setAccessTokensToServers,
   userLogin
 } from '../../../../shared/extra-utils'
+import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
 
 describe('Test config API validators', function () {
   const path = '/api/v1/config/custom'
@@ -40,8 +41,10 @@ describe('Test config API validators', function () {
       categories: [ 1, 2 ],
 
       isNSFW: true,
-      defaultClientRoute: '/videos/recently-added',
       defaultNSFWPolicy: 'blur',
+
+      defaultClientRoute: '/videos/recently-added',
+
       customizations: {
         javascript: 'alert("coucou")',
         css: 'body { background-color: red; }'
@@ -62,6 +65,9 @@ describe('Test config API validators', function () {
       },
       captions: {
         size: 3
+      },
+      torrents: {
+        size: 4
       }
     },
     signup: {
@@ -83,7 +89,9 @@ describe('Test config API validators', function () {
       enabled: true,
       allowAdditionalExtensions: true,
       allowAudioFiles: true,
+      concurrency: 1,
       threads: 1,
+      profile: 'vod_profile',
       resolutions: {
         '0p': false,
         '240p': false,
@@ -91,6 +99,7 @@ describe('Test config API validators', function () {
         '480p': true,
         '720p': false,
         '1080p': false,
+        '1440p': false,
         '2160p': false
       },
       webtorrent: {
@@ -104,23 +113,28 @@ describe('Test config API validators', function () {
       enabled: true,
 
       allowReplay: false,
-      maxDuration: null,
+      maxDuration: 30,
+      maxInstanceLives: -1,
+      maxUserLives: 50,
 
       transcoding: {
         enabled: true,
         threads: 4,
+        profile: 'live_profile',
         resolutions: {
           '240p': true,
           '360p': true,
           '480p': true,
           '720p': true,
           '1080p': true,
+          '1440p': true,
           '2160p': true
         }
       }
     },
     import: {
       videos: {
+        concurrency: 1,
         http: {
           enabled: false
         },
@@ -129,6 +143,14 @@ describe('Test config API validators', function () {
         }
       }
     },
+    trending: {
+      videos: {
+        algorithms: {
+          enabled: [ 'best', 'hot', 'most-viewed', 'most-liked' ],
+          default: 'most-viewed'
+        }
+      }
+    },
     autoBlacklist: {
       videos: {
         ofUsers: {
@@ -195,7 +217,7 @@ describe('Test config API validators', function () {
       await makeGetRequest({
         url: server.url,
         path,
-        statusCodeExpected: 401
+        statusCodeExpected: HttpStatusCode.UNAUTHORIZED_401
       })
     })
 
@@ -204,7 +226,7 @@ describe('Test config API validators', function () {
         url: server.url,
         path,
         token: userAccessToken,
-        statusCodeExpected: 403
+        statusCodeExpected: HttpStatusCode.FORBIDDEN_403
       })
     })
   })
@@ -215,7 +237,7 @@ describe('Test config API validators', function () {
         url: server.url,
         path,
         fields: updateParams,
-        statusCodeExpected: 401
+        statusCodeExpected: HttpStatusCode.UNAUTHORIZED_401
       })
     })
 
@@ -225,7 +247,7 @@ describe('Test config API validators', function () {
         path,
         fields: updateParams,
         token: userAccessToken,
-        statusCodeExpected: 403
+        statusCodeExpected: HttpStatusCode.FORBIDDEN_403
       })
     })
 
@@ -237,7 +259,7 @@ describe('Test config API validators', function () {
         path,
         fields: newUpdateParams,
         token: server.accessToken,
-        statusCodeExpected: 400
+        statusCodeExpected: HttpStatusCode.BAD_REQUEST_400
       })
     })
 
@@ -253,7 +275,7 @@ describe('Test config API validators', function () {
         path,
         fields: newUpdateParams,
         token: server.accessToken,
-        statusCodeExpected: 400
+        statusCodeExpected: HttpStatusCode.BAD_REQUEST_400
       })
     })
 
@@ -272,7 +294,7 @@ describe('Test config API validators', function () {
         path,
         fields: newUpdateParams,
         token: server.accessToken,
-        statusCodeExpected: 400
+        statusCodeExpected: HttpStatusCode.BAD_REQUEST_400
       })
     })
 
@@ -293,7 +315,7 @@ describe('Test config API validators', function () {
         path,
         fields: newUpdateParams,
         token: server.accessToken,
-        statusCodeExpected: 400
+        statusCodeExpected: HttpStatusCode.BAD_REQUEST_400
       })
     })
 
@@ -303,7 +325,7 @@ describe('Test config API validators', function () {
         path,
         fields: updateParams,
         token: server.accessToken,
-        statusCodeExpected: 200
+        statusCodeExpected: HttpStatusCode.OK_200
       })
     })
   })
@@ -313,7 +335,7 @@ describe('Test config API validators', function () {
       await makeDeleteRequest({
         url: server.url,
         path,
-        statusCodeExpected: 401
+        statusCodeExpected: HttpStatusCode.UNAUTHORIZED_401
       })
     })
 
@@ -322,7 +344,7 @@ describe('Test config API validators', function () {
         url: server.url,
         path,
         token: userAccessToken,
-        statusCodeExpected: 403
+        statusCodeExpected: HttpStatusCode.FORBIDDEN_403
       })
     })
   })