diff options
Diffstat (limited to 'server/tests/api/check-params/config.ts')
-rw-r--r-- | server/tests/api/check-params/config.ts | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/server/tests/api/check-params/config.ts b/server/tests/api/check-params/config.ts index 2f9f553ab..d67e51123 100644 --- a/server/tests/api/check-params/config.ts +++ b/server/tests/api/check-params/config.ts | |||
@@ -1,7 +1,8 @@ | |||
1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ | 1 | /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ |
2 | 2 | ||
3 | import 'mocha' | 3 | import 'mocha' |
4 | import { omit } from 'lodash' | 4 | import { merge, omit } from 'lodash' |
5 | import { CustomConfig, HttpStatusCode } from '@shared/models' | ||
5 | import { | 6 | import { |
6 | cleanupTests, | 7 | cleanupTests, |
7 | createSingleServer, | 8 | createSingleServer, |
@@ -11,7 +12,6 @@ import { | |||
11 | PeerTubeServer, | 12 | PeerTubeServer, |
12 | setAccessTokensToServers | 13 | setAccessTokensToServers |
13 | } from '@shared/server-commands' | 14 | } from '@shared/server-commands' |
14 | import { CustomConfig, HttpStatusCode } from '@shared/models' | ||
15 | 15 | ||
16 | describe('Test config API validators', function () { | 16 | describe('Test config API validators', function () { |
17 | const path = '/api/v1/config/custom' | 17 | const path = '/api/v1/config/custom' |
@@ -162,6 +162,10 @@ describe('Test config API validators', function () { | |||
162 | torrent: { | 162 | torrent: { |
163 | enabled: false | 163 | enabled: false |
164 | } | 164 | } |
165 | }, | ||
166 | videoChannelSynchronization: { | ||
167 | enabled: false, | ||
168 | maxPerUser: 10 | ||
165 | } | 169 | } |
166 | }, | 170 | }, |
167 | trending: { | 171 | trending: { |
@@ -346,7 +350,26 @@ describe('Test config API validators', function () { | |||
346 | }) | 350 | }) |
347 | }) | 351 | }) |
348 | 352 | ||
349 | it('Should success with the correct parameters', async function () { | 353 | it('Should fail with a disabled http upload & enabled sync', async function () { |
354 | const newUpdateParams: CustomConfig = merge({}, updateParams, { | ||
355 | import: { | ||
356 | videos: { | ||
357 | http: { enabled: false } | ||
358 | }, | ||
359 | videoChannelSynchronization: { enabled: true } | ||
360 | } | ||
361 | }) | ||
362 | |||
363 | await makePutBodyRequest({ | ||
364 | url: server.url, | ||
365 | path, | ||
366 | fields: newUpdateParams, | ||
367 | token: server.accessToken, | ||
368 | expectedStatus: HttpStatusCode.BAD_REQUEST_400 | ||
369 | }) | ||
370 | }) | ||
371 | |||
372 | it('Should succeed with the correct parameters', async function () { | ||
350 | await makePutBodyRequest({ | 373 | await makePutBodyRequest({ |
351 | url: server.url, | 374 | url: server.url, |
352 | path, | 375 | path, |