diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-09-04 21:21:47 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-09-04 21:30:18 +0200 |
commit | 0e1dc3e7c69995c691e1dd82e3c2bc68748661ca (patch) | |
tree | f2a4b5cffc72e33c902b67083bbaa35b6f22f0ca /server/tests/api/config.js | |
parent | b0f9f39ed70299a208d1b388c72de8b7f3510cb7 (diff) | |
download | PeerTube-0e1dc3e7c69995c691e1dd82e3c2bc68748661ca.tar.gz PeerTube-0e1dc3e7c69995c691e1dd82e3c2bc68748661ca.tar.zst PeerTube-0e1dc3e7c69995c691e1dd82e3c2bc68748661ca.zip |
Convert tests to typescript
Diffstat (limited to 'server/tests/api/config.js')
-rw-r--r-- | server/tests/api/config.js | 83 |
1 files changed, 0 insertions, 83 deletions
diff --git a/server/tests/api/config.js b/server/tests/api/config.js deleted file mode 100644 index dc3cce052..000000000 --- a/server/tests/api/config.js +++ /dev/null | |||
@@ -1,83 +0,0 @@ | |||
1 | /* eslint-disable no-unused-expressions */ | ||
2 | |||
3 | 'use strict' | ||
4 | |||
5 | const chai = require('chai') | ||
6 | const expect = chai.expect | ||
7 | const series = require('async/series') | ||
8 | |||
9 | const serversUtils = require('../utils/servers') | ||
10 | const configUtils = require('../utils/config') | ||
11 | const usersUtils = require('../utils/users') | ||
12 | |||
13 | describe('Test config', function () { | ||
14 | let server = null | ||
15 | |||
16 | before(function (done) { | ||
17 | this.timeout(120000) | ||
18 | |||
19 | series([ | ||
20 | function (next) { | ||
21 | serversUtils.flushTests(next) | ||
22 | }, | ||
23 | function (next) { | ||
24 | serversUtils.runServer(1, function (server1) { | ||
25 | server = server1 | ||
26 | next() | ||
27 | }) | ||
28 | } | ||
29 | ], done) | ||
30 | }) | ||
31 | |||
32 | it('Should have a correct config on a server with registration enabled', function (done) { | ||
33 | configUtils.getConfig(server.url, function (err, res) { | ||
34 | if (err) throw err | ||
35 | |||
36 | const data = res.body | ||
37 | |||
38 | expect(data.signup.allowed).to.be.true | ||
39 | |||
40 | done() | ||
41 | }) | ||
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', next) | ||
48 | }, | ||
49 | |||
50 | function (next) { | ||
51 | usersUtils.registerUser(server.url, 'user2', 'super password', next) | ||
52 | }, | ||
53 | |||
54 | function (next) { | ||
55 | usersUtils.registerUser(server.url, 'user3', 'super password', next) | ||
56 | } | ||
57 | |||
58 | ], function (err) { | ||
59 | if (err) throw err | ||
60 | |||
61 | configUtils.getConfig(server.url, function (err, res) { | ||
62 | if (err) throw err | ||
63 | |||
64 | const data = res.body | ||
65 | |||
66 | expect(data.signup.allowed).to.be.false | ||
67 | |||
68 | done() | ||
69 | }) | ||
70 | }) | ||
71 | }) | ||
72 | |||
73 | after(function (done) { | ||
74 | process.kill(-server.app.pid) | ||
75 | |||
76 | // Keep the logs if the test failed | ||
77 | if (this.ok) { | ||
78 | serversUtils.flushTests(done) | ||
79 | } else { | ||
80 | done() | ||
81 | } | ||
82 | }) | ||
83 | }) | ||