aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/config.js
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-07-25 20:17:28 +0200
committerChocobozzz <florian.bigard@gmail.com>2017-07-25 20:17:28 +0200
commit291e8d3eed88fe714fb74ad897ac2c67347a85ff (patch)
tree20b4f9b8500ab4d9651d2a067fcf2948a6bfc9a4 /server/tests/api/config.js
parent3d09cdbf90902894c841d0a5ddb35eb772c53b8b (diff)
downloadPeerTube-291e8d3eed88fe714fb74ad897ac2c67347a85ff.tar.gz
PeerTube-291e8d3eed88fe714fb74ad897ac2c67347a85ff.tar.zst
PeerTube-291e8d3eed88fe714fb74ad897ac2c67347a85ff.zip
Add ability to limit user registrations
Diffstat (limited to 'server/tests/api/config.js')
-rw-r--r--server/tests/api/config.js38
1 files changed, 36 insertions, 2 deletions
diff --git a/server/tests/api/config.js b/server/tests/api/config.js
index e79e12823..f2c00f85a 100644
--- a/server/tests/api/config.js
+++ b/server/tests/api/config.js
@@ -8,6 +8,7 @@ const series = require('async/series')
8 8
9const serversUtils = require('../utils/servers') 9const serversUtils = require('../utils/servers')
10const configUtils = require('../utils/config') 10const configUtils = require('../utils/config')
11const usersUtils = require('../utils/users')
11 12
12describe('Test config', function () { 13describe('Test config', function () {
13 let server = null 14 let server = null
@@ -28,18 +29,51 @@ describe('Test config', function () {
28 ], done) 29 ], done)
29 }) 30 })
30 31
31 it('Should have a correct config', function (done) { 32 it('Should have a correct config on a server with registration enabled', function (done) {
32 configUtils.getConfig(server.url, function (err, res) { 33 configUtils.getConfig(server.url, function (err, res) {
33 if (err) throw err 34 if (err) throw err
34 35
35 const data = res.body 36 const data = res.body
36 37
37 expect(data.signup.enabled).to.be.truthy 38 expect(data.signup.allowed).to.be.truthy
38 39
39 done() 40 done()
40 }) 41 })
41 }) 42 })
42 43
44 it('Should have a correct config on a server with registration enabled and a users limit', function (done) {
45 series([
46 function (next) {
47 usersUtils.registerUser(server.url, 'user1', 'super password', done)
48 },
49
50 function (next) {
51 usersUtils.registerUser(server.url, 'user2', 'super password', done)
52 },
53
54 function (next) {
55 usersUtils.registerUser(server.url, 'user3', 'super password', done)
56 },
57
58 function (next) {
59 usersUtils.registerUser(server.url, 'user4', 'super password', done)
60 }
61
62 ], function (err) {
63 if (err) throw err
64
65 configUtils.getConfig(server.url, function (err, res) {
66 if (err) throw err
67
68 const data = res.body
69
70 expect(data.signup.allowed).to.be.truthy
71
72 done()
73 })
74 })
75 })
76
43 after(function (done) { 77 after(function (done) {
44 process.kill(-server.app.pid) 78 process.kill(-server.app.pid)
45 79