aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/utils/videos.js
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-03-08 21:35:43 +0100
committerChocobozzz <florian.bigard@gmail.com>2017-03-08 21:35:43 +0100
commitd38b82810638b9f664c9016fac2684454c273a77 (patch)
tree9465c367e5033675309efca4d66790c6fdd5230d /server/tests/utils/videos.js
parent8f9064432122cba0f518a24ac4378357dadec589 (diff)
downloadPeerTube-d38b82810638b9f664c9016fac2684454c273a77.tar.gz
PeerTube-d38b82810638b9f664c9016fac2684454c273a77.tar.zst
PeerTube-d38b82810638b9f664c9016fac2684454c273a77.zip
Add like/dislike system for videos
Diffstat (limited to 'server/tests/utils/videos.js')
-rw-r--r--server/tests/utils/videos.js20
1 files changed, 19 insertions, 1 deletions
diff --git a/server/tests/utils/videos.js b/server/tests/utils/videos.js
index f94368437..177426076 100644
--- a/server/tests/utils/videos.js
+++ b/server/tests/utils/videos.js
@@ -16,7 +16,8 @@ const videosUtils = {
16 searchVideoWithSort, 16 searchVideoWithSort,
17 testVideoImage, 17 testVideoImage,
18 uploadVideo, 18 uploadVideo,
19 updateVideo 19 updateVideo,
20 rateVideo
20} 21}
21 22
22// ---------------------- Export functions -------------------- 23// ---------------------- Export functions --------------------
@@ -236,6 +237,23 @@ function updateVideo (url, accessToken, id, name, description, tags, specialStat
236 req.expect(specialStatus).end(end) 237 req.expect(specialStatus).end(end)
237} 238}
238 239
240function rateVideo (url, accessToken, id, rating, specialStatus, end) {
241 if (!end) {
242 end = specialStatus
243 specialStatus = 204
244 }
245
246 const path = '/api/v1/videos/' + id + '/rate'
247
248 request(url)
249 .put(path)
250 .set('Accept', 'application/json')
251 .set('Authorization', 'Bearer ' + accessToken)
252 .send({ rating })
253 .expect(specialStatus)
254 .end(end)
255}
256
239// --------------------------------------------------------------------------- 257// ---------------------------------------------------------------------------
240 258
241module.exports = videosUtils 259module.exports = videosUtils