aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/multiple-pods.js
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api/multiple-pods.js')
-rw-r--r--server/tests/api/multiple-pods.js55
1 files changed, 45 insertions, 10 deletions
diff --git a/server/tests/api/multiple-pods.js b/server/tests/api/multiple-pods.js
index f0fe59c5f..672187068 100644
--- a/server/tests/api/multiple-pods.js
+++ b/server/tests/api/multiple-pods.js
@@ -299,8 +299,8 @@ describe('Test multiple pods', function () {
299 if (err) throw err 299 if (err) throw err
300 300
301 const video = res.body.data[0] 301 const video = res.body.data[0]
302 toRemove.push(res.body.data[2].id) 302 toRemove.push(res.body.data[2])
303 toRemove.push(res.body.data[3].id) 303 toRemove.push(res.body.data[3])
304 304
305 webtorrent.add(video.magnetUri, function (torrent) { 305 webtorrent.add(video.magnetUri, function (torrent) {
306 expect(torrent.files).to.exist 306 expect(torrent.files).to.exist
@@ -368,16 +368,51 @@ describe('Test multiple pods', function () {
368 }) 368 })
369 }) 369 })
370 }) 370 })
371 })
372
373 describe('Should manipulate these videos', function () {
374 it('Should update the video 3 by asking pod 3', function (done) {
375 this.timeout(15000)
376
377 const name = 'my super video updated'
378 const description = 'my super description updated'
379 const tags = [ 'tagup1', 'tagup2' ]
380
381 videosUtils.updateVideo(servers[2].url, servers[2].accessToken, toRemove[0].id, name, description, tags, function (err) {
382 if (err) throw err
383
384 setTimeout(done, 11000)
385 })
386 })
387
388 it('Should have the video 3 updated on each pod', function (done) {
389 each(servers, function (server, callback) {
390 videosUtils.getVideosList(server.url, function (err, res) {
391 if (err) throw err
392
393 const videos = res.body.data
394 const videoUpdated = videos.find(function (video) {
395 return video.name === 'my super video updated'
396 })
397
398 expect(!!videoUpdated).to.be.true
399 expect(videoUpdated.description).to.equal('my super description updated')
400 expect(videoUpdated.tags).to.deep.equal([ 'tagup1', 'tagup2' ])
401
402 callback()
403 })
404 }, done)
405 })
371 406
372 it('Should remove the file 3 and 3-2 by asking pod 3', function (done) { 407 it('Should remove the videos 3 and 3-2 by asking pod 3', function (done) {
373 this.timeout(15000) 408 this.timeout(15000)
374 409
375 series([ 410 series([
376 function (next) { 411 function (next) {
377 videosUtils.removeVideo(servers[2].url, servers[2].accessToken, toRemove[0], next) 412 videosUtils.removeVideo(servers[2].url, servers[2].accessToken, toRemove[0].id, next)
378 }, 413 },
379 function (next) { 414 function (next) {
380 videosUtils.removeVideo(servers[2].url, servers[2].accessToken, toRemove[1], next) 415 videosUtils.removeVideo(servers[2].url, servers[2].accessToken, toRemove[1].id, next)
381 }], 416 }],
382 function (err) { 417 function (err) {
383 if (err) throw err 418 if (err) throw err
@@ -394,11 +429,11 @@ describe('Test multiple pods', function () {
394 const videos = res.body.data 429 const videos = res.body.data
395 expect(videos).to.be.an('array') 430 expect(videos).to.be.an('array')
396 expect(videos.length).to.equal(2) 431 expect(videos.length).to.equal(2)
397 expect(videos[0].id).not.to.equal(videos[1].id) 432 expect(videos[0].name).not.to.equal(videos[1].name)
398 expect(videos[0].id).not.to.equal(toRemove[0]) 433 expect(videos[0].name).not.to.equal(toRemove[0].name)
399 expect(videos[1].id).not.to.equal(toRemove[0]) 434 expect(videos[1].name).not.to.equal(toRemove[0].name)
400 expect(videos[0].id).not.to.equal(toRemove[1]) 435 expect(videos[0].name).not.to.equal(toRemove[1].name)
401 expect(videos[1].id).not.to.equal(toRemove[1]) 436 expect(videos[1].name).not.to.equal(toRemove[1].name)
402 437
403 callback() 438 callback()
404 }) 439 })