]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - server/tests/api/server/config.ts
Add option to not transcode original resolution
[github/Chocobozzz/PeerTube.git] / server / tests / api / server / config.ts
CommitLineData
a1587156 1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
0e1dc3e7
C
2
3import 'mocha'
4import * as chai from 'chai'
c55e3d72
C
5import { parallelTests } from '@shared/core-utils'
6import { CustomConfig, HttpStatusCode } from '@shared/models'
0e1dc3e7 7import {
7c3b7976 8 cleanupTests,
254d3579 9 createSingleServer,
a1587156 10 killallServers,
8155db66 11 makeGetRequest,
254d3579 12 PeerTubeServer,
d23dd9fb 13 setAccessTokensToServers
bf54587a 14} from '@shared/server-commands'
0e1dc3e7 15
5bcfd029
C
16const expect = chai.expect
17
254d3579 18function checkInitialConfig (server: PeerTubeServer, data: CustomConfig) {
40e87e9e
C
19 expect(data.instance.name).to.equal('PeerTube')
20 expect(data.instance.shortDescription).to.equal(
482fa503 21 'PeerTube, an ActivityPub-federated video streaming platform using P2P directly in your web browser.'
40e87e9e
C
22 )
23 expect(data.instance.description).to.equal('Welcome to this PeerTube instance!')
ccc00cb2 24
40e87e9e 25 expect(data.instance.terms).to.equal('No terms for now.')
8ae03c37 26 expect(data.instance.creationReason).to.be.empty
ccc00cb2
C
27 expect(data.instance.codeOfConduct).to.be.empty
28 expect(data.instance.moderationInformation).to.be.empty
29 expect(data.instance.administrator).to.be.empty
30 expect(data.instance.maintenanceLifetime).to.be.empty
31 expect(data.instance.businessModel).to.be.empty
be04c6fd 32 expect(data.instance.hardwareInformation).to.be.empty
ccc00cb2
C
33
34 expect(data.instance.languages).to.have.lengthOf(0)
35 expect(data.instance.categories).to.have.lengthOf(0)
36
40e87e9e 37 expect(data.instance.defaultClientRoute).to.equal('/videos/trending')
f8802489 38 expect(data.instance.isNSFW).to.be.false
40e87e9e
C
39 expect(data.instance.defaultNSFWPolicy).to.equal('display')
40 expect(data.instance.customizations.css).to.be.empty
41 expect(data.instance.customizations.javascript).to.be.empty
a4101923 42
40e87e9e
C
43 expect(data.services.twitter.username).to.equal('@Chocobozzz')
44 expect(data.services.twitter.whitelisted).to.be.false
a4101923 45
0bc53e20
C
46 expect(data.client.videos.miniature.preferAuthorDisplayName).to.be.false
47 expect(data.client.menu.login.redirectOnSingleExternalAuth).to.be.false
48
40e87e9e
C
49 expect(data.cache.previews.size).to.equal(1)
50 expect(data.cache.captions.size).to.equal(1)
b3d5cb92 51 expect(data.cache.torrents.size).to.equal(1)
a4101923 52
40e87e9e
C
53 expect(data.signup.enabled).to.be.true
54 expect(data.signup.limit).to.equal(4)
1f256e7d 55 expect(data.signup.minimumAge).to.equal(16)
d9eaee39 56 expect(data.signup.requiresEmailVerification).to.be.false
a4101923 57
48f07b4a 58 expect(data.admin.email).to.equal('admin' + server.internalServerNumber + '@example.com')
a4101923
C
59 expect(data.contactForm.enabled).to.be.true
60
40e87e9e 61 expect(data.user.videoQuota).to.equal(5242880)
9ee92651 62 expect(data.user.videoQuotaDaily).to.equal(-1)
c6c0fa6c 63
754b6f5f
FC
64 expect(data.videoChannels.maxPerUser).to.equal(20)
65
40e87e9e 66 expect(data.transcoding.enabled).to.be.false
14e2014a 67 expect(data.transcoding.allowAdditionalExtensions).to.be.false
536598cf 68 expect(data.transcoding.allowAudioFiles).to.be.false
40e87e9e 69 expect(data.transcoding.threads).to.equal(2)
9129b769 70 expect(data.transcoding.concurrency).to.equal(2)
1896bca0 71 expect(data.transcoding.profile).to.equal('default')
8dd754c7 72 expect(data.transcoding.resolutions['144p']).to.be.false
40e87e9e
C
73 expect(data.transcoding.resolutions['240p']).to.be.true
74 expect(data.transcoding.resolutions['360p']).to.be.true
75 expect(data.transcoding.resolutions['480p']).to.be.true
76 expect(data.transcoding.resolutions['720p']).to.be.true
77 expect(data.transcoding.resolutions['1080p']).to.be.true
b7085c71 78 expect(data.transcoding.resolutions['1440p']).to.be.true
db714ab4 79 expect(data.transcoding.resolutions['2160p']).to.be.true
84cae54e 80 expect(data.transcoding.alwaysTranscodeOriginalResolution).to.be.true
d7a25329 81 expect(data.transcoding.webtorrent.enabled).to.be.true
09209296
C
82 expect(data.transcoding.hls.enabled).to.be.true
83
c6c0fa6c 84 expect(data.live.enabled).to.be.false
c655c9ef 85 expect(data.live.allowReplay).to.be.false
f443a746 86 expect(data.live.latencySetting.enabled).to.be.true
c9bc850e 87 expect(data.live.maxDuration).to.equal(-1)
a056ca48
C
88 expect(data.live.maxInstanceLives).to.equal(20)
89 expect(data.live.maxUserLives).to.equal(3)
c6c0fa6c
C
90 expect(data.live.transcoding.enabled).to.be.false
91 expect(data.live.transcoding.threads).to.equal(2)
1896bca0 92 expect(data.live.transcoding.profile).to.equal('default')
8dd754c7 93 expect(data.live.transcoding.resolutions['144p']).to.be.false
c6c0fa6c
C
94 expect(data.live.transcoding.resolutions['240p']).to.be.false
95 expect(data.live.transcoding.resolutions['360p']).to.be.false
96 expect(data.live.transcoding.resolutions['480p']).to.be.false
97 expect(data.live.transcoding.resolutions['720p']).to.be.false
98 expect(data.live.transcoding.resolutions['1080p']).to.be.false
b7085c71 99 expect(data.live.transcoding.resolutions['1440p']).to.be.false
c6c0fa6c 100 expect(data.live.transcoding.resolutions['2160p']).to.be.false
84cae54e 101 expect(data.live.transcoding.alwaysTranscodeOriginalResolution).to.be.true
c6c0fa6c 102
92e66e04 103 expect(data.videoStudio.enabled).to.be.false
c729caf6 104
9129b769 105 expect(data.import.videos.concurrency).to.equal(2)
5d08a6a7 106 expect(data.import.videos.http.enabled).to.be.true
a84b8fa5 107 expect(data.import.videos.torrent.enabled).to.be.true
7ccddd7b 108 expect(data.autoBlacklist.videos.ofUsers.enabled).to.be.false
5b9c965d
C
109
110 expect(data.followers.instance.enabled).to.be.true
14893eb7 111 expect(data.followers.instance.manualApproval).to.be.false
8424c402
C
112
113 expect(data.followings.instance.autoFollowBack.enabled).to.be.false
114 expect(data.followings.instance.autoFollowIndex.enabled).to.be.false
c9215a1b 115 expect(data.followings.instance.autoFollowIndex.indexUrl).to.equal('')
72c33e71
C
116
117 expect(data.broadcastMessage.enabled).to.be.false
118 expect(data.broadcastMessage.level).to.equal('info')
119 expect(data.broadcastMessage.message).to.equal('')
120 expect(data.broadcastMessage.dismissable).to.be.false
40e87e9e
C
121}
122
123function checkUpdatedConfig (data: CustomConfig) {
124 expect(data.instance.name).to.equal('PeerTube updated')
125 expect(data.instance.shortDescription).to.equal('my short description')
126 expect(data.instance.description).to.equal('my super description')
ccc00cb2 127
40e87e9e 128 expect(data.instance.terms).to.equal('my super terms')
8ae03c37 129 expect(data.instance.creationReason).to.equal('my super creation reason')
ccc00cb2
C
130 expect(data.instance.codeOfConduct).to.equal('my super coc')
131 expect(data.instance.moderationInformation).to.equal('my super moderation information')
132 expect(data.instance.administrator).to.equal('Kuja')
133 expect(data.instance.maintenanceLifetime).to.equal('forever')
134 expect(data.instance.businessModel).to.equal('my super business model')
be04c6fd 135 expect(data.instance.hardwareInformation).to.equal('2vCore 3GB RAM')
ccc00cb2
C
136
137 expect(data.instance.languages).to.deep.equal([ 'en', 'es' ])
138 expect(data.instance.categories).to.deep.equal([ 1, 2 ])
139
40e87e9e 140 expect(data.instance.defaultClientRoute).to.equal('/videos/recently-added')
f8802489 141 expect(data.instance.isNSFW).to.be.true
40e87e9e
C
142 expect(data.instance.defaultNSFWPolicy).to.equal('blur')
143 expect(data.instance.customizations.javascript).to.equal('alert("coucou")')
144 expect(data.instance.customizations.css).to.equal('body { background-color: red; }')
a4101923 145
40e87e9e
C
146 expect(data.services.twitter.username).to.equal('@Kuja')
147 expect(data.services.twitter.whitelisted).to.be.true
a4101923 148
0bc53e20
C
149 expect(data.client.videos.miniature.preferAuthorDisplayName).to.be.true
150 expect(data.client.menu.login.redirectOnSingleExternalAuth).to.be.true
151
40e87e9e
C
152 expect(data.cache.previews.size).to.equal(2)
153 expect(data.cache.captions.size).to.equal(3)
b3d5cb92 154 expect(data.cache.torrents.size).to.equal(4)
a4101923 155
40e87e9e
C
156 expect(data.signup.enabled).to.be.false
157 expect(data.signup.limit).to.equal(5)
576ad67a 158 expect(data.signup.requiresEmailVerification).to.be.false
1f256e7d 159 expect(data.signup.minimumAge).to.equal(10)
a4101923 160
48f07b4a
C
161 // We override admin email in parallel tests, so skip this exception
162 if (parallelTests() === false) {
163 expect(data.admin.email).to.equal('superadmin1@example.com')
164 }
165
a4101923
C
166 expect(data.contactForm.enabled).to.be.false
167
40e87e9e 168 expect(data.user.videoQuota).to.equal(5242881)
bee0abff 169 expect(data.user.videoQuotaDaily).to.equal(318742)
a4101923 170
754b6f5f
FC
171 expect(data.videoChannels.maxPerUser).to.equal(24)
172
40e87e9e
C
173 expect(data.transcoding.enabled).to.be.true
174 expect(data.transcoding.threads).to.equal(1)
9129b769 175 expect(data.transcoding.concurrency).to.equal(3)
14e2014a 176 expect(data.transcoding.allowAdditionalExtensions).to.be.true
536598cf 177 expect(data.transcoding.allowAudioFiles).to.be.true
1896bca0 178 expect(data.transcoding.profile).to.equal('vod_profile')
8dd754c7 179 expect(data.transcoding.resolutions['144p']).to.be.false
40e87e9e
C
180 expect(data.transcoding.resolutions['240p']).to.be.false
181 expect(data.transcoding.resolutions['360p']).to.be.true
182 expect(data.transcoding.resolutions['480p']).to.be.true
183 expect(data.transcoding.resolutions['720p']).to.be.false
184 expect(data.transcoding.resolutions['1080p']).to.be.false
db714ab4 185 expect(data.transcoding.resolutions['2160p']).to.be.false
84cae54e 186 expect(data.transcoding.alwaysTranscodeOriginalResolution).to.be.false
09209296 187 expect(data.transcoding.hls.enabled).to.be.false
d7a25329 188 expect(data.transcoding.webtorrent.enabled).to.be.true
a4101923 189
c6c0fa6c 190 expect(data.live.enabled).to.be.true
c655c9ef 191 expect(data.live.allowReplay).to.be.true
f443a746 192 expect(data.live.latencySetting.enabled).to.be.false
fb719404 193 expect(data.live.maxDuration).to.equal(5000)
a056ca48
C
194 expect(data.live.maxInstanceLives).to.equal(-1)
195 expect(data.live.maxUserLives).to.equal(10)
c6c0fa6c
C
196 expect(data.live.transcoding.enabled).to.be.true
197 expect(data.live.transcoding.threads).to.equal(4)
1896bca0 198 expect(data.live.transcoding.profile).to.equal('live_profile')
8dd754c7 199 expect(data.live.transcoding.resolutions['144p']).to.be.true
c6c0fa6c
C
200 expect(data.live.transcoding.resolutions['240p']).to.be.true
201 expect(data.live.transcoding.resolutions['360p']).to.be.true
202 expect(data.live.transcoding.resolutions['480p']).to.be.true
203 expect(data.live.transcoding.resolutions['720p']).to.be.true
204 expect(data.live.transcoding.resolutions['1080p']).to.be.true
205 expect(data.live.transcoding.resolutions['2160p']).to.be.true
84cae54e 206 expect(data.live.transcoding.alwaysTranscodeOriginalResolution).to.be.false
c6c0fa6c 207
92e66e04 208 expect(data.videoStudio.enabled).to.be.true
c729caf6 209
9129b769 210 expect(data.import.videos.concurrency).to.equal(4)
5d08a6a7 211 expect(data.import.videos.http.enabled).to.be.false
a84b8fa5 212 expect(data.import.videos.torrent.enabled).to.be.false
7ccddd7b 213 expect(data.autoBlacklist.videos.ofUsers.enabled).to.be.true
5b9c965d
C
214
215 expect(data.followers.instance.enabled).to.be.false
14893eb7 216 expect(data.followers.instance.manualApproval).to.be.true
8424c402
C
217
218 expect(data.followings.instance.autoFollowBack.enabled).to.be.true
219 expect(data.followings.instance.autoFollowIndex.enabled).to.be.true
220 expect(data.followings.instance.autoFollowIndex.indexUrl).to.equal('https://updated.example.com')
72c33e71
C
221
222 expect(data.broadcastMessage.enabled).to.be.true
223 expect(data.broadcastMessage.level).to.equal('error')
224 expect(data.broadcastMessage.message).to.equal('super bad message')
225 expect(data.broadcastMessage.dismissable).to.be.true
40e87e9e
C
226}
227
8d8a037e
JB
228const newCustomConfig: CustomConfig = {
229 instance: {
230 name: 'PeerTube updated',
231 shortDescription: 'my short description',
232 description: 'my super description',
233 terms: 'my super terms',
234 codeOfConduct: 'my super coc',
235
236 creationReason: 'my super creation reason',
237 moderationInformation: 'my super moderation information',
238 administrator: 'Kuja',
239 maintenanceLifetime: 'forever',
240 businessModel: 'my super business model',
241 hardwareInformation: '2vCore 3GB RAM',
242
243 languages: [ 'en', 'es' ],
244 categories: [ 1, 2 ],
245
246 isNSFW: true,
247 defaultNSFWPolicy: 'blur' as 'blur',
248
249 defaultClientRoute: '/videos/recently-added',
250
251 customizations: {
252 javascript: 'alert("coucou")',
253 css: 'body { background-color: red; }'
254 }
255 },
256 theme: {
257 default: 'default'
258 },
259 services: {
260 twitter: {
261 username: '@Kuja',
262 whitelisted: true
263 }
264 },
0bc53e20
C
265 client: {
266 videos: {
267 miniature: {
268 preferAuthorDisplayName: true
269 }
270 },
271 menu: {
272 login: {
273 redirectOnSingleExternalAuth: true
274 }
275 }
276 },
8d8a037e
JB
277 cache: {
278 previews: {
279 size: 2
280 },
281 captions: {
282 size: 3
283 },
284 torrents: {
285 size: 4
286 }
287 },
288 signup: {
289 enabled: false,
290 limit: 5,
291 requiresEmailVerification: false,
292 minimumAge: 10
293 },
294 admin: {
295 email: 'superadmin1@example.com'
296 },
297 contactForm: {
298 enabled: false
299 },
300 user: {
301 videoQuota: 5242881,
302 videoQuotaDaily: 318742
303 },
754b6f5f
FC
304 videoChannels: {
305 maxPerUser: 24
306 },
8d8a037e
JB
307 transcoding: {
308 enabled: true,
309 allowAdditionalExtensions: true,
310 allowAudioFiles: true,
311 threads: 1,
312 concurrency: 3,
313 profile: 'vod_profile',
314 resolutions: {
315 '0p': false,
8dd754c7 316 '144p': false,
8d8a037e
JB
317 '240p': false,
318 '360p': true,
319 '480p': true,
320 '720p': false,
321 '1080p': false,
322 '1440p': false,
323 '2160p': false
324 },
84cae54e 325 alwaysTranscodeOriginalResolution: false,
8d8a037e
JB
326 webtorrent: {
327 enabled: true
328 },
329 hls: {
330 enabled: false
331 }
332 },
333 live: {
334 enabled: true,
335 allowReplay: true,
f443a746
C
336 latencySetting: {
337 enabled: false
338 },
8d8a037e
JB
339 maxDuration: 5000,
340 maxInstanceLives: -1,
341 maxUserLives: 10,
342 transcoding: {
343 enabled: true,
344 threads: 4,
345 profile: 'live_profile',
346 resolutions: {
8dd754c7 347 '144p': true,
8d8a037e
JB
348 '240p': true,
349 '360p': true,
350 '480p': true,
351 '720p': true,
352 '1080p': true,
353 '1440p': true,
354 '2160p': true
84cae54e
C
355 },
356 alwaysTranscodeOriginalResolution: false
8d8a037e
JB
357 }
358 },
92e66e04 359 videoStudio: {
c729caf6
C
360 enabled: true
361 },
8d8a037e
JB
362 import: {
363 videos: {
364 concurrency: 4,
365 http: {
366 enabled: false
367 },
368 torrent: {
369 enabled: false
370 }
371 }
372 },
373 trending: {
374 videos: {
375 algorithms: {
010382b6 376 enabled: [ 'hot', 'most-viewed', 'most-liked' ],
8d8a037e
JB
377 default: 'hot'
378 }
379 }
380 },
381 autoBlacklist: {
382 videos: {
383 ofUsers: {
384 enabled: true
385 }
386 }
387 },
388 followers: {
389 instance: {
390 enabled: false,
391 manualApproval: true
392 }
393 },
394 followings: {
395 instance: {
396 autoFollowBack: {
397 enabled: true
398 },
399 autoFollowIndex: {
400 enabled: true,
401 indexUrl: 'https://updated.example.com'
402 }
403 }
404 },
405 broadcastMessage: {
406 enabled: true,
407 level: 'error',
408 message: 'super bad message',
409 dismissable: true
410 },
411 search: {
412 remoteUri: {
413 anonymous: true,
414 users: true
415 },
416 searchIndex: {
417 enabled: true,
418 url: 'https://search.joinpeertube.org',
419 disableLocalSearch: true,
420 isDefaultSearch: true
421 }
422 }
423}
424
425describe('Test static config', function () {
426 let server: PeerTubeServer = null
427
428 before(async function () {
429 this.timeout(30000)
430
cf0c8ee5 431 server = await createSingleServer(1, { webadmin: { configuration: { edition: { allowed: false } } } })
8d8a037e
JB
432 await setAccessTokensToServers([ server ])
433 })
434
435 it('Should tell the client that edits are not allowed', async function () {
436 const data = await server.config.getConfig()
437
cf0c8ee5 438 expect(data.webadmin.configuration.edition.allowed).to.be.false
8d8a037e
JB
439 })
440
441 it('Should error when client tries to update', async function () {
442 await server.config.updateCustomConfig({ newCustomConfig, expectedStatus: 405 })
443 })
f87d82b9
C
444
445 after(async function () {
446 await cleanupTests([ server ])
447 })
8d8a037e
JB
448})
449
0e1dc3e7 450describe('Test config', function () {
254d3579 451 let server: PeerTubeServer = null
0e1dc3e7
C
452
453 before(async function () {
e212f887 454 this.timeout(30000)
48f07b4a 455
254d3579 456 server = await createSingleServer(1)
fd206f0b 457 await setAccessTokensToServers([ server ])
0e1dc3e7
C
458 })
459
460 it('Should have a correct config on a server with registration enabled', async function () {
89d241a7 461 const data = await server.config.getConfig()
0e1dc3e7
C
462
463 expect(data.signup.allowed).to.be.true
464 })
465
466 it('Should have a correct config on a server with registration enabled and a users limit', async function () {
652b3056
C
467 this.timeout(5000)
468
47e0652b 469 await Promise.all([
89d241a7
C
470 server.users.register({ username: 'user1' }),
471 server.users.register({ username: 'user2' }),
472 server.users.register({ username: 'user3' })
47e0652b 473 ])
0e1dc3e7 474
89d241a7 475 const data = await server.config.getConfig()
0e1dc3e7
C
476
477 expect(data.signup.allowed).to.be.false
478 })
479
14e2014a 480 it('Should have the correct video allowed extensions', async function () {
89d241a7 481 const data = await server.config.getConfig()
14e2014a
C
482
483 expect(data.video.file.extensions).to.have.lengthOf(3)
484 expect(data.video.file.extensions).to.contain('.mp4')
485 expect(data.video.file.extensions).to.contain('.webm')
486 expect(data.video.file.extensions).to.contain('.ogv')
a4101923 487
89d241a7
C
488 await server.videos.upload({ attributes: { fixture: 'video_short.mkv' }, expectedStatus: HttpStatusCode.UNSUPPORTED_MEDIA_TYPE_415 })
489 await server.videos.upload({ attributes: { fixture: 'sample.ogg' }, expectedStatus: HttpStatusCode.UNSUPPORTED_MEDIA_TYPE_415 })
b345a804 490
a4101923 491 expect(data.contactForm.enabled).to.be.true
14e2014a
C
492 })
493
fd206f0b 494 it('Should get the customized configuration', async function () {
89d241a7 495 const data = await server.config.getCustomConfig()
fd206f0b 496
48f07b4a 497 checkInitialConfig(server, data)
fd206f0b
C
498 })
499
500 it('Should update the customized configuration', async function () {
89d241a7 501 await server.config.updateCustomConfig({ newCustomConfig })
fd206f0b 502
89d241a7 503 const data = await server.config.getCustomConfig()
40e87e9e 504 checkUpdatedConfig(data)
fd206f0b
C
505 })
506
14e2014a 507 it('Should have the correct updated video allowed extensions', async function () {
30bc55c8
C
508 this.timeout(10000)
509
89d241a7 510 const data = await server.config.getConfig()
14e2014a 511
30bc55c8 512 expect(data.video.file.extensions).to.have.length.above(4)
14e2014a
C
513 expect(data.video.file.extensions).to.contain('.mp4')
514 expect(data.video.file.extensions).to.contain('.webm')
515 expect(data.video.file.extensions).to.contain('.ogv')
516 expect(data.video.file.extensions).to.contain('.flv')
fccbbc1a 517 expect(data.video.file.extensions).to.contain('.wmv')
14e2014a 518 expect(data.video.file.extensions).to.contain('.mkv')
b345a804
C
519 expect(data.video.file.extensions).to.contain('.mp3')
520 expect(data.video.file.extensions).to.contain('.ogg')
521 expect(data.video.file.extensions).to.contain('.flac')
522
89d241a7
C
523 await server.videos.upload({ attributes: { fixture: 'video_short.mkv' }, expectedStatus: HttpStatusCode.OK_200 })
524 await server.videos.upload({ attributes: { fixture: 'sample.ogg' }, expectedStatus: HttpStatusCode.OK_200 })
14e2014a
C
525 })
526
fd206f0b 527 it('Should have the configuration updated after a restart', async function () {
61e9908c 528 this.timeout(30000)
23e27dd5 529
9293139f 530 await killallServers([ server ])
fd206f0b 531
254d3579 532 await server.run()
fd206f0b 533
89d241a7 534 const data = await server.config.getCustomConfig()
fd206f0b 535
40e87e9e 536 checkUpdatedConfig(data)
fd206f0b
C
537 })
538
36f9424f 539 it('Should fetch the about information', async function () {
89d241a7 540 const data = await server.config.getAbout()
36f9424f
C
541
542 expect(data.instance.name).to.equal('PeerTube updated')
2e3a0215 543 expect(data.instance.shortDescription).to.equal('my short description')
36f9424f
C
544 expect(data.instance.description).to.equal('my super description')
545 expect(data.instance.terms).to.equal('my super terms')
be04c6fd
C
546 expect(data.instance.codeOfConduct).to.equal('my super coc')
547
548 expect(data.instance.creationReason).to.equal('my super creation reason')
549 expect(data.instance.moderationInformation).to.equal('my super moderation information')
550 expect(data.instance.administrator).to.equal('Kuja')
551 expect(data.instance.maintenanceLifetime).to.equal('forever')
552 expect(data.instance.businessModel).to.equal('my super business model')
553 expect(data.instance.hardwareInformation).to.equal('2vCore 3GB RAM')
554
555 expect(data.instance.languages).to.deep.equal([ 'en', 'es' ])
556 expect(data.instance.categories).to.deep.equal([ 1, 2 ])
36f9424f
C
557 })
558
fd206f0b 559 it('Should remove the custom configuration', async function () {
23e27dd5
C
560 this.timeout(10000)
561
89d241a7 562 await server.config.deleteCustomConfig()
fd206f0b 563
89d241a7 564 const data = await server.config.getCustomConfig()
48f07b4a 565 checkInitialConfig(server, data)
fd206f0b
C
566 })
567
8155db66
C
568 it('Should enable frameguard', async function () {
569 this.timeout(25000)
570
571 {
572 const res = await makeGetRequest({
573 url: server.url,
574 path: '/api/v1/config',
c0e8b12e 575 expectedStatus: 200
8155db66
C
576 })
577
578 expect(res.headers['x-frame-options']).to.exist
579 }
580
9293139f 581 await killallServers([ server ])
8155db66
C
582
583 const config = {
584 security: {
585 frameguard: { enabled: false }
586 }
587 }
254d3579 588 await server.run(config)
8155db66
C
589
590 {
591 const res = await makeGetRequest({
592 url: server.url,
593 path: '/api/v1/config',
c0e8b12e 594 expectedStatus: 200
8155db66
C
595 })
596
597 expect(res.headers['x-frame-options']).to.not.exist
598 }
599 })
600
7c3b7976
C
601 after(async function () {
602 await cleanupTests([ server ])
0e1dc3e7
C
603 })
604})