X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftests%2Fapi%2Fcheck-params%2Fconfig.ts;h=d117f26e61b3faeeb924a68bd2d9076e25aa42dd;hb=5b9c965d5aa747f29b081289f930ee215fdc23c8;hp=58b780f38f9677d4ad79fb228e264bec18c1f173;hpb=0883b3245bf0deb9106c4041e9afbd3521b79280;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tests/api/check-params/config.ts b/server/tests/api/check-params/config.ts index 58b780f38..d117f26e6 100644 --- a/server/tests/api/check-params/config.ts +++ b/server/tests/api/check-params/config.ts @@ -7,7 +7,7 @@ import { CustomConfig } from '../../../../shared/models/server/custom-config.mod import { createUser, flushTests, killallServers, makeDeleteRequest, makeGetRequest, makePutBodyRequest, runServer, ServerInfo, setAccessTokensToServers, userLogin, immutableAssign -} from '../../utils' +} from '../../../../shared/utils' describe('Test config API validators', function () { const path = '/api/v1/config/custom' @@ -19,6 +19,7 @@ describe('Test config API validators', function () { shortDescription: 'my short description', description: 'my super description', terms: 'my super terms', + isNSFW: true, defaultClientRoute: '/videos/recently-added', defaultNSFWPolicy: 'blur', customizations: { @@ -26,23 +27,38 @@ describe('Test config API validators', function () { 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,31 @@ describe('Test config API validators', function () { '480p': true, '720p': false, '1080p': false + }, + hls: { + enabled: false + } + }, + import: { + videos: { + http: { + enabled: false + }, + torrent: { + enabled: false + } + } + }, + autoBlacklist: { + videos: { + ofUsers: { + enabled: false + } + } + }, + followers: { + instance: { + enabled: false } } } @@ -139,6 +180,25 @@ describe('Test config API validators', function () { }) }) + it('Should fail if email disabled and signup requires email verification', async function () { + // opposite scenario - succcess when enable enabled - covered via tests/api/users/user-verification.ts + const newUpdateParams = immutableAssign(updateParams, { + signup: { + enabled: true, + limit: 5, + requiresEmailVerification: true + } + }) + + 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,