1 import * as request from 'supertest'
2 import { VideoAbuseUpdate } from '../../models/videos/abuse/video-abuse-update.model'
3 import { makeDeleteRequest, makePutBodyRequest, makeGetRequest } from '../requests/requests'
4 import { VideoAbuseState } from '@shared/models'
5 import { VideoAbuseVideoIs } from '@shared/models/videos/abuse/video-abuse-video-is.type'
7 function reportVideoAbuse (url: string, token: string, videoId: number | string, reason: string, specialStatus = 200) {
8 const path = '/api/v1/videos/' + videoId + '/abuse'
12 .set('Accept', 'application/json')
13 .set('Authorization', 'Bearer ' + token)
15 .expect(specialStatus)
18 function getVideoAbusesList (options: {
23 state?: VideoAbuseState
24 videoIs?: VideoAbuseVideoIs
25 searchReporter?: string
26 searchReportee?: string
28 searchVideoChannel?: string
42 const path = '/api/v1/videos/abuse'
56 return makeGetRequest({
61 statusCodeExpected: 200
65 function updateVideoAbuse (
68 videoId: string | number,
70 body: VideoAbuseUpdate,
71 statusCodeExpected = 204
73 const path = '/api/v1/videos/' + videoId + '/abuse/' + videoAbuseId
75 return makePutBodyRequest({
84 function deleteVideoAbuse (url: string, token: string, videoId: string | number, videoAbuseId: number, statusCodeExpected = 204) {
85 const path = '/api/v1/videos/' + videoId + '/abuse/' + videoAbuseId
87 return makeDeleteRequest({
95 // ---------------------------------------------------------------------------