aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/multiple-pods.js
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-01-12 09:47:21 +0100
committerChocobozzz <florian.bigard@gmail.com>2017-01-12 09:47:21 +0100
commit7f4e7c36373217b8e92cf227c71999a0ce9a15d9 (patch)
tree7c7f49d8066646a593c1d8a8551610dbed0f68aa /server/tests/api/multiple-pods.js
parent63d00f5ded0aad25eeb50111da65b6daa46bcb24 (diff)
downloadPeerTube-7f4e7c36373217b8e92cf227c71999a0ce9a15d9.tar.gz
PeerTube-7f4e7c36373217b8e92cf227c71999a0ce9a15d9.tar.zst
PeerTube-7f4e7c36373217b8e92cf227c71999a0ce9a15d9.zip
Server: fix update remote video infohash
Diffstat (limited to 'server/tests/api/multiple-pods.js')
-rw-r--r--server/tests/api/multiple-pods.js29
1 files changed, 23 insertions, 6 deletions
diff --git a/server/tests/api/multiple-pods.js b/server/tests/api/multiple-pods.js
index 4442a7ff7..169a9f2e0 100644
--- a/server/tests/api/multiple-pods.js
+++ b/server/tests/api/multiple-pods.js
@@ -4,7 +4,8 @@ const chai = require('chai')
4const each = require('async/each') 4const each = require('async/each')
5const expect = chai.expect 5const expect = chai.expect
6const series = require('async/series') 6const series = require('async/series')
7const webtorrent = new (require('webtorrent'))() 7const WebTorrent = require('webtorrent')
8const webtorrent = new WebTorrent()
8 9
9const loginUtils = require('../utils/login') 10const loginUtils = require('../utils/login')
10const miscsUtils = require('../utils/miscs') 11const miscsUtils = require('../utils/miscs')
@@ -311,7 +312,7 @@ describe('Test multiple pods', function () {
311 expect(torrent.files.length).to.equal(1) 312 expect(torrent.files.length).to.equal(1)
312 expect(torrent.files[0].path).to.exist.and.to.not.equal('') 313 expect(torrent.files[0].path).to.exist.and.to.not.equal('')
313 314
314 done() 315 webtorrent.remove(video.magnetUri, done)
315 }) 316 })
316 }) 317 })
317 }) 318 })
@@ -330,7 +331,7 @@ describe('Test multiple pods', function () {
330 expect(torrent.files.length).to.equal(1) 331 expect(torrent.files.length).to.equal(1)
331 expect(torrent.files[0].path).to.exist.and.to.not.equal('') 332 expect(torrent.files[0].path).to.exist.and.to.not.equal('')
332 333
333 done() 334 webtorrent.remove(video.magnetUri, done)
334 }) 335 })
335 }) 336 })
336 }) 337 })
@@ -349,7 +350,7 @@ describe('Test multiple pods', function () {
349 expect(torrent.files.length).to.equal(1) 350 expect(torrent.files.length).to.equal(1)
350 expect(torrent.files[0].path).to.exist.and.to.not.equal('') 351 expect(torrent.files[0].path).to.exist.and.to.not.equal('')
351 352
352 done() 353 webtorrent.remove(video.magnetUri, done)
353 }) 354 })
354 }) 355 })
355 }) 356 })
@@ -368,7 +369,7 @@ describe('Test multiple pods', function () {
368 expect(torrent.files.length).to.equal(1) 369 expect(torrent.files.length).to.equal(1)
369 expect(torrent.files[0].path).to.exist.and.to.not.equal('') 370 expect(torrent.files[0].path).to.exist.and.to.not.equal('')
370 371
371 done() 372 webtorrent.remove(video.magnetUri, done)
372 }) 373 })
373 }) 374 })
374 }) 375 })
@@ -390,7 +391,12 @@ describe('Test multiple pods', function () {
390 }) 391 })
391 392
392 it('Should have the video 3 updated on each pod', function (done) { 393 it('Should have the video 3 updated on each pod', function (done) {
394 this.timeout(200000)
395
393 each(servers, function (server, callback) { 396 each(servers, function (server, callback) {
397 // Avoid "duplicate torrent" errors
398 const webtorrent = new WebTorrent()
399
394 videosUtils.getVideosList(server.url, function (err, res) { 400 videosUtils.getVideosList(server.url, function (err, res) {
395 if (err) throw err 401 if (err) throw err
396 402
@@ -404,7 +410,18 @@ describe('Test multiple pods', function () {
404 expect(videoUpdated.tags).to.deep.equal([ 'tagup1', 'tagup2' ]) 410 expect(videoUpdated.tags).to.deep.equal([ 'tagup1', 'tagup2' ])
405 expect(miscsUtils.dateIsValid(videoUpdated.updatedAt, 20000)).to.be.true 411 expect(miscsUtils.dateIsValid(videoUpdated.updatedAt, 20000)).to.be.true
406 412
407 callback() 413 videosUtils.testVideoImage(server.url, 'video_short3.webm', videoUpdated.thumbnailPath, function (err, test) {
414 if (err) throw err
415 expect(test).to.equal(true)
416
417 webtorrent.add(videoUpdated.magnetUri, function (torrent) {
418 expect(torrent.files).to.exist
419 expect(torrent.files.length).to.equal(1)
420 expect(torrent.files[0].path).to.exist.and.to.not.equal('')
421
422 webtorrent.remove(videoUpdated.magnetUri, callback)
423 })
424 })
408 }) 425 })
409 }, done) 426 }, done)
410 }) 427 })