diff options
Diffstat (limited to 'server/tests')
-rw-r--r-- | server/tests/api/check-params/pods.js | 8 | ||||
-rw-r--r-- | server/tests/utils/requests.js | 11 |
2 files changed, 16 insertions, 3 deletions
diff --git a/server/tests/api/check-params/pods.js b/server/tests/api/check-params/pods.js index 2f85af644..8d52b69b1 100644 --- a/server/tests/api/check-params/pods.js +++ b/server/tests/api/check-params/pods.js | |||
@@ -189,6 +189,14 @@ describe('Test pods API validators', function () { | |||
189 | } | 189 | } |
190 | requestsUtils.makePostBodyRequest(server.url, path, null, data, done, 200) | 190 | requestsUtils.makePostBodyRequest(server.url, path, null, data, done, 200) |
191 | }) | 191 | }) |
192 | |||
193 | it('Should fail with a host that already exists', function (done) { | ||
194 | const data = { | ||
195 | host: 'coucou.com', | ||
196 | publicKey: 'mysuperpublickey' | ||
197 | } | ||
198 | requestsUtils.makePostBodyRequest(server.url, path, null, data, done, 409) | ||
199 | }) | ||
192 | }) | 200 | }) |
193 | 201 | ||
194 | after(function (done) { | 202 | after(function (done) { |
diff --git a/server/tests/utils/requests.js b/server/tests/utils/requests.js index b1470814d..84cf3483f 100644 --- a/server/tests/utils/requests.js +++ b/server/tests/utils/requests.js | |||
@@ -36,7 +36,8 @@ function makePostUploadRequest (url, path, token, fields, attaches, done, status | |||
36 | req.attach(attach, value) | 36 | req.attach(attach, value) |
37 | }) | 37 | }) |
38 | 38 | ||
39 | req.expect(statusCodeExpected, done) | 39 | req.expect(statusCodeExpected) |
40 | .end(done) | ||
40 | } | 41 | } |
41 | 42 | ||
42 | function makePostBodyRequest (url, path, token, fields, done, statusCodeExpected) { | 43 | function makePostBodyRequest (url, path, token, fields, done, statusCodeExpected) { |
@@ -48,7 +49,9 @@ function makePostBodyRequest (url, path, token, fields, done, statusCodeExpected | |||
48 | 49 | ||
49 | if (token) req.set('Authorization', 'Bearer ' + token) | 50 | if (token) req.set('Authorization', 'Bearer ' + token) |
50 | 51 | ||
51 | req.send(fields).expect(statusCodeExpected, done) | 52 | req.send(fields) |
53 | .expect(statusCodeExpected) | ||
54 | .end(done) | ||
52 | } | 55 | } |
53 | 56 | ||
54 | function makePutBodyRequest (url, path, token, fields, done, statusCodeExpected) { | 57 | function makePutBodyRequest (url, path, token, fields, done, statusCodeExpected) { |
@@ -60,7 +63,9 @@ function makePutBodyRequest (url, path, token, fields, done, statusCodeExpected) | |||
60 | 63 | ||
61 | if (token) req.set('Authorization', 'Bearer ' + token) | 64 | if (token) req.set('Authorization', 'Bearer ' + token) |
62 | 65 | ||
63 | req.send(fields).expect(statusCodeExpected, done) | 66 | req.send(fields) |
67 | .expect(statusCodeExpected) | ||
68 | .end(done) | ||
64 | } | 69 | } |
65 | 70 | ||
66 | // --------------------------------------------------------------------------- | 71 | // --------------------------------------------------------------------------- |