aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-03-10 11:32:39 +0100
committerChocobozzz <florian.bigard@gmail.com>2017-03-10 11:32:39 +0100
commite22528aca6eb58c8f8005790ac6e76ed4f8ad706 (patch)
tree9669efb759249438e2b065171f19f817f7d48440 /server/tests
parenta2457e9de4a598ea34629bc40eb882ce03ec0ede (diff)
downloadPeerTube-e22528aca6eb58c8f8005790ac6e76ed4f8ad706.tar.gz
PeerTube-e22528aca6eb58c8f8005790ac6e76ed4f8ad706.tar.zst
PeerTube-e22528aca6eb58c8f8005790ac6e76ed4f8ad706.zip
Server: add config endpoint
Diffstat (limited to 'server/tests')
-rw-r--r--server/tests/api/config.js53
-rw-r--r--server/tests/api/index.js1
-rw-r--r--server/tests/utils/config.js24
3 files changed, 78 insertions, 0 deletions
diff --git a/server/tests/api/config.js b/server/tests/api/config.js
new file mode 100644
index 000000000..08f955f2d
--- /dev/null
+++ b/server/tests/api/config.js
@@ -0,0 +1,53 @@
1/* eslint-disable no-unused-expressions */
2
3'use strict'
4
5const chai = require('chai')
6const expect = chai.expect
7const series = require('async/series')
8
9const serversUtils = require('../utils/servers')
10const configUtils = require('../utils/config')
11
12describe('Test config', function () {
13 let server = null
14
15 before(function (done) {
16 this.timeout(20000)
17
18 series([
19 function (next) {
20 serversUtils.flushTests(next)
21 },
22 function (next) {
23 serversUtils.runServer(1, function (server1) {
24 server = server1
25 next()
26 })
27 }
28 ], done)
29 })
30
31 it('Should have a correct config', function (done) {
32 configUtils.getConfig(server.url, function (err, res) {
33 if (err) throw err
34
35 const data = res.body
36
37 expect(data.signup.enabled).to.be.truthy
38
39 done()
40 })
41 })
42
43 after(function (done) {
44 process.kill(-server.app.pid)
45
46 // Keep the logs if the test failed
47 if (this.ok) {
48 serversUtils.flushTests(done)
49 } else {
50 done()
51 }
52 })
53})
diff --git a/server/tests/api/index.js b/server/tests/api/index.js
index 11f49e1e2..dc6ef92ab 100644
--- a/server/tests/api/index.js
+++ b/server/tests/api/index.js
@@ -1,6 +1,7 @@
1'use strict' 1'use strict'
2 2
3// Order of the tests we want to execute 3// Order of the tests we want to execute
4require('./config')
4require('./check-params') 5require('./check-params')
5require('./friends-basic') 6require('./friends-basic')
6require('./users') 7require('./users')
diff --git a/server/tests/utils/config.js b/server/tests/utils/config.js
new file mode 100644
index 000000000..0a507a60f
--- /dev/null
+++ b/server/tests/utils/config.js
@@ -0,0 +1,24 @@
1'use strict'
2
3const request = require('supertest')
4
5const configsUtils = {
6 getConfig
7}
8
9// ---------------------- Export functions --------------------
10
11function getConfig (url, end) {
12 const path = '/api/v1/config'
13
14 request(url)
15 .get(path)
16 .set('Accept', 'application/json')
17 .expect(200)
18 .expect('Content-Type', /json/)
19 .end(end)
20}
21
22// ---------------------------------------------------------------------------
23
24module.exports = configsUtils