diff options
Diffstat (limited to 'server/tests/utils/videos.js')
-rw-r--r-- | server/tests/utils/videos.js | 20 |
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 | ||
240 | function 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 | ||
241 | module.exports = videosUtils | 259 | module.exports = videosUtils |