aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/utils/videos/video-blacklist.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-08-13 16:57:13 +0200
committerChocobozzz <me@florianbigard.com>2018-08-14 09:27:18 +0200
commit26b7305a232e547709f433a6edf700bf495935d8 (patch)
treeb5676090c61df72f864735bcc881d5ee256cffbd /server/tests/utils/videos/video-blacklist.ts
parentefc9e8450a8bbeeef9cd18e3ad6037abc0f815c3 (diff)
downloadPeerTube-26b7305a232e547709f433a6edf700bf495935d8.tar.gz
PeerTube-26b7305a232e547709f433a6edf700bf495935d8.tar.zst
PeerTube-26b7305a232e547709f433a6edf700bf495935d8.zip
Add blacklist reason field
Diffstat (limited to 'server/tests/utils/videos/video-blacklist.ts')
-rw-r--r--server/tests/utils/videos/video-blacklist.ts16
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 @@
1import * as request from 'supertest' 1import * as request from 'supertest'
2 2
3function addVideoToBlacklist (url: string, token: string, videoId: number, specialStatus = 204) { 3function 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
14function 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
13function removeVideoFromBlacklist (url: string, token: string, videoId: number | string, specialStatus = 204) { 24function 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}