]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - server/tests/api/config.ts
Optimize account creation
[github/Chocobozzz/PeerTube.git] / server / tests / api / config.ts
CommitLineData
0e1dc3e7
C
1/* tslint:disable:no-unused-expression */
2
3import 'mocha'
4import * as chai from 'chai'
5const expect = chai.expect
6
7import {
8 getConfig,
9 flushTests,
10 runServer,
11 registerUser
12} from '../utils'
13
14describe('Test config', function () {
15 let server = null
16
17 before(async function () {
47e0652b 18 this.timeout(10000)
0e1dc3e7
C
19
20 await flushTests()
21 server = await runServer(1)
22 })
23
24 it('Should have a correct config on a server with registration enabled', async function () {
25 const res = await getConfig(server.url)
26 const data = res.body
27
28 expect(data.signup.allowed).to.be.true
29 })
30
31 it('Should have a correct config on a server with registration enabled and a users limit', async function () {
47e0652b
C
32 await Promise.all([
33 registerUser(server.url, 'user1', 'super password'),
34 registerUser(server.url, 'user2', 'super password'),
35 registerUser(server.url, 'user3', 'super password')
36 ])
0e1dc3e7
C
37
38 const res = await getConfig(server.url)
39 const data = res.body
40
41 expect(data.signup.allowed).to.be.false
42 })
43
44 after(async function () {
45 process.kill(-server.app.pid)
46
47 // Keep the logs if the test failed
48 if (this['ok']) {
49 await flushTests()
50 }
51 })
52})