aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/check-params/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/api/check-params/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/api/check-params/videos.js')
-rw-r--r--server/tests/api/check-params/videos.js42
1 files changed, 42 insertions, 0 deletions
diff --git a/server/tests/api/check-params/videos.js b/server/tests/api/check-params/videos.js
index f8549a95b..0f5f40b8e 100644
--- a/server/tests/api/check-params/videos.js
+++ b/server/tests/api/check-params/videos.js
@@ -420,6 +420,48 @@ describe('Test videos API validator', function () {
420 it('Should succeed with the correct parameters') 420 it('Should succeed with the correct parameters')
421 }) 421 })
422 422
423 describe('When rating a video', function () {
424 let videoId
425
426 before(function (done) {
427 videosUtils.getVideosList(server.url, function (err, res) {
428 if (err) throw err
429
430 videoId = res.body.data[0].id
431
432 return done()
433 })
434 })
435
436 it('Should fail without a valid uuid', function (done) {
437 const data = {
438 rating: 'like'
439 }
440 requestsUtils.makePutBodyRequest(server.url, path + 'blabla/rate', server.accessToken, data, done)
441 })
442
443 it('Should fail with an unknown id', function (done) {
444 const data = {
445 rating: 'like'
446 }
447 requestsUtils.makePutBodyRequest(server.url, path + '4da6fde3-88f7-4d16-b119-108df5630b06/rate', server.accessToken, data, done, 404)
448 })
449
450 it('Should fail with a wrong rating', function (done) {
451 const data = {
452 rating: 'likes'
453 }
454 requestsUtils.makePutBodyRequest(server.url, path + videoId + '/rate', server.accessToken, data, done)
455 })
456
457 it('Should succeed with the correct parameters', function (done) {
458 const data = {
459 rating: 'like'
460 }
461 requestsUtils.makePutBodyRequest(server.url, path + videoId + '/rate', server.accessToken, data, done, 204)
462 })
463 })
464
423 describe('When removing a video', function () { 465 describe('When removing a video', function () {
424 it('Should have 404 with nothing', function (done) { 466 it('Should have 404 with nothing', function (done) {
425 request(server.url) 467 request(server.url)