]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/api/check-params/config.ts
Update video channel routes
[github/Chocobozzz/PeerTube.git] / server / tests / api / check-params / config.ts
index efc1e4e09bf0499f9319ba5c80a113b0562403fa..58b780f38f9677d4ad79fb228e264bec18c1f173 100644 (file)
@@ -2,11 +2,11 @@
 
 import { omit } from 'lodash'
 import 'mocha'
-import { CustomConfig } from '../../../../shared/models/config/custom-config.model'
+import { CustomConfig } from '../../../../shared/models/server/custom-config.model'
 
 import {
   createUser, flushTests, killallServers, makeDeleteRequest, makeGetRequest, makePutBodyRequest, runServer, ServerInfo,
-  setAccessTokensToServers, userLogin
+  setAccessTokensToServers, userLogin, immutableAssign
 } from '../../utils'
 
 describe('Test config API validators', function () {
@@ -16,8 +16,15 @@ describe('Test config API validators', function () {
   const updateParams: CustomConfig = {
     instance: {
       name: 'PeerTube updated',
+      shortDescription: 'my short description',
       description: 'my super description',
-      terms: 'my super terms'
+      terms: 'my super terms',
+      defaultClientRoute: '/videos/recently-added',
+      defaultNSFWPolicy: 'blur',
+      customizations: {
+        javascript: 'alert("coucou")',
+        css: 'body { background-color: red; }'
+      }
     },
     cache: {
       previews: {
@@ -116,6 +123,22 @@ describe('Test config API validators', function () {
       })
     })
 
+    it('Should fail with a bad default NSFW policy', async function () {
+      const newUpdateParams = immutableAssign(updateParams, {
+        instance: {
+          defaultNSFWPolicy: 'hello'
+        }
+      })
+
+      await makePutBodyRequest({
+        url: server.url,
+        path,
+        fields: newUpdateParams,
+        token: server.accessToken,
+        statusCodeExpected: 400
+      })
+    })
+
     it('Should success with the correct parameters', async function () {
       await makePutBodyRequest({
         url: server.url,