aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/check-params/pods.js
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api/check-params/pods.js')
-rw-r--r--server/tests/api/check-params/pods.js52
1 files changed, 48 insertions, 4 deletions
diff --git a/server/tests/api/check-params/pods.js b/server/tests/api/check-params/pods.js
index 2567fff5f..35ea59093 100644
--- a/server/tests/api/check-params/pods.js
+++ b/server/tests/api/check-params/pods.js
@@ -17,7 +17,7 @@ describe('Test pods API validators', function () {
17 // --------------------------------------------------------------- 17 // ---------------------------------------------------------------
18 18
19 before(function (done) { 19 before(function (done) {
20 this.timeout(20000) 20 this.timeout(45000)
21 21
22 series([ 22 series([
23 function (next) { 23 function (next) {
@@ -110,7 +110,7 @@ describe('Test pods API validators', function () {
110 .expect(400, done) 110 .expect(400, done)
111 }) 111 })
112 112
113 it('Should fail with a invalid token', function (done) { 113 it('Should fail with an invalid token', function (done) {
114 request(server.url) 114 request(server.url)
115 .post(path + '/makefriends') 115 .post(path + '/makefriends')
116 .send(body) 116 .send(body)
@@ -130,7 +130,7 @@ describe('Test pods API validators', function () {
130 }) 130 })
131 131
132 describe('When quitting friends', function () { 132 describe('When quitting friends', function () {
133 it('Should fail with a invalid token', function (done) { 133 it('Should fail with an invalid token', function (done) {
134 request(server.url) 134 request(server.url)
135 .get(path + '/quitfriends') 135 .get(path + '/quitfriends')
136 .query({ start: 'hello' }) 136 .query({ start: 'hello' })
@@ -148,6 +148,50 @@ describe('Test pods API validators', function () {
148 .expect(403, done) 148 .expect(403, done)
149 }) 149 })
150 }) 150 })
151
152 describe('When removing one friend', function () {
153 it('Should fail with an invalid token', function (done) {
154 request(server.url)
155 .delete(path + '/1')
156 .set('Authorization', 'Bearer faketoken')
157 .set('Accept', 'application/json')
158 .expect(401, done)
159 })
160
161 it('Should fail if the user is not an administrator', function (done) {
162 request(server.url)
163 .delete(path + '/1')
164 .set('Authorization', 'Bearer ' + userAccessToken)
165 .set('Accept', 'application/json')
166 .expect(403, done)
167 })
168
169 it('Should fail with an undefined id', function (done) {
170 request(server.url)
171 .delete(path + '/' + undefined)
172 .set('Authorization', 'Bearer ' + server.accessToken)
173 .set('Accept', 'application/json')
174 .expect(400, done)
175 })
176
177 it('Should fail with an invalid id', function (done) {
178 request(server.url)
179 .delete(path + '/foobar')
180 .set('Authorization', 'Bearer ' + server.accessToken)
181 .set('Accept', 'application/json')
182 .expect(400, done)
183 })
184
185 it('Should fail if the pod is not a friend', function (done) {
186 request(server.url)
187 .delete(path + '/-1')
188 .set('Authorization', 'Bearer ' + server.accessToken)
189 .set('Accept', 'application/json')
190 .expect(404, done)
191 })
192
193 it('Should succeed with the correct parameters')
194 })
151 }) 195 })
152 196
153 describe('When adding a pod', function () { 197 describe('When adding a pod', function () {
@@ -181,7 +225,7 @@ describe('Test pods API validators', function () {
181 requestsUtils.makePostBodyRequest(server.url, path, null, data, done) 225 requestsUtils.makePostBodyRequest(server.url, path, null, data, done)
182 }) 226 })
183 227
184 it('Should fail without an host', function (done) { 228 it('Should fail without a host', function (done) {
185 const data = { 229 const data = {
186 email: 'testexample.com', 230 email: 'testexample.com',
187 publicKey: 'mysuperpublickey' 231 publicKey: 'mysuperpublickey'