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