1 import * as request from 'supertest'
2 import { VideoAbuseUpdate } from '../../../../shared/models/videos/abuse/video-abuse-update.model'
3 import { makeDeleteRequest, makePutBodyRequest } from '..'
5 function reportVideoAbuse (url: string, token: string, videoId: number | string, reason: string, specialStatus = 200) {
6 const path = '/api/v1/videos/' + videoId + '/abuse'
10 .set('Accept', 'application/json')
11 .set('Authorization', 'Bearer ' + token)
13 .expect(specialStatus)
16 function getVideoAbusesList (url: string, token: string) {
17 const path = '/api/v1/videos/abuse'
21 .query({ sort: 'createdAt' })
22 .set('Accept', 'application/json')
23 .set('Authorization', 'Bearer ' + token)
25 .expect('Content-Type', /json/)
28 function updateVideoAbuse (
31 videoId: string | number,
33 body: VideoAbuseUpdate,
34 statusCodeExpected = 204
36 const path = '/api/v1/videos/' + videoId + '/abuse/' + videoAbuseId
38 return makePutBodyRequest({
47 function deleteVideoAbuse (url: string, token: string, videoId: string | number, videoAbuseId: number, statusCodeExpected = 204) {
48 const path = '/api/v1/videos/' + videoId + '/abuse/' + videoAbuseId
50 return makeDeleteRequest({
58 // ---------------------------------------------------------------------------