X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftests%2Fapi%2Fcheck-params%2Fconfig.ts;h=4038ecbf051e691c0445a312611f8204917740e0;hb=a4101923e699e49ceb9ff36e971c75417fafc9f0;hp=3fe517fadb810dc115b8c81d29255be22964bef6;hpb=2e3a0215d051dca1f7c8ef423564c8d37a255f77;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tests/api/check-params/config.ts b/server/tests/api/check-params/config.ts index 3fe517fad..4038ecbf0 100644 --- a/server/tests/api/check-params/config.ts +++ b/server/tests/api/check-params/config.ts @@ -6,8 +6,8 @@ import { CustomConfig } from '../../../../shared/models/server/custom-config.mod import { createUser, flushTests, killallServers, makeDeleteRequest, makeGetRequest, makePutBodyRequest, runServer, ServerInfo, - setAccessTokensToServers, userLogin -} from '../../utils' + setAccessTokensToServers, userLogin, immutableAssign +} from '../../../../shared/utils' describe('Test config API validators', function () { const path = '/api/v1/config/custom' @@ -20,28 +20,44 @@ describe('Test config API validators', function () { description: 'my super description', terms: 'my super terms', defaultClientRoute: '/videos/recently-added', + defaultNSFWPolicy: 'blur', customizations: { javascript: 'alert("coucou")', css: 'body { background-color: red; }' } }, + services: { + twitter: { + username: '@MySuperUsername', + whitelisted: true + } + }, cache: { previews: { size: 2 + }, + captions: { + size: 3 } }, signup: { enabled: false, - limit: 5 + limit: 5, + requiresEmailVerification: false }, admin: { email: 'superadmin1@example.com' }, + contactForm: { + enabled: false + }, user: { - videoQuota: 5242881 + videoQuota: 5242881, + videoQuotaDaily: 318742 }, transcoding: { enabled: true, + allowAdditionalExtensions: true, threads: 1, resolutions: { '240p': false, @@ -50,6 +66,16 @@ describe('Test config API validators', function () { '720p': false, '1080p': false } + }, + import: { + videos: { + http: { + enabled: false + }, + torrent: { + enabled: false + } + } } } @@ -122,6 +148,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,