aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/utils/videos/video-abuses.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2017-12-28 13:59:22 +0100
committerChocobozzz <me@florianbigard.com>2017-12-28 13:59:22 +0100
commitc5d31dba56d669c0df0209761c43c5a6ac7cec4a (patch)
treefe72b56a1c0e7beb6e092c393a00ddfe93a5d71f /server/tests/utils/videos/video-abuses.ts
parentdb799da3d2b2ea465165df78ff71effa653b6309 (diff)
downloadPeerTube-c5d31dba56d669c0df0209761c43c5a6ac7cec4a.tar.gz
PeerTube-c5d31dba56d669c0df0209761c43c5a6ac7cec4a.tar.zst
PeerTube-c5d31dba56d669c0df0209761c43c5a6ac7cec4a.zip
Tests directories refractor
Diffstat (limited to 'server/tests/utils/videos/video-abuses.ts')
-rw-r--r--server/tests/utils/videos/video-abuses.ts31
1 files changed, 31 insertions, 0 deletions
diff --git a/server/tests/utils/videos/video-abuses.ts b/server/tests/utils/videos/video-abuses.ts
new file mode 100644
index 000000000..f00809234
--- /dev/null
+++ b/server/tests/utils/videos/video-abuses.ts
@@ -0,0 +1,31 @@
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
26// ---------------------------------------------------------------------------
27
28export {
29 reportVideoAbuse,
30 getVideoAbusesList
31}