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