From 268eebed921ac13a9ce0f4717f4923aa24190657 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 10 Aug 2018 16:54:01 +0200 Subject: Add state and moderationComment for abuses on server side --- server/tests/utils/videos/video-abuses.ts | 38 +++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) (limited to 'server/tests/utils') diff --git a/server/tests/utils/videos/video-abuses.ts b/server/tests/utils/videos/video-abuses.ts index 0d72bf457..5f138d6b3 100644 --- a/server/tests/utils/videos/video-abuses.ts +++ b/server/tests/utils/videos/video-abuses.ts @@ -1,6 +1,8 @@ import * as request from 'supertest' +import { VideoAbuseUpdate } from '../../../../shared/models/videos/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 } -- cgit v1.2.3