]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - server/tests/api/check-params/videos.ts
Add video privacy setting
[github/Chocobozzz/PeerTube.git] / server / tests / api / check-params / videos.ts
CommitLineData
0e1dc3e7
C
1/* tslint:disable:no-unused-expression */
2
3import * as request from 'supertest'
4import { join } from 'path'
5import 'mocha'
6import * as chai from 'chai'
7const expect = chai.expect
8
9import {
10 ServerInfo,
11 flushTests,
12 runServer,
13 getVideosList,
14 makePutBodyRequest,
15 setAccessTokensToServers,
16 killallServers,
5f04dd2f
C
17 makePostUploadRequest,
18 getMyUserInformation,
19 createUser,
20 getUserAccessToken
0e1dc3e7
C
21} from '../../utils'
22
23describe('Test videos API validator', function () {
24 const path = '/api/v1/videos/'
25 let server: ServerInfo
5f04dd2f 26 let channelId: number
0e1dc3e7
C
27
28 // ---------------------------------------------------------------
29
30 before(async function () {
31 this.timeout(20000)
32
33 await flushTests()
34
35 server = await runServer(1)
36
37 await setAccessTokensToServers([ server ])
5f04dd2f
C
38
39 const res = await getMyUserInformation(server.url, server.accessToken)
40 channelId = res.body.videoChannels[0].id
0e1dc3e7
C
41 })
42
43 describe('When listing a video', function () {
44 it('Should fail with a bad start pagination', async function () {
45 await request(server.url)
46 .get(path)
47 .query({ start: 'hello' })
48 .set('Accept', 'application/json')
49 .expect(400)
50 })
51
52 it('Should fail with a bad count pagination', async function () {
53 await request(server.url)
54 .get(path)
55 .query({ count: 'hello' })
56 .set('Accept', 'application/json')
57 .expect(400)
58 })
59
60 it('Should fail with an incorrect sort', async function () {
61 await request(server.url)
62 .get(path)
63 .query({ sort: 'hello' })
64 .set('Accept', 'application/json')
65 .expect(400)
66 })
67 })
68
69 describe('When searching a video', function () {
70 it('Should fail with nothing', async function () {
71 await request(server.url)
72 .get(join(path, 'search'))
73 .set('Accept', 'application/json')
74 .expect(400)
75 })
76
77 it('Should fail with a bad start pagination', async function () {
78 await request(server.url)
79 .get(join(path, 'search', 'test'))
80 .query({ start: 'hello' })
81 .set('Accept', 'application/json')
82 .expect(400)
83 })
84
85 it('Should fail with a bad count pagination', async function () {
86 await request(server.url)
87 .get(join(path, 'search', 'test'))
88 .query({ count: 'hello' })
89 .set('Accept', 'application/json')
90 .expect(400)
91 })
92
93 it('Should fail with an incorrect sort', async function () {
94 await request(server.url)
95 .get(join(path, 'search', 'test'))
96 .query({ sort: 'hello' })
97 .set('Accept', 'application/json')
98 .expect(400)
99 })
100 })
101
102 describe('When adding a video', function () {
103 it('Should fail with nothing', async function () {
104 const fields = {}
105 const attaches = {}
e95561cd 106 await makePostUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })
0e1dc3e7
C
107 })
108
109 it('Should fail without name', async function () {
110 const fields = {
111 category: 5,
112 licence: 1,
113 language: 6,
114 nsfw: false,
115 description: 'my super description',
5f04dd2f
C
116 tags: [ 'tag1', 'tag2' ],
117 channelId
0e1dc3e7
C
118 }
119 const attaches = {
120 'videofile': join(__dirname, '..', 'fixtures', 'video_short.webm')
121 }
e95561cd 122 await makePostUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })
0e1dc3e7
C
123 })
124
125 it('Should fail with a long name', async function () {
126 const fields = {
a265f7f3
C
127 name: 'My very very very very very very very very very very very very very very very very very ' +
128 'very very very very very very very very very very very very very very very very long long' +
129 'very very very very very very very very very very very very very very very very long name',
0e1dc3e7
C
130 category: 5,
131 licence: 1,
132 language: 6,
133 nsfw: false,
134 description: 'my super description',
5f04dd2f
C
135 tags: [ 'tag1', 'tag2' ],
136 channelId
0e1dc3e7
C
137 }
138 const attaches = {
139 'videofile': join(__dirname, '..', 'fixtures', 'video_short.webm')
140 }
e95561cd 141 await makePostUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })
0e1dc3e7
C
142 })
143
144 it('Should fail without a category', async function () {
145 const fields = {
146 name: 'my super name',
147 licence: 1,
148 language: 6,
149 nsfw: false,
150 description: 'my super description',
5f04dd2f
C
151 tags: [ 'tag1', 'tag2' ],
152 channelId
0e1dc3e7
C
153 }
154 const attaches = {
155 'videofile': join(__dirname, '..', 'fixtures', 'video_short.webm')
156 }
e95561cd 157 await makePostUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })
0e1dc3e7
C
158 })
159
160 it('Should fail with a bad category', async function () {
161 const fields = {
162 name: 'my super name',
163 category: 125,
164 licence: 1,
165 language: 6,
166 nsfw: false,
167 description: 'my super description',
5f04dd2f
C
168 tags: [ 'tag1', 'tag2' ],
169 channelId
0e1dc3e7
C
170 }
171 const attaches = {
172 'videofile': join(__dirname, '..', 'fixtures', 'video_short.webm')
173 }
e95561cd 174 await makePostUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })
0e1dc3e7
C
175 })
176
177 it('Should fail without a licence', async function () {
178 const fields = {
179 name: 'my super name',
180 category: 5,
181 language: 6,
182 nsfw: false,
183 description: 'my super description',
5f04dd2f
C
184 tags: [ 'tag1', 'tag2' ],
185 channelId
0e1dc3e7
C
186 }
187 const attaches = {
188 'videofile': join(__dirname, '..', 'fixtures', 'video_short.webm')
189 }
e95561cd 190 await makePostUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })
0e1dc3e7
C
191 })
192
193 it('Should fail with a bad licence', async function () {
194 const fields = {
195 name: 'my super name',
196 category: 5,
197 licence: 125,
198 language: 6,
199 nsfw: false,
200 description: 'my super description',
5f04dd2f
C
201 tags: [ 'tag1', 'tag2' ],
202 channelId
0e1dc3e7
C
203 }
204 const attaches = {
205 'videofile': join(__dirname, '..', 'fixtures', 'video_short.webm')
206 }
e95561cd 207 await makePostUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })
0e1dc3e7
C
208 })
209
210 it('Should fail with a bad language', async function () {
211 const fields = {
212 name: 'my super name',
213 category: 5,
214 licence: 4,
215 language: 563,
216 nsfw: false,
217 description: 'my super description',
5f04dd2f
C
218 tags: [ 'tag1', 'tag2' ],
219 channelId
0e1dc3e7
C
220 }
221 const attaches = {
222 'videofile': join(__dirname, '..', 'fixtures', 'video_short.webm')
223 }
e95561cd 224 await makePostUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })
0e1dc3e7
C
225 })
226
227 it('Should fail without nsfw attribute', async function () {
228 const fields = {
229 name: 'my super name',
230 category: 5,
231 licence: 4,
232 language: 6,
233 description: 'my super description',
5f04dd2f
C
234 tags: [ 'tag1', 'tag2' ],
235 channelId
0e1dc3e7
C
236 }
237 const attaches = {
238 'videofile': join(__dirname, '..', 'fixtures', 'video_short.webm')
239 }
e95561cd 240 await makePostUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })
0e1dc3e7
C
241 })
242
5f04dd2f 243 it('Should fail with a bad nsfw attribute', async function () {
0e1dc3e7
C
244 const fields = {
245 name: 'my super name',
246 category: 5,
247 licence: 4,
248 language: 6,
249 nsfw: 2,
250 description: 'my super description',
5f04dd2f
C
251 tags: [ 'tag1', 'tag2' ],
252 channelId
0e1dc3e7
C
253 }
254 const attaches = {
255 'videofile': join(__dirname, '..', 'fixtures', 'video_short.webm')
256 }
e95561cd 257 await makePostUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })
0e1dc3e7
C
258 })
259
260 it('Should fail without description', async function () {
261 const fields = {
262 name: 'my super name',
263 category: 5,
264 licence: 1,
265 language: 6,
266 nsfw: false,
5f04dd2f
C
267 tags: [ 'tag1', 'tag2' ],
268 channelId
0e1dc3e7
C
269 }
270 const attaches = {
271 'videofile': join(__dirname, '..', 'fixtures', 'video_short.webm')
272 }
e95561cd 273 await makePostUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })
0e1dc3e7
C
274 })
275
276 it('Should fail with a long description', async function () {
277 const fields = {
278 name: 'my super name',
279 category: 5,
280 licence: 1,
281 language: 6,
282 nsfw: false,
2de96f4d 283 description: 'my super description which is very very very very very very very very very very very very very very long'.repeat(35),
5f04dd2f
C
284 tags: [ 'tag1', 'tag2' ],
285 channelId
286 }
287 const attaches = {
288 'videofile': join(__dirname, '..', 'fixtures', 'video_short.webm')
289 }
290 await makePostUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })
291 })
292
293 it('Should fail without a channel', async function () {
294 const fields = {
295 name: 'my super name',
296 category: 5,
297 licence: 1,
298 language: 6,
299 nsfw: false,
300 description: 'my super description',
0e1dc3e7
C
301 tags: [ 'tag1', 'tag2' ]
302 }
303 const attaches = {
304 'videofile': join(__dirname, '..', 'fixtures', 'video_short.webm')
305 }
e95561cd 306 await makePostUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })
0e1dc3e7
C
307 })
308
5f04dd2f
C
309 it('Should fail with a bad channel', async function () {
310 const fields = {
311 name: 'my super name',
312 category: 5,
313 licence: 1,
314 language: 6,
315 nsfw: false,
316 description: 'my super description',
317 tags: [ 'tag1', 'tag2' ],
318 channelId: 545454
319 }
320 const attaches = {
321 'videofile': join(__dirname, '..', 'fixtures', 'video_short.webm')
322 }
323 await makePostUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })
324 })
325
326 it('Should fail with another user channel', async function () {
327 const user = {
328 username: 'fake',
329 password: 'fake_password'
330 }
331 await createUser(server.url, server.accessToken, user.username, user.password)
332
333 const accessTokenUser = await getUserAccessToken(server, user)
334 const res = await getMyUserInformation(server.url, accessTokenUser)
335 const channelId = res.body.videoChannels[0].id
336
337 const fields = {
338 name: 'my super name',
339 category: 5,
340 licence: 1,
341 language: 6,
342 nsfw: false,
343 description: 'my super description',
344 tags: [ 'tag1', 'tag2' ],
345 channelId
346 }
347 const attaches = {
348 'videofile': join(__dirname, '..', 'fixtures', 'video_short.webm')
349 }
350 await makePostUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })
351 })
352
0e1dc3e7
C
353 it('Should fail with too many tags', async function () {
354 const fields = {
355 name: 'my super name',
356 category: 5,
357 licence: 1,
358 language: 6,
359 nsfw: false,
360 description: 'my super description',
a265f7f3 361 tags: [ 'tag1', 'tag2', 'tag3', 'tag4', 'tag5', 'tag6' ],
5f04dd2f 362 channelId
0e1dc3e7
C
363 }
364 const attaches = {
365 'videofile': join(__dirname, '..', 'fixtures', 'video_short.webm')
366 }
e95561cd 367 await makePostUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })
0e1dc3e7
C
368 })
369
370 it('Should fail with a tag length too low', async function () {
371 const fields = {
372 name: 'my super name',
373 category: 5,
374 licence: 1,
375 language: 6,
376 nsfw: false,
377 description: 'my super description',
5f04dd2f
C
378 tags: [ 'tag1', 't' ],
379 channelId
0e1dc3e7
C
380 }
381 const attaches = {
382 'videofile': join(__dirname, '..', 'fixtures', 'video_short.webm')
383 }
e95561cd 384 await makePostUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })
0e1dc3e7
C
385 })
386
387 it('Should fail with a tag length too big', async function () {
388 const fields = {
389 name: 'my super name',
390 category: 5,
391 licence: 1,
392 language: 6,
393 nsfw: false,
394 description: 'my super description',
a265f7f3 395 tags: [ 'my_super_tag_too_long_long_long_long_long_long', 'tag1' ],
5f04dd2f 396 channelId
0e1dc3e7
C
397 }
398 const attaches = {
399 'videofile': join(__dirname, '..', 'fixtures', 'video_short.webm')
400 }
e95561cd 401 await makePostUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })
0e1dc3e7
C
402 })
403
404 it('Should fail without an input file', async function () {
405 const fields = {
406 name: 'my super name',
407 category: 5,
408 licence: 1,
409 language: 6,
410 nsfw: false,
411 description: 'my super description',
5f04dd2f
C
412 tags: [ 'tag1', 'tag2' ],
413 channelId
0e1dc3e7
C
414 }
415 const attaches = {}
e95561cd 416 await makePostUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })
0e1dc3e7
C
417 })
418
419 it('Should fail without an incorrect input file', async function () {
420 const fields = {
421 name: 'my super name',
422 category: 5,
423 licence: 1,
424 language: 6,
425 nsfw: false,
426 description: 'my super description',
5f04dd2f
C
427 tags: [ 'tag1', 'tag2' ],
428 channelId
0e1dc3e7
C
429 }
430 const attaches = {
431 'videofile': join(__dirname, '..', 'fixtures', 'video_short_fake.webm')
432 }
e95561cd 433 await makePostUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })
0e1dc3e7
C
434 })
435
436 it('Should fail with a too big duration', async function () {
437 const fields = {
438 name: 'my super name',
439 category: 5,
440 licence: 1,
441 language: 6,
442 nsfw: false,
443 description: 'my super description',
5f04dd2f
C
444 tags: [ 'tag1', 'tag2' ],
445 channelId
0e1dc3e7
C
446 }
447 const attaches = {
448 'videofile': join(__dirname, '..', 'fixtures', 'video_too_long.webm')
449 }
e95561cd 450 await makePostUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches })
0e1dc3e7
C
451 })
452
453 it('Should succeed with the correct parameters', async function () {
454 this.timeout(10000)
455
456 const fields = {
457 name: 'my super name',
458 category: 5,
459 licence: 1,
460 language: 6,
461 nsfw: false,
462 description: 'my super description',
5f04dd2f
C
463 tags: [ 'tag1', 'tag2' ],
464 channelId
0e1dc3e7
C
465 }
466 const attaches = {
467 'videofile': join(__dirname, '..', 'fixtures', 'video_short.webm')
468 }
469
e95561cd
C
470 await makePostUploadRequest({
471 url: server.url,
472 path: path + '/upload',
473 token: server.accessToken,
474 fields,
475 attaches,
476 statusCodeExpected: 204
477 })
0e1dc3e7
C
478
479 attaches.videofile = join(__dirname, '..', 'fixtures', 'video_short.mp4')
e95561cd
C
480 await makePostUploadRequest({
481 url: server.url,
482 path: path + '/upload',
483 token: server.accessToken,
484 fields,
485 attaches,
486 statusCodeExpected: 204
487 })
0e1dc3e7
C
488
489 attaches.videofile = join(__dirname, '..', 'fixtures', 'video_short.ogv')
e95561cd
C
490 await makePostUploadRequest({
491 url: server.url,
492 path: path + '/upload',
493 token: server.accessToken,
494 fields,
495 attaches,
496 statusCodeExpected: 204
497 })
0e1dc3e7
C
498 })
499 })
500
501 describe('When updating a video', function () {
502 let videoId
503
504 before(async function () {
505 const res = await getVideosList(server.url)
506 videoId = res.body.data[0].id
507 })
508
509 it('Should fail with nothing', async function () {
510 const fields = {}
511 await makePutBodyRequest({ url: server.url, path, token: server.accessToken, fields })
512 })
513
514 it('Should fail without a valid uuid', async function () {
515 const fields = {
516 category: 5,
517 licence: 2,
518 language: 6,
519 nsfw: false,
520 description: 'my super description',
521 tags: [ 'tag1', 'tag2' ]
522 }
523 await makePutBodyRequest({ url: server.url, path: path + 'blabla', token: server.accessToken, fields })
524 })
525
526 it('Should fail with an unknown id', async function () {
527 const fields = {
528 category: 5,
529 licence: 2,
530 language: 6,
531 nsfw: false,
532 description: 'my super description',
533 tags: [ 'tag1', 'tag2' ]
534 }
535 await makePutBodyRequest({
536 url: server.url,
537 path: path + '4da6fde3-88f7-4d16-b119-108df5630b06',
538 token: server.accessToken,
539 fields,
540 statusCodeExpected: 404
541 })
542 })
543
544 it('Should fail with a long name', async function () {
545 const fields = {
a265f7f3
C
546 name: 'My very very very very very very very very very very very very very very very very very ' +
547 'very very very very very very very very very very very very very very very very long long' +
548 'very very very very very very very very very very very very very very very very long name',
0e1dc3e7
C
549 category: 5,
550 licence: 2,
551 language: 6,
552 nsfw: false,
553 description: 'my super description',
554 tags: [ 'tag1', 'tag2' ]
555 }
556 await makePutBodyRequest({ url: server.url, path: path + videoId, token: server.accessToken, fields })
557 })
558
559 it('Should fail with a bad category', async function () {
560 const fields = {
561 name: 'my super name',
562 category: 128,
563 licence: 2,
564 language: 6,
565 nsfw: false,
566 description: 'my super description',
567 tags: [ 'tag1', 'tag2' ]
568 }
569 await makePutBodyRequest({ url: server.url, path: path + videoId, token: server.accessToken, fields })
570 })
571
572 it('Should fail with a bad licence', async function () {
573 const fields = {
574 name: 'my super name',
575 category: 5,
576 licence: 128,
577 language: 6,
578 nsfw: false,
579 description: 'my super description',
580 tags: [ 'tag1', 'tag2' ]
581 }
582 await makePutBodyRequest({ url: server.url, path: path + videoId, token: server.accessToken, fields })
583 })
584
585 it('Should fail with a bad language', async function () {
586 const fields = {
587 name: 'my super name',
588 category: 5,
589 licence: 3,
590 language: 896,
591 nsfw: false,
592 description: 'my super description',
593 tags: [ 'tag1', 'tag2' ]
594 }
595 await makePutBodyRequest({ url: server.url, path: path + videoId, token: server.accessToken, fields })
596 })
597
598 it('Should fail with a bad nsfw attribute', async function () {
599 const fields = {
600 name: 'my super name',
601 category: 5,
602 licence: 5,
603 language: 6,
604 nsfw: -4,
605 description: 'my super description',
606 tags: [ 'tag1', 'tag2' ]
607 }
608 await makePutBodyRequest({ url: server.url, path: path + videoId, token: server.accessToken, fields })
609 })
610
611 it('Should fail with a long description', async function () {
612 const fields = {
613 name: 'my super name',
614 category: 5,
615 licence: 2,
616 language: 6,
617 nsfw: false,
2de96f4d 618 description: 'my super description which is very very very very very very very very very very very very very long'.repeat(35),
0e1dc3e7
C
619 tags: [ 'tag1', 'tag2' ]
620 }
621 await makePutBodyRequest({ url: server.url, path: path + videoId, token: server.accessToken, fields })
622 })
623
624 it('Should fail with too many tags', async function () {
625 const fields = {
626 name: 'my super name',
627 category: 5,
628 licence: 2,
629 language: 6,
630 nsfw: false,
631 description: 'my super description',
a265f7f3 632 tags: [ 'tag1', 'tag2', 'tag3', 'tag4', 'tag5', 'tag6' ]
0e1dc3e7
C
633 }
634 await makePutBodyRequest({ url: server.url, path: path + videoId, token: server.accessToken, fields })
635 })
636
637 it('Should fail with a tag length too low', async function () {
638 const fields = {
639 name: 'my super name',
640 category: 5,
641 licence: 2,
642 language: 6,
643 nsfw: false,
644 description: 'my super description',
645 tags: [ 'tag1', 't' ]
646 }
647 await makePutBodyRequest({ url: server.url, path: path + videoId, token: server.accessToken, fields })
648 })
649
650 it('Should fail with a tag length too big', async function () {
651 const fields = {
652 name: 'my super name',
653 category: 5,
654 licence: 2,
655 language: 6,
656 nsfw: false,
657 description: 'my super description',
a265f7f3 658 tags: [ 'my_super_tag_too_long_long_long_long', 'tag1' ]
0e1dc3e7
C
659 }
660 await makePutBodyRequest({ url: server.url, path: path + videoId, token: server.accessToken, fields })
661 })
662
663 it('Should fail with a video of another user')
664
665 it('Should fail with a video of another pod')
666 })
667
668 describe('When getting a video', function () {
669 it('Should return the list of the videos with nothing', async function () {
670 const res = await request(server.url)
671 .get(path)
672 .set('Accept', 'application/json')
673 .expect(200)
674 .expect('Content-Type', /json/)
675
676 expect(res.body.data).to.be.an('array')
677 expect(res.body.data.length).to.equal(3)
678 })
679
680 it('Should fail without a correct uuid', async function () {
681 await request(server.url)
682 .get(path + 'coucou')
683 .set('Accept', 'application/json')
684 .expect(400)
685 })
686
687 it('Should return 404 with an incorrect video', async function () {
688 await request(server.url)
689 .get(path + '4da6fde3-88f7-4d16-b119-108df5630b06')
690 .set('Accept', 'application/json')
691 .expect(404)
692 })
693
694 it('Should succeed with the correct parameters')
695 })
696
697 describe('When rating a video', function () {
698 let videoId
699
700 before(async function () {
701 const res = await getVideosList(server.url)
702 videoId = res.body.data[0].id
703 })
704
705 it('Should fail without a valid uuid', async function () {
706 const fields = {
707 rating: 'like'
708 }
709 await makePutBodyRequest({ url: server.url, path: path + 'blabla/rate', token: server.accessToken, fields })
710 })
711
712 it('Should fail with an unknown id', async function () {
713 const fields = {
714 rating: 'like'
715 }
716 await makePutBodyRequest({
717 url: server.url,
718 path: path + '4da6fde3-88f7-4d16-b119-108df5630b06/rate',
719 token: server.accessToken,
720 fields,
721 statusCodeExpected: 404
722 })
723 })
724
725 it('Should fail with a wrong rating', async function () {
726 const fields = {
727 rating: 'likes'
728 }
729 await makePutBodyRequest({ url: server.url, path: path + videoId + '/rate', token: server.accessToken, fields })
730 })
731
732 it('Should succeed with the correct parameters', async function () {
733 const fields = {
734 rating: 'like'
735 }
736 await makePutBodyRequest({
737 url: server.url,
738 path: path + videoId + '/rate',
739 token: server.accessToken,
740 fields,
741 statusCodeExpected: 204
742 })
743 })
744 })
745
746 describe('When removing a video', function () {
747 it('Should have 404 with nothing', async function () {
748 await request(server.url)
749 .delete(path)
750 .set('Authorization', 'Bearer ' + server.accessToken)
751 .expect(400)
752 })
753
754 it('Should fail without a correct uuid', async function () {
755 await request(server.url)
756 .delete(path + 'hello')
757 .set('Authorization', 'Bearer ' + server.accessToken)
758 .expect(400)
759 })
760
761 it('Should fail with a video which does not exist', async function () {
762 await request(server.url)
763 .delete(path + '4da6fde3-88f7-4d16-b119-108df5630b06')
764 .set('Authorization', 'Bearer ' + server.accessToken)
765 .expect(404)
766 })
767
768 it('Should fail with a video of another user')
769
770 it('Should fail with a video of another pod')
771
772 it('Should succeed with the correct parameters')
773 })
774
775 after(async function () {
776 killallServers([ server ])
777
778 // Keep the logs if the test failed
779 if (this['ok']) {
780 await flushTests()
781 }
782 })
783})