aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-01-27 11:55:31 +0100
committerChocobozzz <florian.bigard@gmail.com>2017-01-27 11:55:31 +0100
commitb09ce6455f8e2bf9dd741532e6ad09309880ff74 (patch)
tree7d2ec942e50b8f3347ed4287e07e2bc88619e585 /server/tests
parent0d4fb7e6d482635cd725cd2f09cf981f82cbd92c (diff)
downloadPeerTube-b09ce6455f8e2bf9dd741532e6ad09309880ff74.tar.gz
PeerTube-b09ce6455f8e2bf9dd741532e6ad09309880ff74.tar.zst
PeerTube-b09ce6455f8e2bf9dd741532e6ad09309880ff74.zip
Server: error if we add a pod that already exists
Diffstat (limited to 'server/tests')
-rw-r--r--server/tests/api/check-params/pods.js8
-rw-r--r--server/tests/utils/requests.js11
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
42function makePostBodyRequest (url, path, token, fields, done, statusCodeExpected) { 43function 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
54function makePutBodyRequest (url, path, token, fields, done, statusCodeExpected) { 57function 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// ---------------------------------------------------------------------------