diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-03-07 18:53:03 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-03-07 18:53:03 +0100 |
commit | 3d446a26ada901331faaaf3be9083dfe6773b50a (patch) | |
tree | 35262fa99301db3f22ca6e61a84ce346ed4f4bb7 | |
parent | 6a1e67b30a77b0e24314617f794a7122dd83c570 (diff) | |
download | PeerTube-3d446a26ada901331faaaf3be9083dfe6773b50a.tar.gz PeerTube-3d446a26ada901331faaaf3be9083dfe6773b50a.tar.zst PeerTube-3d446a26ada901331faaaf3be9083dfe6773b50a.zip |
Fix tests
-rwxr-xr-x | bin/clean_test.sh | 2 | ||||
-rw-r--r-- | package.json | 5 | ||||
-rw-r--r-- | server/controllers/api/v1/index.js | 7 | ||||
-rw-r--r-- | server/helpers/logger.js | 2 | ||||
-rw-r--r-- | server/helpers/peertubeCrypto.js | 2 | ||||
-rw-r--r-- | server/initializers/checker.js | 2 | ||||
-rw-r--r-- | server/lib/videos.js | 2 | ||||
-rw-r--r-- | server/models/videos.js | 2 | ||||
-rw-r--r-- | server/tests/api/checkParams.js | 2 | ||||
-rw-r--r-- | server/tests/api/singlePod.js | 2 | ||||
-rw-r--r-- | server/tests/api/utils.js | 4 |
11 files changed, 21 insertions, 11 deletions
diff --git a/bin/clean_test.sh b/bin/clean_test.sh index ac885d9ec..ef146e091 100755 --- a/bin/clean_test.sh +++ b/bin/clean_test.sh | |||
@@ -4,5 +4,5 @@ basePath=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) | |||
4 | 4 | ||
5 | for i in $(seq 1 6); do | 5 | for i in $(seq 1 6); do |
6 | printf "use peertube-test%s;\ndb.dropDatabase();" "$i" | mongo | 6 | printf "use peertube-test%s;\ndb.dropDatabase();" "$i" | mongo |
7 | rm -rf "$basePath/../server/test$i" | 7 | rm -rf "$basePath/../test$i" |
8 | done | 8 | done |
diff --git a/package.json b/package.json index d7e29e0c1..cebd5b506 100644 --- a/package.json +++ b/package.json | |||
@@ -34,7 +34,7 @@ | |||
34 | "dev": "concurrently \"npm run livereload\" \"npm run client:tsc:watch\" \"npm run client:sass:watch\" \"npm start\"", | 34 | "dev": "concurrently \"npm run livereload\" \"npm run client:tsc:watch\" \"npm run client:sass:watch\" \"npm start\"", |
35 | "livereload": "livereload ./client", | 35 | "livereload": "livereload ./client", |
36 | "start": "node server", | 36 | "start": "node server", |
37 | "test": "standard && mocha tests" | 37 | "test": "standard && mocha server/tests" |
38 | }, | 38 | }, |
39 | "dependencies": { | 39 | "dependencies": { |
40 | "async": "^1.2.1", | 40 | "async": "^1.2.1", |
@@ -73,6 +73,9 @@ | |||
73 | "supertest": "^1.1.0" | 73 | "supertest": "^1.1.0" |
74 | }, | 74 | }, |
75 | "standard": { | 75 | "standard": { |
76 | "ignore": [ | ||
77 | "client/" | ||
78 | ], | ||
76 | "globals": [ | 79 | "globals": [ |
77 | "alert", | 80 | "alert", |
78 | "confirm", | 81 | "confirm", |
diff --git a/server/controllers/api/v1/index.js b/server/controllers/api/v1/index.js index 07a68ed9d..abbc5eb60 100644 --- a/server/controllers/api/v1/index.js +++ b/server/controllers/api/v1/index.js | |||
@@ -11,7 +11,14 @@ var videosController = require('./videos') | |||
11 | router.use('/pods', podsController) | 11 | router.use('/pods', podsController) |
12 | router.use('/remotevideos', remoteVideosController) | 12 | router.use('/remotevideos', remoteVideosController) |
13 | router.use('/videos', videosController) | 13 | router.use('/videos', videosController) |
14 | router.use('/*', badRequest) | ||
14 | 15 | ||
15 | // --------------------------------------------------------------------------- | 16 | // --------------------------------------------------------------------------- |
16 | 17 | ||
17 | module.exports = router | 18 | module.exports = router |
19 | |||
20 | // --------------------------------------------------------------------------- | ||
21 | |||
22 | function badRequest (req, res, next) { | ||
23 | res.sendStatus(400) | ||
24 | } | ||
diff --git a/server/helpers/logger.js b/server/helpers/logger.js index 67f69a875..1c15a0edd 100644 --- a/server/helpers/logger.js +++ b/server/helpers/logger.js | |||
@@ -6,7 +6,7 @@ var path = require('path') | |||
6 | var winston = require('winston') | 6 | var winston = require('winston') |
7 | winston.emitErrs = true | 7 | winston.emitErrs = true |
8 | 8 | ||
9 | var logDir = path.join(__dirname, '..', config.get('storage.logs')) | 9 | var logDir = path.join(__dirname, '..', '..', config.get('storage.logs')) |
10 | var logger = new winston.Logger({ | 10 | var logger = new winston.Logger({ |
11 | transports: [ | 11 | transports: [ |
12 | new winston.transports.File({ | 12 | new winston.transports.File({ |
diff --git a/server/helpers/peertubeCrypto.js b/server/helpers/peertubeCrypto.js index 29b9d79c9..7e65c43e1 100644 --- a/server/helpers/peertubeCrypto.js +++ b/server/helpers/peertubeCrypto.js | |||
@@ -9,7 +9,7 @@ var ursa = require('ursa') | |||
9 | 9 | ||
10 | var logger = require('./logger') | 10 | var logger = require('./logger') |
11 | 11 | ||
12 | var certDir = path.join(__dirname, '..', config.get('storage.certs')) | 12 | var certDir = path.join(__dirname, '..', '..', config.get('storage.certs')) |
13 | var algorithm = 'aes-256-ctr' | 13 | var algorithm = 'aes-256-ctr' |
14 | 14 | ||
15 | var peertubeCrypto = { | 15 | var peertubeCrypto = { |
diff --git a/server/initializers/checker.js b/server/initializers/checker.js index ec7bc0ad2..44d9ea85b 100644 --- a/server/initializers/checker.js +++ b/server/initializers/checker.js | |||
@@ -34,7 +34,7 @@ function createDirectoriesIfNotExist () { | |||
34 | for (var key of Object.keys(storages)) { | 34 | for (var key of Object.keys(storages)) { |
35 | var dir = storages[key] | 35 | var dir = storages[key] |
36 | try { | 36 | try { |
37 | mkdirp.sync(path.join(__dirname, '..', dir)) | 37 | mkdirp.sync(path.join(__dirname, '..', '..', dir)) |
38 | } catch (error) { | 38 | } catch (error) { |
39 | throw new Error('Cannot create ' + path + ':' + error) | 39 | throw new Error('Cannot create ' + path + ':' + error) |
40 | } | 40 | } |
diff --git a/server/lib/videos.js b/server/lib/videos.js index 1e0a83b8b..3c6ee4a65 100644 --- a/server/lib/videos.js +++ b/server/lib/videos.js | |||
@@ -9,7 +9,7 @@ var webtorrent = require('../lib/webtorrent') | |||
9 | var logger = require('../helpers/logger') | 9 | var logger = require('../helpers/logger') |
10 | var Videos = require('../models/videos') | 10 | var Videos = require('../models/videos') |
11 | 11 | ||
12 | var uploadDir = path.join(__dirname, '..', config.get('storage.uploads')) | 12 | var uploadDir = path.join(__dirname, '..', '..', config.get('storage.uploads')) |
13 | 13 | ||
14 | var videos = { | 14 | var videos = { |
15 | seed: seed, | 15 | seed: seed, |
diff --git a/server/models/videos.js b/server/models/videos.js index 5e2eeae07..436c08bfd 100644 --- a/server/models/videos.js +++ b/server/models/videos.js | |||
@@ -12,7 +12,7 @@ var logger = require('../helpers/logger') | |||
12 | var http = config.get('webserver.https') === true ? 'https' : 'http' | 12 | var http = config.get('webserver.https') === true ? 'https' : 'http' |
13 | var host = config.get('webserver.host') | 13 | var host = config.get('webserver.host') |
14 | var port = config.get('webserver.port') | 14 | var port = config.get('webserver.port') |
15 | var uploadDir = path.join(__dirname, '..', config.get('storage.uploads')) | 15 | var uploadDir = path.join(__dirname, '..', '..', config.get('storage.uploads')) |
16 | 16 | ||
17 | // --------------------------------------------------------------------------- | 17 | // --------------------------------------------------------------------------- |
18 | 18 | ||
diff --git a/server/tests/api/checkParams.js b/server/tests/api/checkParams.js index 1c1ec71b3..01b620873 100644 --- a/server/tests/api/checkParams.js +++ b/server/tests/api/checkParams.js | |||
@@ -252,7 +252,7 @@ describe('Test parameters validator', function () { | |||
252 | it('Should have 404 with nothing', function (done) { | 252 | it('Should have 404 with nothing', function (done) { |
253 | request(url) | 253 | request(url) |
254 | .delete(path) | 254 | .delete(path) |
255 | .expect(404, done) | 255 | .expect(400, done) |
256 | }) | 256 | }) |
257 | 257 | ||
258 | it('Should fail without a mongodb id', function (done) { | 258 | it('Should fail without a mongodb id', function (done) { |
diff --git a/server/tests/api/singlePod.js b/server/tests/api/singlePod.js index 3dd72c01b..d572aacf6 100644 --- a/server/tests/api/singlePod.js +++ b/server/tests/api/singlePod.js | |||
@@ -112,7 +112,7 @@ describe('Test a single pod', function () { | |||
112 | utils.removeVideo(url, video_id, function (err) { | 112 | utils.removeVideo(url, video_id, function (err) { |
113 | if (err) throw err | 113 | if (err) throw err |
114 | 114 | ||
115 | fs.readdir(pathUtils.join(__dirname, '../../test1/uploads/'), function (err, files) { | 115 | fs.readdir(pathUtils.join(__dirname, '../../../test1/uploads/'), function (err, files) { |
116 | if (err) throw err | 116 | if (err) throw err |
117 | 117 | ||
118 | expect(files.length).to.equal(0) | 118 | expect(files.length).to.equal(0) |
diff --git a/server/tests/api/utils.js b/server/tests/api/utils.js index 47b706294..c70696571 100644 --- a/server/tests/api/utils.js +++ b/server/tests/api/utils.js | |||
@@ -22,7 +22,7 @@ var testUtils = { | |||
22 | // ---------------------- Export functions -------------------- | 22 | // ---------------------- Export functions -------------------- |
23 | 23 | ||
24 | function flushTests (callback) { | 24 | function flushTests (callback) { |
25 | exec(pathUtils.join(__dirname, '../../scripts/clean_test.sh'), callback) | 25 | exec(pathUtils.join(__dirname, '../../../bin/clean_test.sh'), callback) |
26 | } | 26 | } |
27 | 27 | ||
28 | function getFriendsList (url, end) { | 28 | function getFriendsList (url, end) { |
@@ -139,7 +139,7 @@ function runServer (number, callback) { | |||
139 | detached: true | 139 | detached: true |
140 | } | 140 | } |
141 | 141 | ||
142 | var app = fork(pathUtils.join(__dirname, '../../server.js'), [], options) | 142 | var app = fork(pathUtils.join(__dirname, '../../../server.js'), [], options) |
143 | app.stdout.on('data', function onStdout (data) { | 143 | app.stdout.on('data', function onStdout (data) { |
144 | var dont_continue = false | 144 | var dont_continue = false |
145 | // Check if all required sentences are here | 145 | // Check if all required sentences are here |