aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/users.js
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api/users.js')
-rw-r--r--server/tests/api/users.js29
1 files changed, 29 insertions, 0 deletions
diff --git a/server/tests/api/users.js b/server/tests/api/users.js
index bd95e78c2..f9568b874 100644
--- a/server/tests/api/users.js
+++ b/server/tests/api/users.js
@@ -10,6 +10,7 @@ const loginUtils = require('../utils/login')
10const podsUtils = require('../utils/pods') 10const podsUtils = require('../utils/pods')
11const serversUtils = require('../utils/servers') 11const serversUtils = require('../utils/servers')
12const usersUtils = require('../utils/users') 12const usersUtils = require('../utils/users')
13const requestsUtils = require('../utils/requests')
13const videosUtils = require('../utils/videos') 14const videosUtils = require('../utils/videos')
14 15
15describe('Test users', function () { 16describe('Test users', function () {
@@ -138,6 +139,23 @@ describe('Test users', function () {
138 videosUtils.uploadVideo(server.url, accessToken, name, description, tags, video, 204, done) 139 videosUtils.uploadVideo(server.url, accessToken, name, description, tags, video, 204, done)
139 }) 140 })
140 141
142 it('Should retrieve a video rating', function (done) {
143 videosUtils.rateVideo(server.url, accessToken, videoId, 'like', function (err) {
144 if (err) throw err
145
146 usersUtils.getUserVideoRating(server.url, accessToken, videoId, function (err, res) {
147 if (err) throw err
148
149 const rating = res.body
150
151 expect(rating.videoId).to.equal(videoId)
152 expect(rating.rating).to.equal('like')
153
154 done()
155 })
156 })
157 })
158
141 it('Should not be able to remove the video with an incorrect token', function (done) { 159 it('Should not be able to remove the video with an incorrect token', function (done) {
142 videosUtils.removeVideo(server.url, 'bad_token', videoId, 401, done) 160 videosUtils.removeVideo(server.url, 'bad_token', videoId, 401, done)
143 }) 161 })
@@ -150,10 +168,21 @@ describe('Test users', function () {
150 168
151 it('Should logout (revoke token)') 169 it('Should logout (revoke token)')
152 170
171 it('Should not be able to get the user informations')
172
153 it('Should not be able to upload a video') 173 it('Should not be able to upload a video')
154 174
155 it('Should not be able to remove a video') 175 it('Should not be able to remove a video')
156 176
177 it('Should not be able to rate a video', function (done) {
178 const path = '/api/v1/videos/'
179 const data = {
180 rating: 'likes'
181 }
182
183 requestsUtils.makePutBodyRequest(server.url, path + videoId, 'wrong token', data, done, 401)
184 })
185
157 it('Should be able to login again') 186 it('Should be able to login again')
158 187
159 it('Should have an expired access token') 188 it('Should have an expired access token')