]>
Commit | Line | Data |
---|---|---|
72329aaa C |
1 | /* eslint-disable no-unused-expressions */ |
2 | ||
efe923bc C |
3 | 'use strict' |
4 | ||
5 | const chai = require('chai') | |
6 | const expect = chai.expect | |
7 | const pathUtils = require('path') | |
8 | const request = require('supertest') | |
9 | const series = require('async/series') | |
10 | ||
11 | const loginUtils = require('../../utils/login') | |
12 | const requestsUtils = require('../../utils/requests') | |
13 | const serversUtils = require('../../utils/servers') | |
14 | const videosUtils = require('../../utils/videos') | |
15 | ||
16 | describe('Test videos API validator', function () { | |
17 | const path = '/api/v1/videos/' | |
18 | let server = null | |
19 | ||
20 | // --------------------------------------------------------------- | |
21 | ||
22 | before(function (done) { | |
23 | this.timeout(20000) | |
24 | ||
25 | series([ | |
26 | function (next) { | |
27 | serversUtils.flushTests(next) | |
28 | }, | |
29 | function (next) { | |
30 | serversUtils.runServer(1, function (server1) { | |
31 | server = server1 | |
32 | ||
33 | next() | |
34 | }) | |
35 | }, | |
36 | function (next) { | |
37 | loginUtils.loginAndGetAccessToken(server, function (err, token) { | |
38 | if (err) throw err | |
39 | server.accessToken = token | |
40 | ||
41 | next() | |
42 | }) | |
43 | } | |
44 | ], done) | |
45 | }) | |
46 | ||
47 | describe('When listing a video', function () { | |
48 | it('Should fail with a bad start pagination', function (done) { | |
49 | request(server.url) | |
50 | .get(path) | |
51 | .query({ start: 'hello' }) | |
52 | .set('Accept', 'application/json') | |
53 | .expect(400, done) | |
54 | }) | |
55 | ||
56 | it('Should fail with a bad count pagination', function (done) { | |
57 | request(server.url) | |
58 | .get(path) | |
59 | .query({ count: 'hello' }) | |
60 | .set('Accept', 'application/json') | |
61 | .expect(400, done) | |
62 | }) | |
63 | ||
64 | it('Should fail with an incorrect sort', function (done) { | |
65 | request(server.url) | |
66 | .get(path) | |
67 | .query({ sort: 'hello' }) | |
68 | .set('Accept', 'application/json') | |
69 | .expect(400, done) | |
70 | }) | |
71 | }) | |
72 | ||
73 | describe('When searching a video', function () { | |
74 | it('Should fail with nothing', function (done) { | |
75 | request(server.url) | |
76 | .get(pathUtils.join(path, 'search')) | |
77 | .set('Accept', 'application/json') | |
78 | .expect(400, done) | |
79 | }) | |
80 | ||
81 | it('Should fail with a bad start pagination', function (done) { | |
82 | request(server.url) | |
83 | .get(pathUtils.join(path, 'search', 'test')) | |
84 | .query({ start: 'hello' }) | |
85 | .set('Accept', 'application/json') | |
86 | .expect(400, done) | |
87 | }) | |
88 | ||
89 | it('Should fail with a bad count pagination', function (done) { | |
90 | request(server.url) | |
91 | .get(pathUtils.join(path, 'search', 'test')) | |
92 | .query({ count: 'hello' }) | |
93 | .set('Accept', 'application/json') | |
94 | .expect(400, done) | |
95 | }) | |
96 | ||
97 | it('Should fail with an incorrect sort', function (done) { | |
98 | request(server.url) | |
99 | .get(pathUtils.join(path, 'search', 'test')) | |
100 | .query({ sort: 'hello' }) | |
101 | .set('Accept', 'application/json') | |
102 | .expect(400, done) | |
103 | }) | |
104 | }) | |
105 | ||
106 | describe('When adding a video', function () { | |
107 | it('Should fail with nothing', function (done) { | |
108 | const data = {} | |
109 | const attach = {} | |
110 | requestsUtils.makePostUploadRequest(server.url, path, server.accessToken, data, attach, done) | |
111 | }) | |
112 | ||
113 | it('Should fail without name', function (done) { | |
114 | const data = { | |
6e07c3de | 115 | category: 5, |
6f0c39e2 | 116 | licence: 1, |
31b59b47 | 117 | nsfw: false, |
efe923bc C |
118 | description: 'my super description', |
119 | tags: [ 'tag1', 'tag2' ] | |
120 | } | |
121 | const attach = { | |
122 | 'videofile': pathUtils.join(__dirname, '..', 'fixtures', 'video_short.webm') | |
123 | } | |
124 | requestsUtils.makePostUploadRequest(server.url, path, server.accessToken, data, attach, done) | |
125 | }) | |
126 | ||
127 | it('Should fail with a long name', function (done) { | |
128 | const data = { | |
129 | name: 'My very very very very very very very very very very very very very very very very long name', | |
6e07c3de | 130 | category: 5, |
6f0c39e2 | 131 | licence: 1, |
31b59b47 | 132 | nsfw: false, |
6e07c3de C |
133 | description: 'my super description', |
134 | tags: [ 'tag1', 'tag2' ] | |
135 | } | |
136 | const attach = { | |
137 | 'videofile': pathUtils.join(__dirname, '..', 'fixtures', 'video_short.webm') | |
138 | } | |
139 | requestsUtils.makePostUploadRequest(server.url, path, server.accessToken, data, attach, done) | |
140 | }) | |
141 | ||
142 | it('Should fail without a category', function (done) { | |
143 | const data = { | |
144 | name: 'my super name', | |
6f0c39e2 | 145 | licence: 1, |
31b59b47 | 146 | nsfw: false, |
6e07c3de C |
147 | description: 'my super description', |
148 | tags: [ 'tag1', 'tag2' ] | |
149 | } | |
150 | const attach = { | |
151 | 'videofile': pathUtils.join(__dirname, '..', 'fixtures', 'video_short.webm') | |
152 | } | |
153 | requestsUtils.makePostUploadRequest(server.url, path, server.accessToken, data, attach, done) | |
154 | }) | |
155 | ||
156 | it('Should fail with a bad category', function (done) { | |
157 | const data = { | |
158 | name: 'my super name', | |
159 | category: 125, | |
6f0c39e2 | 160 | licence: 1, |
31b59b47 | 161 | nsfw: false, |
6f0c39e2 C |
162 | description: 'my super description', |
163 | tags: [ 'tag1', 'tag2' ] | |
164 | } | |
165 | const attach = { | |
166 | 'videofile': pathUtils.join(__dirname, '..', 'fixtures', 'video_short.webm') | |
167 | } | |
168 | requestsUtils.makePostUploadRequest(server.url, path, server.accessToken, data, attach, done) | |
169 | }) | |
170 | ||
171 | it('Should fail without a licence', function (done) { | |
172 | const data = { | |
173 | name: 'my super name', | |
174 | category: 5, | |
31b59b47 | 175 | nsfw: false, |
6f0c39e2 C |
176 | description: 'my super description', |
177 | tags: [ 'tag1', 'tag2' ] | |
178 | } | |
179 | const attach = { | |
180 | 'videofile': pathUtils.join(__dirname, '..', 'fixtures', 'video_short.webm') | |
181 | } | |
182 | requestsUtils.makePostUploadRequest(server.url, path, server.accessToken, data, attach, done) | |
183 | }) | |
184 | ||
185 | it('Should fail with a bad licence', function (done) { | |
186 | const data = { | |
187 | name: 'my super name', | |
188 | category: 5, | |
189 | licence: 125, | |
31b59b47 C |
190 | nsfw: false, |
191 | description: 'my super description', | |
192 | tags: [ 'tag1', 'tag2' ] | |
193 | } | |
194 | const attach = { | |
195 | 'videofile': pathUtils.join(__dirname, '..', 'fixtures', 'video_short.webm') | |
196 | } | |
197 | requestsUtils.makePostUploadRequest(server.url, path, server.accessToken, data, attach, done) | |
198 | }) | |
199 | ||
200 | it('Should fail without nsfw attribute', function (done) { | |
201 | const data = { | |
202 | name: 'my super name', | |
203 | category: 5, | |
204 | licence: 4, | |
205 | description: 'my super description', | |
206 | tags: [ 'tag1', 'tag2' ] | |
207 | } | |
208 | const attach = { | |
209 | 'videofile': pathUtils.join(__dirname, '..', 'fixtures', 'video_short.webm') | |
210 | } | |
211 | requestsUtils.makePostUploadRequest(server.url, path, server.accessToken, data, attach, done) | |
212 | }) | |
213 | ||
214 | it('Should fail with a bad nsfw attribue', function (done) { | |
215 | const data = { | |
216 | name: 'my super name', | |
217 | category: 5, | |
218 | licence: 4, | |
219 | nsfw: 2, | |
efe923bc C |
220 | description: 'my super description', |
221 | tags: [ 'tag1', 'tag2' ] | |
222 | } | |
223 | const attach = { | |
224 | 'videofile': pathUtils.join(__dirname, '..', 'fixtures', 'video_short.webm') | |
225 | } | |
226 | requestsUtils.makePostUploadRequest(server.url, path, server.accessToken, data, attach, done) | |
227 | }) | |
228 | ||
229 | it('Should fail without description', function (done) { | |
230 | const data = { | |
231 | name: 'my super name', | |
6e07c3de | 232 | category: 5, |
6f0c39e2 | 233 | licence: 1, |
31b59b47 | 234 | nsfw: false, |
efe923bc C |
235 | tags: [ 'tag1', 'tag2' ] |
236 | } | |
237 | const attach = { | |
238 | 'videofile': pathUtils.join(__dirname, '..', 'fixtures', 'video_short.webm') | |
239 | } | |
240 | requestsUtils.makePostUploadRequest(server.url, path, server.accessToken, data, attach, done) | |
241 | }) | |
242 | ||
243 | it('Should fail with a long description', function (done) { | |
244 | const data = { | |
245 | name: 'my super name', | |
6e07c3de | 246 | category: 5, |
6f0c39e2 | 247 | licence: 1, |
31b59b47 | 248 | nsfw: false, |
efe923bc C |
249 | description: 'my super description which is very very very very very very very very very very very very very very' + |
250 | 'very very very very very very very very very very very very very very very very very very very very very' + | |
251 | 'very very very very very very very very very very very very very very very long', | |
252 | tags: [ 'tag1', 'tag2' ] | |
253 | } | |
254 | const attach = { | |
255 | 'videofile': pathUtils.join(__dirname, '..', 'fixtures', 'video_short.webm') | |
256 | } | |
257 | requestsUtils.makePostUploadRequest(server.url, path, server.accessToken, data, attach, done) | |
258 | }) | |
259 | ||
efe923bc C |
260 | it('Should fail with too many tags', function (done) { |
261 | const data = { | |
262 | name: 'my super name', | |
6e07c3de | 263 | category: 5, |
6f0c39e2 | 264 | licence: 1, |
31b59b47 | 265 | nsfw: false, |
efe923bc C |
266 | description: 'my super description', |
267 | tags: [ 'tag1', 'tag2', 'tag3', 'tag4' ] | |
268 | } | |
269 | const attach = { | |
270 | 'videofile': pathUtils.join(__dirname, '..', 'fixtures', 'video_short.webm') | |
271 | } | |
272 | requestsUtils.makePostUploadRequest(server.url, path, server.accessToken, data, attach, done) | |
273 | }) | |
274 | ||
efe923bc C |
275 | it('Should fail with a tag length too low', function (done) { |
276 | const data = { | |
277 | name: 'my super name', | |
6e07c3de | 278 | category: 5, |
6f0c39e2 | 279 | licence: 1, |
31b59b47 | 280 | nsfw: false, |
efe923bc C |
281 | description: 'my super description', |
282 | tags: [ 'tag1', 't' ] | |
283 | } | |
284 | const attach = { | |
285 | 'videofile': pathUtils.join(__dirname, '..', 'fixtures', 'video_short.webm') | |
286 | } | |
287 | requestsUtils.makePostUploadRequest(server.url, path, server.accessToken, data, attach, done) | |
288 | }) | |
289 | ||
290 | it('Should fail with a tag length too big', function (done) { | |
291 | const data = { | |
292 | name: 'my super name', | |
6e07c3de | 293 | category: 5, |
6f0c39e2 | 294 | licence: 1, |
31b59b47 | 295 | nsfw: false, |
efe923bc C |
296 | description: 'my super description', |
297 | tags: [ 'mysupertagtoolong', 'tag1' ] | |
298 | } | |
299 | const attach = { | |
300 | 'videofile': pathUtils.join(__dirname, '..', 'fixtures', 'video_short.webm') | |
301 | } | |
302 | requestsUtils.makePostUploadRequest(server.url, path, server.accessToken, data, attach, done) | |
303 | }) | |
304 | ||
efe923bc C |
305 | it('Should fail without an input file', function (done) { |
306 | const data = { | |
307 | name: 'my super name', | |
6e07c3de | 308 | category: 5, |
6f0c39e2 | 309 | licence: 1, |
31b59b47 | 310 | nsfw: false, |
efe923bc C |
311 | description: 'my super description', |
312 | tags: [ 'tag1', 'tag2' ] | |
313 | } | |
314 | const attach = {} | |
315 | requestsUtils.makePostUploadRequest(server.url, path, server.accessToken, data, attach, done) | |
316 | }) | |
317 | ||
318 | it('Should fail without an incorrect input file', function (done) { | |
319 | const data = { | |
320 | name: 'my super name', | |
6e07c3de | 321 | category: 5, |
6f0c39e2 | 322 | licence: 1, |
31b59b47 | 323 | nsfw: false, |
efe923bc C |
324 | description: 'my super description', |
325 | tags: [ 'tag1', 'tag2' ] | |
326 | } | |
327 | const attach = { | |
328 | 'videofile': pathUtils.join(__dirname, '..', 'fixtures', 'video_short_fake.webm') | |
329 | } | |
330 | requestsUtils.makePostUploadRequest(server.url, path, server.accessToken, data, attach, done) | |
331 | }) | |
332 | ||
333 | it('Should fail with a too big duration', function (done) { | |
334 | const data = { | |
335 | name: 'my super name', | |
6e07c3de | 336 | category: 5, |
6f0c39e2 | 337 | licence: 1, |
31b59b47 | 338 | nsfw: false, |
efe923bc C |
339 | description: 'my super description', |
340 | tags: [ 'tag1', 'tag2' ] | |
341 | } | |
342 | const attach = { | |
343 | 'videofile': pathUtils.join(__dirname, '..', 'fixtures', 'video_too_long.webm') | |
344 | } | |
345 | requestsUtils.makePostUploadRequest(server.url, path, server.accessToken, data, attach, done) | |
346 | }) | |
347 | ||
348 | it('Should succeed with the correct parameters', function (done) { | |
349 | const data = { | |
350 | name: 'my super name', | |
6e07c3de | 351 | category: 5, |
6f0c39e2 | 352 | licence: 1, |
31b59b47 | 353 | nsfw: false, |
efe923bc C |
354 | description: 'my super description', |
355 | tags: [ 'tag1', 'tag2' ] | |
356 | } | |
357 | const attach = { | |
358 | 'videofile': pathUtils.join(__dirname, '..', 'fixtures', 'video_short.webm') | |
359 | } | |
360 | requestsUtils.makePostUploadRequest(server.url, path, server.accessToken, data, attach, function () { | |
361 | attach.videofile = pathUtils.join(__dirname, '..', 'fixtures', 'video_short.mp4') | |
362 | requestsUtils.makePostUploadRequest(server.url, path, server.accessToken, data, attach, function () { | |
363 | attach.videofile = pathUtils.join(__dirname, '..', 'fixtures', 'video_short.ogv') | |
364 | requestsUtils.makePostUploadRequest(server.url, path, server.accessToken, data, attach, done, 204) | |
365 | }, false) | |
366 | }, false) | |
367 | }) | |
368 | }) | |
369 | ||
370 | describe('When updating a video', function () { | |
371 | let videoId | |
372 | ||
373 | before(function (done) { | |
374 | videosUtils.getVideosList(server.url, function (err, res) { | |
375 | if (err) throw err | |
376 | ||
377 | videoId = res.body.data[0].id | |
378 | ||
379 | return done() | |
380 | }) | |
381 | }) | |
382 | ||
383 | it('Should fail with nothing', function (done) { | |
384 | const data = {} | |
385 | requestsUtils.makePutBodyRequest(server.url, path, server.accessToken, data, done) | |
386 | }) | |
387 | ||
388 | it('Should fail without a valid uuid', function (done) { | |
389 | const data = { | |
6e07c3de | 390 | category: 5, |
6f0c39e2 | 391 | licence: 2, |
31b59b47 | 392 | nsfw: false, |
efe923bc C |
393 | description: 'my super description', |
394 | tags: [ 'tag1', 'tag2' ] | |
395 | } | |
396 | requestsUtils.makePutBodyRequest(server.url, path + 'blabla', server.accessToken, data, done) | |
397 | }) | |
398 | ||
399 | it('Should fail with an unknown id', function (done) { | |
400 | const data = { | |
6e07c3de | 401 | category: 5, |
6f0c39e2 | 402 | licence: 2, |
31b59b47 | 403 | nsfw: false, |
efe923bc C |
404 | description: 'my super description', |
405 | tags: [ 'tag1', 'tag2' ] | |
406 | } | |
407 | requestsUtils.makePutBodyRequest(server.url, path + '4da6fde3-88f7-4d16-b119-108df5630b06', server.accessToken, data, done, 404) | |
408 | }) | |
409 | ||
410 | it('Should fail with a long name', function (done) { | |
411 | const data = { | |
412 | name: 'My very very very very very very very very very very very very very very very very long name', | |
6e07c3de | 413 | category: 5, |
6f0c39e2 | 414 | licence: 2, |
31b59b47 | 415 | nsfw: false, |
6e07c3de C |
416 | description: 'my super description', |
417 | tags: [ 'tag1', 'tag2' ] | |
418 | } | |
419 | requestsUtils.makePutBodyRequest(server.url, path + videoId, server.accessToken, data, done) | |
420 | }) | |
421 | ||
422 | it('Should fail with a bad category', function (done) { | |
423 | const data = { | |
424 | name: 'my super name', | |
425 | category: 128, | |
6f0c39e2 | 426 | licence: 2, |
31b59b47 | 427 | nsfw: false, |
6f0c39e2 C |
428 | description: 'my super description', |
429 | tags: [ 'tag1', 'tag2' ] | |
430 | } | |
431 | requestsUtils.makePutBodyRequest(server.url, path + videoId, server.accessToken, data, done) | |
432 | }) | |
433 | ||
434 | it('Should fail with a bad licence', function (done) { | |
435 | const data = { | |
436 | name: 'my super name', | |
437 | category: 5, | |
438 | licence: 128, | |
31b59b47 C |
439 | nsfw: false, |
440 | description: 'my super description', | |
441 | tags: [ 'tag1', 'tag2' ] | |
442 | } | |
443 | requestsUtils.makePutBodyRequest(server.url, path + videoId, server.accessToken, data, done) | |
444 | }) | |
445 | ||
446 | it('Should fail with a bad nsfw attribute', function (done) { | |
447 | const data = { | |
448 | name: 'my super name', | |
449 | category: 5, | |
450 | licence: 5, | |
451 | nsfw: -4, | |
efe923bc C |
452 | description: 'my super description', |
453 | tags: [ 'tag1', 'tag2' ] | |
454 | } | |
455 | requestsUtils.makePutBodyRequest(server.url, path + videoId, server.accessToken, data, done) | |
456 | }) | |
457 | ||
458 | it('Should fail with a long description', function (done) { | |
459 | const data = { | |
460 | name: 'my super name', | |
6e07c3de | 461 | category: 5, |
6f0c39e2 | 462 | licence: 2, |
31b59b47 | 463 | nsfw: false, |
efe923bc C |
464 | description: 'my super description which is very very very very very very very very very very very very very very' + |
465 | 'very very very very very very very very very very very very very very very very very very very very very' + | |
466 | 'very very very very very very very very very very very very very very very long', | |
467 | tags: [ 'tag1', 'tag2' ] | |
468 | } | |
469 | requestsUtils.makePutBodyRequest(server.url, path + videoId, server.accessToken, data, done) | |
470 | }) | |
471 | ||
472 | it('Should fail with too many tags', function (done) { | |
473 | const data = { | |
474 | name: 'my super name', | |
6e07c3de | 475 | category: 5, |
6f0c39e2 | 476 | licence: 2, |
31b59b47 | 477 | nsfw: false, |
efe923bc C |
478 | description: 'my super description', |
479 | tags: [ 'tag1', 'tag2', 'tag3', 'tag4' ] | |
480 | } | |
481 | requestsUtils.makePutBodyRequest(server.url, path + videoId, server.accessToken, data, done) | |
482 | }) | |
483 | ||
efe923bc C |
484 | it('Should fail with a tag length too low', function (done) { |
485 | const data = { | |
486 | name: 'my super name', | |
6e07c3de | 487 | category: 5, |
6f0c39e2 | 488 | licence: 2, |
31b59b47 | 489 | nsfw: false, |
efe923bc C |
490 | description: 'my super description', |
491 | tags: [ 'tag1', 't' ] | |
492 | } | |
493 | requestsUtils.makePutBodyRequest(server.url, path + videoId, server.accessToken, data, done) | |
494 | }) | |
495 | ||
496 | it('Should fail with a tag length too big', function (done) { | |
497 | const data = { | |
498 | name: 'my super name', | |
6e07c3de | 499 | category: 5, |
6f0c39e2 | 500 | licence: 2, |
31b59b47 | 501 | nsfw: false, |
efe923bc C |
502 | description: 'my super description', |
503 | tags: [ 'mysupertagtoolong', 'tag1' ] | |
504 | } | |
505 | requestsUtils.makePutBodyRequest(server.url, path + videoId, server.accessToken, data, done) | |
506 | }) | |
507 | ||
45abb8b9 C |
508 | it('Should fail with a video of another user') |
509 | ||
510 | it('Should fail with a video of another pod') | |
efe923bc C |
511 | }) |
512 | ||
513 | describe('When getting a video', function () { | |
514 | it('Should return the list of the videos with nothing', function (done) { | |
515 | request(server.url) | |
516 | .get(path) | |
517 | .set('Accept', 'application/json') | |
518 | .expect(200) | |
519 | .expect('Content-Type', /json/) | |
520 | .end(function (err, res) { | |
521 | if (err) throw err | |
522 | ||
523 | expect(res.body.data).to.be.an('array') | |
524 | expect(res.body.data.length).to.equal(3) | |
525 | ||
526 | done() | |
527 | }) | |
528 | }) | |
529 | ||
530 | it('Should fail without a correct uuid', function (done) { | |
531 | request(server.url) | |
532 | .get(path + 'coucou') | |
533 | .set('Accept', 'application/json') | |
534 | .expect(400, done) | |
535 | }) | |
536 | ||
537 | it('Should return 404 with an incorrect video', function (done) { | |
538 | request(server.url) | |
539 | .get(path + '4da6fde3-88f7-4d16-b119-108df5630b06') | |
540 | .set('Accept', 'application/json') | |
541 | .expect(404, done) | |
542 | }) | |
543 | ||
544 | it('Should succeed with the correct parameters') | |
545 | }) | |
546 | ||
d38b8281 C |
547 | describe('When rating a video', function () { |
548 | let videoId | |
549 | ||
550 | before(function (done) { | |
551 | videosUtils.getVideosList(server.url, function (err, res) { | |
552 | if (err) throw err | |
553 | ||
554 | videoId = res.body.data[0].id | |
555 | ||
556 | return done() | |
557 | }) | |
558 | }) | |
559 | ||
560 | it('Should fail without a valid uuid', function (done) { | |
561 | const data = { | |
562 | rating: 'like' | |
563 | } | |
564 | requestsUtils.makePutBodyRequest(server.url, path + 'blabla/rate', server.accessToken, data, done) | |
565 | }) | |
566 | ||
567 | it('Should fail with an unknown id', function (done) { | |
568 | const data = { | |
569 | rating: 'like' | |
570 | } | |
571 | requestsUtils.makePutBodyRequest(server.url, path + '4da6fde3-88f7-4d16-b119-108df5630b06/rate', server.accessToken, data, done, 404) | |
572 | }) | |
573 | ||
574 | it('Should fail with a wrong rating', function (done) { | |
575 | const data = { | |
576 | rating: 'likes' | |
577 | } | |
578 | requestsUtils.makePutBodyRequest(server.url, path + videoId + '/rate', server.accessToken, data, done) | |
579 | }) | |
580 | ||
581 | it('Should succeed with the correct parameters', function (done) { | |
582 | const data = { | |
583 | rating: 'like' | |
584 | } | |
585 | requestsUtils.makePutBodyRequest(server.url, path + videoId + '/rate', server.accessToken, data, done, 204) | |
586 | }) | |
587 | }) | |
588 | ||
efe923bc C |
589 | describe('When removing a video', function () { |
590 | it('Should have 404 with nothing', function (done) { | |
591 | request(server.url) | |
592 | .delete(path) | |
593 | .set('Authorization', 'Bearer ' + server.accessToken) | |
594 | .expect(400, done) | |
595 | }) | |
596 | ||
597 | it('Should fail without a correct uuid', function (done) { | |
598 | request(server.url) | |
599 | .delete(path + 'hello') | |
600 | .set('Authorization', 'Bearer ' + server.accessToken) | |
601 | .expect(400, done) | |
602 | }) | |
603 | ||
604 | it('Should fail with a video which does not exist', function (done) { | |
605 | request(server.url) | |
606 | .delete(path + '4da6fde3-88f7-4d16-b119-108df5630b06') | |
607 | .set('Authorization', 'Bearer ' + server.accessToken) | |
608 | .expect(404, done) | |
609 | }) | |
610 | ||
611 | it('Should fail with a video of another user') | |
612 | ||
613 | it('Should fail with a video of another pod') | |
614 | ||
615 | it('Should succeed with the correct parameters') | |
616 | }) | |
617 | ||
618 | after(function (done) { | |
619 | process.kill(-server.app.pid) | |
620 | ||
621 | // Keep the logs if the test failed | |
622 | if (this.ok) { | |
623 | serversUtils.flushTests(done) | |
624 | } else { | |
625 | done() | |
626 | } | |
627 | }) | |
628 | }) |