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