From 94565d52bb2883e09f16d1363170ac9c0dccb7a1 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 15 Apr 2019 15:26:15 +0200 Subject: Shared utils -> extra-utils Because they need dev dependencies --- shared/utils/videos/video-abuses.ts | 65 ------------------------------------- 1 file changed, 65 deletions(-) delete mode 100644 shared/utils/videos/video-abuses.ts (limited to 'shared/utils/videos/video-abuses.ts') diff --git a/shared/utils/videos/video-abuses.ts b/shared/utils/videos/video-abuses.ts deleted file mode 100644 index 7f011ec0f..000000000 --- a/shared/utils/videos/video-abuses.ts +++ /dev/null @@ -1,65 +0,0 @@ -import * as request from 'supertest' -import { VideoAbuseUpdate } from '../../models/videos/abuse/video-abuse-update.model' -import { makeDeleteRequest, makePutBodyRequest } from '../requests/requests' - -function reportVideoAbuse (url: string, token: string, videoId: number | string, reason: string, specialStatus = 200) { - const path = '/api/v1/videos/' + videoId + '/abuse' - - return request(url) - .post(path) - .set('Accept', 'application/json') - .set('Authorization', 'Bearer ' + token) - .send({ reason }) - .expect(specialStatus) -} - -function getVideoAbusesList (url: string, token: string) { - const path = '/api/v1/videos/abuse' - - return request(url) - .get(path) - .query({ sort: 'createdAt' }) - .set('Accept', 'application/json') - .set('Authorization', 'Bearer ' + token) - .expect(200) - .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, - updateVideoAbuse, - deleteVideoAbuse -} -- cgit v1.2.3