Add like/dislike system for videos
[oweals/peertube.git] / server / tests / utils / users.js
index a2c010f641d41c18a98e0430941c1c42c5aa0c0b..7817160b94e9b50c39230fc5d70f171aca244f1d 100644 (file)
@@ -5,6 +5,7 @@ const request = require('supertest')
 const usersUtils = {
   createUser,
   getUserInformation,
+  getUserVideoRating,
   getUsersList,
   getUsersListPaginationAndSort,
   removeUser,
@@ -47,6 +48,18 @@ function getUserInformation (url, accessToken, end) {
     .end(end)
 }
 
+function getUserVideoRating (url, accessToken, videoId, end) {
+  const path = '/api/v1/users/me/videos/' + videoId + '/rating'
+
+  request(url)
+    .get(path)
+    .set('Accept', 'application/json')
+    .set('Authorization', 'Bearer ' + accessToken)
+    .expect(200)
+    .expect('Content-Type', /json/)
+    .end(end)
+}
+
 function getUsersList (url, end) {
   const path = '/api/v1/users'