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