diff options
Diffstat (limited to 'server/tests/utils/videos')
-rw-r--r-- | server/tests/utils/videos/video-blacklist.ts | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/server/tests/utils/videos/video-blacklist.ts b/server/tests/utils/videos/video-blacklist.ts index aa0d232b6..7819f4b25 100644 --- a/server/tests/utils/videos/video-blacklist.ts +++ b/server/tests/utils/videos/video-blacklist.ts | |||
@@ -1,15 +1,26 @@ | |||
1 | import * as request from 'supertest' | 1 | import * as request from 'supertest' |
2 | 2 | ||
3 | function addVideoToBlacklist (url: string, token: string, videoId: number, specialStatus = 204) { | 3 | function addVideoToBlacklist (url: string, token: string, videoId: number | string, reason?: string, specialStatus = 204) { |
4 | const path = '/api/v1/videos/' + videoId + '/blacklist' | 4 | const path = '/api/v1/videos/' + videoId + '/blacklist' |
5 | 5 | ||
6 | return request(url) | 6 | return request(url) |
7 | .post(path) | 7 | .post(path) |
8 | .send({ reason }) | ||
8 | .set('Accept', 'application/json') | 9 | .set('Accept', 'application/json') |
9 | .set('Authorization', 'Bearer ' + token) | 10 | .set('Authorization', 'Bearer ' + token) |
10 | .expect(specialStatus) | 11 | .expect(specialStatus) |
11 | } | 12 | } |
12 | 13 | ||
14 | function updateVideoBlacklist (url: string, token: string, videoId: number, reason?: string, specialStatus = 204) { | ||
15 | const path = '/api/v1/videos/' + videoId + '/blacklist' | ||
16 | |||
17 | return request(url) | ||
18 | .put(path) | ||
19 | .send({ reason }) | ||
20 | .set('Accept', 'application/json') | ||
21 | .set('Authorization', 'Bearer ' + token) | ||
22 | .expect(specialStatus)} | ||
23 | |||
13 | function removeVideoFromBlacklist (url: string, token: string, videoId: number | string, specialStatus = 204) { | 24 | function removeVideoFromBlacklist (url: string, token: string, videoId: number | string, specialStatus = 204) { |
14 | const path = '/api/v1/videos/' + videoId + '/blacklist' | 25 | const path = '/api/v1/videos/' + videoId + '/blacklist' |
15 | 26 | ||
@@ -50,5 +61,6 @@ export { | |||
50 | addVideoToBlacklist, | 61 | addVideoToBlacklist, |
51 | removeVideoFromBlacklist, | 62 | removeVideoFromBlacklist, |
52 | getBlacklistedVideosList, | 63 | getBlacklistedVideosList, |
53 | getSortedBlacklistedVideosList | 64 | getSortedBlacklistedVideosList, |
65 | updateVideoBlacklist | ||
54 | } | 66 | } |