aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/utils/videos
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-08-10 16:54:01 +0200
committerChocobozzz <me@florianbigard.com>2018-08-10 16:54:01 +0200
commit268eebed921ac13a9ce0f4717f4923aa24190657 (patch)
tree52f8436968c8dcc686663ef5db8dffd7ed191d34 /server/tests/utils/videos
parent904a463c7792837f0a468a522a28448323e48593 (diff)
downloadPeerTube-268eebed921ac13a9ce0f4717f4923aa24190657.tar.gz
PeerTube-268eebed921ac13a9ce0f4717f4923aa24190657.tar.zst
PeerTube-268eebed921ac13a9ce0f4717f4923aa24190657.zip
Add state and moderationComment for abuses on server side
Diffstat (limited to 'server/tests/utils/videos')
-rw-r--r--server/tests/utils/videos/video-abuses.ts38
1 files changed, 36 insertions, 2 deletions
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 @@
1import * as request from 'supertest' 1import * as request from 'supertest'
2import { VideoAbuseUpdate } from '../../../../shared/models/videos/video-abuse-update.model'
3import { makeDeleteRequest, makePutBodyRequest } from '..'
2 4
3function reportVideoAbuse (url: string, token: string, videoId: number | string, reason: string, specialStatus = 204) { 5function reportVideoAbuse (url: string, token: string, videoId: number | string, reason: string, specialStatus = 200) {
4 const path = '/api/v1/videos/' + videoId + '/abuse' 6 const path = '/api/v1/videos/' + videoId + '/abuse'
5 7
6 return request(url) 8 return request(url)
@@ -23,9 +25,41 @@ function getVideoAbusesList (url: string, token: string) {
23 .expect('Content-Type', /json/) 25 .expect('Content-Type', /json/)
24} 26}
25 27
28function updateVideoAbuse (
29 url: string,
30 token: string,
31 videoId: string | number,
32 videoAbuseId: number,
33 body: VideoAbuseUpdate,
34 statusCodeExpected = 204
35) {
36 const path = '/api/v1/videos/' + videoId + '/abuse/' + videoAbuseId
37
38 return makePutBodyRequest({
39 url,
40 token,
41 path,
42 fields: body,
43 statusCodeExpected
44 })
45}
46
47function deleteVideoAbuse (url: string, token: string, videoId: string | number, videoAbuseId: number, statusCodeExpected = 204) {
48 const path = '/api/v1/videos/' + videoId + '/abuse/' + videoAbuseId
49
50 return makeDeleteRequest({
51 url,
52 token,
53 path,
54 statusCodeExpected
55 })
56}
57
26// --------------------------------------------------------------------------- 58// ---------------------------------------------------------------------------
27 59
28export { 60export {
29 reportVideoAbuse, 61 reportVideoAbuse,
30 getVideoAbusesList 62 getVideoAbusesList,
63 updateVideoAbuse,
64 deleteVideoAbuse
31} 65}