diff options
author | Chocobozzz <me@florianbigard.com> | 2018-12-07 16:09:57 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2018-12-07 16:25:29 +0100 |
commit | 2a8c5d0af13f3ccb9a505e1fbc9d324b9d33ba1f (patch) | |
tree | 998a0af6923475c85eb8e97ca1d30afb42655263 /server/tests/utils/videos/video-abuses.ts | |
parent | 4b49385892b25aea5aa9e605fbcb66074bcb49b0 (diff) | |
parent | 35adc403b7eed6d1309bbce901268a76dd01b6ef (diff) | |
download | PeerTube-2a8c5d0af13f3ccb9a505e1fbc9d324b9d33ba1f.tar.gz PeerTube-2a8c5d0af13f3ccb9a505e1fbc9d324b9d33ba1f.tar.zst PeerTube-2a8c5d0af13f3ccb9a505e1fbc9d324b9d33ba1f.zip |
Merge branch 'move-utils-to-shared' of https://github.com/buoyantair/PeerTube into buoyantair-move-utils-to-shared
Diffstat (limited to 'server/tests/utils/videos/video-abuses.ts')
-rw-r--r-- | server/tests/utils/videos/video-abuses.ts | 65 |
1 files changed, 0 insertions, 65 deletions
diff --git a/server/tests/utils/videos/video-abuses.ts b/server/tests/utils/videos/video-abuses.ts deleted file mode 100644 index 4ad82ad8c..000000000 --- a/server/tests/utils/videos/video-abuses.ts +++ /dev/null | |||
@@ -1,65 +0,0 @@ | |||
1 | import * as request from 'supertest' | ||
2 | import { VideoAbuseUpdate } from '../../../../shared/models/videos/abuse/video-abuse-update.model' | ||
3 | import { makeDeleteRequest, makePutBodyRequest } from '../requests/requests' | ||
4 | |||
5 | function reportVideoAbuse (url: string, token: string, videoId: number | string, reason: string, specialStatus = 200) { | ||
6 | const path = '/api/v1/videos/' + videoId + '/abuse' | ||
7 | |||
8 | return request(url) | ||
9 | .post(path) | ||
10 | .set('Accept', 'application/json') | ||
11 | .set('Authorization', 'Bearer ' + token) | ||
12 | .send({ reason }) | ||
13 | .expect(specialStatus) | ||
14 | } | ||
15 | |||
16 | function getVideoAbusesList (url: string, token: string) { | ||
17 | const path = '/api/v1/videos/abuse' | ||
18 | |||
19 | return request(url) | ||
20 | .get(path) | ||
21 | .query({ sort: 'createdAt' }) | ||
22 | .set('Accept', 'application/json') | ||
23 | .set('Authorization', 'Bearer ' + token) | ||
24 | .expect(200) | ||
25 | .expect('Content-Type', /json/) | ||
26 | } | ||
27 | |||
28 | function 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 | |||
47 | function 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 | |||
58 | // --------------------------------------------------------------------------- | ||
59 | |||
60 | export { | ||
61 | reportVideoAbuse, | ||
62 | getVideoAbusesList, | ||
63 | updateVideoAbuse, | ||
64 | deleteVideoAbuse | ||
65 | } | ||