aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests')
-rw-r--r--server/tests/api/check-params/users.js8
-rw-r--r--server/tests/api/config.js38
2 files changed, 43 insertions, 3 deletions
diff --git a/server/tests/api/check-params/users.js b/server/tests/api/check-params/users.js
index 2c1189f7a..9e7115da1 100644
--- a/server/tests/api/check-params/users.js
+++ b/server/tests/api/check-params/users.js
@@ -513,7 +513,13 @@ describe('Test users API validators', function () {
513 password: 'my super password 4' 513 password: 'my super password 4'
514 } 514 }
515 515
516 requestsUtils.makePostBodyRequest(serverWithRegistrationDisabled.url, registrationPath, serverWithRegistrationDisabled.accessToken, data, done, 400) 516 requestsUtils.makePostBodyRequest(serverWithRegistrationDisabled.url, registrationPath, serverWithRegistrationDisabled.accessToken, data, done, 403)
517 })
518 })
519
520 describe('When registering multiple users on a server with users limit', function () {
521 it('Should fail when after 3 registrations', function (done) {
522 usersUtils.registerUser(server.url, 'user42', 'super password', 403, done)
517 }) 523 })
518 }) 524 })
519 525
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