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