1 import * as request from 'supertest'
3 function addVideoToBlacklist (url: string, token: string, videoId: number, specialStatus = 204) {
4 const path = '/api/v1/videos/' + videoId + '/blacklist'
8 .set('Accept', 'application/json')
9 .set('Authorization', 'Bearer ' + token)
10 .expect(specialStatus)
13 function removeVideoFromBlacklist (url: string, token: string, videoId: number, specialStatus = 204) {
14 const path = '/api/v1/blacklist/' + videoId
18 .set('Accept', 'application/json')
19 .set('Authorization', 'Bearer ' + token)
20 .expect(specialStatus)
23 function getBlacklistedVideosList (url: string, token: string, specialStatus = 200) {
24 const path = '/api/v1/blacklist/'
28 .query({ sort: 'createdAt' })
29 .set('Accept', 'application/json')
30 .set('Authorization', 'Bearer ' + token)
31 .expect(specialStatus)
32 .expect('Content-Type', /json/)
35 function getSortedBlacklistedVideosList (url: string, token: string, sort: string, specialStatus = 200) {
36 const path = '/api/v1/blacklist/'
40 .query({ sort: sort })
41 .set('Accept', 'application/json')
42 .set('Authorization', 'Bearer ' + token)
43 .expect(specialStatus)
44 .expect('Content-Type', /json/)
47 // ---------------------------------------------------------------------------
51 removeVideoFromBlacklist,
52 getBlacklistedVideosList,
53 getSortedBlacklistedVideosList