]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/utils/videos/video-abuses.ts
Try to cache video_high_bitrate_1080p in travis
[github/Chocobozzz/PeerTube.git] / server / tests / utils / videos / video-abuses.ts
index 0d72bf457a8384a0fde325df6cad0a0c3a72be5e..14907e6a0921ac430314d7919e255c7e8f442689 100644 (file)
@@ -1,6 +1,8 @@
 import * as request from 'supertest'
+import { VideoAbuseUpdate } from '../../../../shared/models/videos/abuse/video-abuse-update.model'
+import { makeDeleteRequest, makePutBodyRequest } from '..'
 
-function reportVideoAbuse (url: string, token: string, videoId: number | string, reason: string, specialStatus = 204) {
+function reportVideoAbuse (url: string, token: string, videoId: number | string, reason: string, specialStatus = 200) {
   const path = '/api/v1/videos/' + videoId + '/abuse'
 
   return request(url)
@@ -23,9 +25,41 @@ function getVideoAbusesList (url: string, token: string) {
           .expect('Content-Type', /json/)
 }
 
+function updateVideoAbuse (
+  url: string,
+  token: string,
+  videoId: string | number,
+  videoAbuseId: number,
+  body: VideoAbuseUpdate,
+  statusCodeExpected = 204
+) {
+  const path = '/api/v1/videos/' + videoId + '/abuse/' + videoAbuseId
+
+  return makePutBodyRequest({
+    url,
+    token,
+    path,
+    fields: body,
+    statusCodeExpected
+  })
+}
+
+function deleteVideoAbuse (url: string, token: string, videoId: string | number, videoAbuseId: number, statusCodeExpected = 204) {
+  const path = '/api/v1/videos/' + videoId + '/abuse/' + videoAbuseId
+
+  return makeDeleteRequest({
+    url,
+    token,
+    path,
+    statusCodeExpected
+  })
+}
+
 // ---------------------------------------------------------------------------
 
 export {
   reportVideoAbuse,
-  getVideoAbusesList
+  getVideoAbusesList,
+  updateVideoAbuse,
+  deleteVideoAbuse
 }