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