diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-01-24 16:08:09 +0100 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-01-24 16:08:09 +0100 |
commit | ee66c5930e6c3694434a259dfb4b7f3e9f39cf7b (patch) | |
tree | a880612dca3247fde962417077680ea34cc96d20 /test/api/checkParams.js | |
parent | 45239549bf2659998dcf9196d86974b0b625912e (diff) | |
download | PeerTube-ee66c5930e6c3694434a259dfb4b7f3e9f39cf7b.tar.gz PeerTube-ee66c5930e6c3694434a259dfb4b7f3e9f39cf7b.tar.zst PeerTube-ee66c5930e6c3694434a259dfb4b7f3e9f39cf7b.zip |
Tests refractoring
Diffstat (limited to 'test/api/checkParams.js')
-rw-r--r-- | test/api/checkParams.js | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/test/api/checkParams.js b/test/api/checkParams.js index 0fa83655f..11fc68ff9 100644 --- a/test/api/checkParams.js +++ b/test/api/checkParams.js | |||
@@ -1,6 +1,7 @@ | |||
1 | ;(function () { | 1 | ;(function () { |
2 | 'use strict' | 2 | 'use strict' |
3 | 3 | ||
4 | var async = require('async') | ||
4 | var chai = require('chai') | 5 | var chai = require('chai') |
5 | var expect = chai.expect | 6 | var expect = chai.expect |
6 | var request = require('supertest') | 7 | var request = require('supertest') |
@@ -11,18 +12,6 @@ | |||
11 | var app = null | 12 | var app = null |
12 | var url = '' | 13 | var url = '' |
13 | 14 | ||
14 | before(function (done) { | ||
15 | this.timeout(20000) | ||
16 | |||
17 | utils.flushTests(function () { | ||
18 | utils.runServer(1, function (app1, url1) { | ||
19 | app = app1 | ||
20 | url = url1 | ||
21 | done() | ||
22 | }) | ||
23 | }) | ||
24 | }) | ||
25 | |||
26 | function makePostRequest (path, fields, attach, done, fail) { | 15 | function makePostRequest (path, fields, attach, done, fail) { |
27 | var status_code = 400 | 16 | var status_code = 400 |
28 | if (fail !== undefined && fail === false) status_code = 200 | 17 | if (fail !== undefined && fail === false) status_code = 200 |
@@ -50,6 +39,25 @@ | |||
50 | .expect(status_code, done) | 39 | .expect(status_code, done) |
51 | } | 40 | } |
52 | 41 | ||
42 | // --------------------------------------------------------------- | ||
43 | |||
44 | before(function (done) { | ||
45 | this.timeout(20000) | ||
46 | |||
47 | async.series([ | ||
48 | function (next) { | ||
49 | utils.flushTests(next) | ||
50 | }, | ||
51 | function (next) { | ||
52 | utils.runServer(1, function (app1, url1) { | ||
53 | app = app1 | ||
54 | url = url1 | ||
55 | next() | ||
56 | }) | ||
57 | } | ||
58 | ], done) | ||
59 | }) | ||
60 | |||
53 | describe('Of the pods API', function () { | 61 | describe('Of the pods API', function () { |
54 | var path = '/api/v1/pods/' | 62 | var path = '/api/v1/pods/' |
55 | 63 | ||
@@ -284,9 +292,7 @@ | |||
284 | 292 | ||
285 | // Keep the logs if the test failed | 293 | // Keep the logs if the test failed |
286 | if (this.ok) { | 294 | if (this.ok) { |
287 | utils.flushTests(function () { | 295 | utils.flushTests(done) |
288 | done() | ||
289 | }) | ||
290 | } else { | 296 | } else { |
291 | done() | 297 | done() |
292 | } | 298 | } |