mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-02-16 18:25:09 -06:00
Fix tests
This commit is contained in:
parent
e63dc45fa3
commit
77c2df9585
@ -103,6 +103,7 @@
|
|||||||
|
|
||||||
VideosDB.findById(id, function (err, video) {
|
VideosDB.findById(id, function (err, video) {
|
||||||
if (err || !video) {
|
if (err || !video) {
|
||||||
|
if (!err) err = new Error('Cannot find this video.')
|
||||||
logger.error('Cannot find this video.', { error: err })
|
logger.error('Cannot find this video.', { error: err })
|
||||||
return callback(err)
|
return callback(err)
|
||||||
}
|
}
|
||||||
|
@ -8,16 +8,8 @@
|
|||||||
|
|
||||||
var logger = require('./logger')
|
var logger = require('./logger')
|
||||||
|
|
||||||
var host
|
var host = config.get('webserver.host')
|
||||||
var port
|
var port = config.get('webserver.port')
|
||||||
|
|
||||||
try {
|
|
||||||
host = config.get('webserver.host')
|
|
||||||
port = config.get('webserver.port')
|
|
||||||
} catch (e) {
|
|
||||||
host = 'client'
|
|
||||||
port = 1
|
|
||||||
}
|
|
||||||
|
|
||||||
var nodeKey = 'webtorrentnode' + port
|
var nodeKey = 'webtorrentnode' + port
|
||||||
var processKey = 'webtorrent' + port
|
var processKey = 'webtorrent' + port
|
||||||
@ -33,7 +25,21 @@
|
|||||||
// Useful to kill it
|
// Useful to kill it
|
||||||
webtorrentnode.app = null
|
webtorrentnode.app = null
|
||||||
|
|
||||||
webtorrentnode.create = function (callback) {
|
webtorrentnode.create = function (options, callback) {
|
||||||
|
if (typeof options === 'function') {
|
||||||
|
callback = options
|
||||||
|
options = {}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Override options
|
||||||
|
if (options.host) host = options.host
|
||||||
|
if (options.port) {
|
||||||
|
port = options.port
|
||||||
|
nodeKey = 'webtorrentnode' + port
|
||||||
|
processKey = 'webtorrent' + port
|
||||||
|
ipc.config.id = nodeKey
|
||||||
|
}
|
||||||
|
|
||||||
ipc.serve(function () {
|
ipc.serve(function () {
|
||||||
if (!webtorrentnode.silent) logger.info('IPC server ready.')
|
if (!webtorrentnode.silent) logger.info('IPC server ready.')
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@
|
|||||||
.end(function (err, res) {
|
.end(function (err, res) {
|
||||||
if (err) throw err
|
if (err) throw err
|
||||||
|
|
||||||
webtorrent.create(function () {
|
webtorrent.create({ host: 'client', port: '1' }, function () {
|
||||||
done()
|
done()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@ -214,7 +214,7 @@
|
|||||||
describe('Should seed the uploaded video', function () {
|
describe('Should seed the uploaded video', function () {
|
||||||
it('Should add the file 1 by asking pod 3', function (done) {
|
it('Should add the file 1 by asking pod 3', function (done) {
|
||||||
// Yes, this could be long
|
// Yes, this could be long
|
||||||
this.timeout(60000)
|
this.timeout(200000)
|
||||||
|
|
||||||
getVideosList(urls[2], function (err, res) {
|
getVideosList(urls[2], function (err, res) {
|
||||||
if (err) throw err
|
if (err) throw err
|
||||||
@ -232,15 +232,13 @@
|
|||||||
|
|
||||||
it('Should add the file 2 by asking pod 1', function (done) {
|
it('Should add the file 2 by asking pod 1', function (done) {
|
||||||
// Yes, this could be long
|
// Yes, this could be long
|
||||||
this.timeout(60000)
|
this.timeout(200000)
|
||||||
|
|
||||||
getVideosList(urls[0], function (err, res) {
|
getVideosList(urls[0], function (err, res) {
|
||||||
if (err) throw err
|
if (err) throw err
|
||||||
|
|
||||||
var video = res.body[1]
|
var video = res.body[1]
|
||||||
|
|
||||||
video_id = video._id
|
|
||||||
|
|
||||||
webtorrent.add(video.magnetUri, function (torrent) {
|
webtorrent.add(video.magnetUri, function (torrent) {
|
||||||
expect(torrent.files).to.exist
|
expect(torrent.files).to.exist
|
||||||
expect(torrent.files.length).to.equal(1)
|
expect(torrent.files.length).to.equal(1)
|
||||||
@ -253,12 +251,13 @@
|
|||||||
|
|
||||||
it('Should add the file 3 by asking pod 2', function (done) {
|
it('Should add the file 3 by asking pod 2', function (done) {
|
||||||
// Yes, this could be long
|
// Yes, this could be long
|
||||||
this.timeout(60000)
|
this.timeout(200000)
|
||||||
|
|
||||||
getVideosList(urls[1], function (err, res) {
|
getVideosList(urls[1], function (err, res) {
|
||||||
if (err) throw err
|
if (err) throw err
|
||||||
|
|
||||||
var video = res.body[2]
|
var video = res.body[2]
|
||||||
|
video_id = res.body[1]._id
|
||||||
|
|
||||||
webtorrent.add(video.magnetUri, function (torrent) {
|
webtorrent.add(video.magnetUri, function (torrent) {
|
||||||
expect(torrent.files).to.exist
|
expect(torrent.files).to.exist
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
app = app1
|
app = app1
|
||||||
url = url1
|
url = url1
|
||||||
|
|
||||||
webtorrent.create(function () {
|
webtorrent.create({ host: 'client', port: '1' }, function () {
|
||||||
done()
|
done()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user