]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - server/tests/utils/videos/video-abuses.ts
Tests directories refractor
[github/Chocobozzz/PeerTube.git] / server / tests / utils / videos / video-abuses.ts
CommitLineData
0e1dc3e7
C
1import * as request from 'supertest'
2
3function reportVideoAbuse (url: string, token: string, videoId: number, reason: string, specialStatus = 204) {
4 const path = '/api/v1/videos/' + videoId + '/abuse'
5
6 return request(url)
7 .post(path)
8 .set('Accept', 'application/json')
9 .set('Authorization', 'Bearer ' + token)
10 .send({ reason })
11 .expect(specialStatus)
12}
13
14function getVideoAbusesList (url: string, token: string) {
15 const path = '/api/v1/videos/abuse'
16
17 return request(url)
18 .get(path)
19 .query({ sort: 'createdAt' })
20 .set('Accept', 'application/json')
21 .set('Authorization', 'Bearer ' + token)
22 .expect(200)
23 .expect('Content-Type', /json/)
24}
25
0e1dc3e7
C
26// ---------------------------------------------------------------------------
27
28export {
29 reportVideoAbuse,
d4f1e94c 30 getVideoAbusesList
0e1dc3e7 31}