]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/api/multiple-pods.js
Server: add ability to update a video
[github/Chocobozzz/PeerTube.git] / server / tests / api / multiple-pods.js
index b86f88c22643965bd17bc8208072f41f982583af..f0fe59c5fefb09466a6d46677e2a9eb7417a8eed 100644 (file)
@@ -3,16 +3,14 @@
 const chai = require('chai')
 const each = require('async/each')
 const expect = chai.expect
-const pathUtils = require('path')
 const series = require('async/series')
+const webtorrent = new (require('webtorrent'))()
 
 const loginUtils = require('../utils/login')
 const miscsUtils = require('../utils/miscs')
 const podsUtils = require('../utils/pods')
 const serversUtils = require('../utils/servers')
 const videosUtils = require('../utils/videos')
-const webtorrent = require(pathUtils.join(__dirname, '../../lib/webtorrent'))
-webtorrent.silent = true
 
 describe('Test multiple pods', function () {
   let servers = []
@@ -53,9 +51,6 @@ describe('Test multiple pods', function () {
       function (next) {
         const server = servers[0]
         podsUtils.makeFriends(server.url, server.accessToken, next)
-      },
-      function (next) {
-        webtorrent.create({ host: 'client', port: '1' }, next)
       }
     ], done)
   })
@@ -105,11 +100,11 @@ describe('Test multiple pods', function () {
               const video = videos[0]
               expect(video.name).to.equal('my super name for pod 1')
               expect(video.description).to.equal('my super description for pod 1')
-              expect(video.podUrl).to.equal('localhost:9001')
+              expect(video.podHost).to.equal('localhost:9001')
               expect(video.magnetUri).to.exist
               expect(video.duration).to.equal(10)
               expect(video.tags).to.deep.equal([ 'tag1p1', 'tag2p1' ])
-              expect(miscsUtils.dateIsValid(video.createdDate)).to.be.true
+              expect(miscsUtils.dateIsValid(video.createdAt)).to.be.true
               expect(video.author).to.equal('root')
 
               if (server.url !== 'http://localhost:9001') {
@@ -167,11 +162,11 @@ describe('Test multiple pods', function () {
               const video = videos[1]
               expect(video.name).to.equal('my super name for pod 2')
               expect(video.description).to.equal('my super description for pod 2')
-              expect(video.podUrl).to.equal('localhost:9002')
+              expect(video.podHost).to.equal('localhost:9002')
               expect(video.magnetUri).to.exist
               expect(video.duration).to.equal(5)
               expect(video.tags).to.deep.equal([ 'tag1p2', 'tag2p2', 'tag3p2' ])
-              expect(miscsUtils.dateIsValid(video.createdDate)).to.be.true
+              expect(miscsUtils.dateIsValid(video.createdAt)).to.be.true
               expect(video.author).to.equal('root')
 
               if (server.url !== 'http://localhost:9002') {
@@ -246,21 +241,21 @@ describe('Test multiple pods', function () {
 
               expect(video1.name).to.equal('my super name for pod 3')
               expect(video1.description).to.equal('my super description for pod 3')
-              expect(video1.podUrl).to.equal('localhost:9003')
+              expect(video1.podHost).to.equal('localhost:9003')
               expect(video1.magnetUri).to.exist
               expect(video1.duration).to.equal(5)
               expect(video1.tags).to.deep.equal([ 'tag1p3' ])
               expect(video1.author).to.equal('root')
-              expect(miscsUtils.dateIsValid(video1.createdDate)).to.be.true
+              expect(miscsUtils.dateIsValid(video1.createdAt)).to.be.true
 
               expect(video2.name).to.equal('my super name for pod 3-2')
               expect(video2.description).to.equal('my super description for pod 3-2')
-              expect(video2.podUrl).to.equal('localhost:9003')
+              expect(video2.podHost).to.equal('localhost:9003')
               expect(video2.magnetUri).to.exist
               expect(video2.duration).to.equal(5)
               expect(video2.tags).to.deep.equal([ 'tag2p3', 'tag3p3', 'tag4p3' ])
               expect(video2.author).to.equal('root')
-              expect(miscsUtils.dateIsValid(video2.createdDate)).to.be.true
+              expect(miscsUtils.dateIsValid(video2.createdAt)).to.be.true
 
               if (server.url !== 'http://localhost:9003') {
                 expect(video1.isLocal).to.be.false
@@ -350,7 +345,7 @@ describe('Test multiple pods', function () {
           expect(torrent.files.length).to.equal(1)
           expect(torrent.files[0].path).to.exist.and.to.not.equal('')
 
-          webtorrent.remove(video.magnetUri, done)
+          done()
         })
       })
     })
@@ -415,7 +410,6 @@ describe('Test multiple pods', function () {
     servers.forEach(function (server) {
       process.kill(-server.app.pid)
     })
-    process.kill(-webtorrent.app.pid)
 
     // Keep the logs if the test failed
     if (this.ok) {