expect(video.magnetUri).to.equal.magnetUri
}
- callback()
+ utils.testImage(server.url, 'video_short1.webm', video.thumbnail_path, function (err, test) {
+ if (err) throw err
+ expect(test).to.equal(true)
+
+ callback()
+ })
})
}, done)
}
expect(video.magnetUri).to.equal.magnetUri
}
- callback()
+ utils.testImage(server.url, 'video_short2.webm', video.thumbnail_path, function (err, test) {
+ if (err) throw err
+ expect(test).to.equal(true)
+
+ callback()
+ })
})
}, done)
}
expect(video2.magnetUri).to.equal.magnetUri
}
- callback()
+ utils.testImage(server.url, 'video_short3.webm', video1.thumbnail_path, function (err, test) {
+ if (err) throw err
+ expect(test).to.equal(true)
+
+ utils.testImage(server.url, 'video_short.webm', video2.thumbnail_path, function (err, test) {
+ if (err) throw err
+ expect(test).to.equal(true)
+
+ callback()
+ })
+ })
})
}, done)
}
expect(video.author).to.equal('root')
expect(video.isLocal).to.be.true
- video_id = video.id
+ utils.testImage(server.url, 'video_short.webm', video.thumbnail_path, function (err, test) {
+ if (err) throw err
+ expect(test).to.equal(true)
- webtorrent.add(video.magnetUri, function (torrent) {
- expect(torrent.files).to.exist
- expect(torrent.files.length).to.equal(1)
- expect(torrent.files[0].path).to.exist.and.to.not.equal('')
+ video_id = video.id
- done()
+ webtorrent.add(video.magnetUri, function (torrent) {
+ expect(torrent.files).to.exist
+ expect(torrent.files.length).to.equal(1)
+ expect(torrent.files[0].path).to.exist.and.to.not.equal('')
+
+ done()
+ })
})
})
})
expect(video.author).to.equal('root')
expect(video.isLocal).to.be.true
- webtorrent.add(video.magnetUri, function (torrent) {
- expect(torrent.files).to.exist
- expect(torrent.files.length).to.equal(1)
- expect(torrent.files[0].path).to.exist.and.to.not.equal('')
+ utils.testImage(server.url, 'video_short.webm', video.thumbnail_path, function (err, test) {
+ if (err) throw err
+ expect(test).to.equal(true)
- done()
+ webtorrent.add(video.magnetUri, function (torrent) {
+ expect(torrent.files).to.exist
+ expect(torrent.files.length).to.equal(1)
+ expect(torrent.files[0].path).to.exist.and.to.not.equal('')
+
+ done()
+ })
})
})
})
expect(video.author).to.equal('root')
expect(video.isLocal).to.be.true
- done()
+ utils.testImage(server.url, 'video_short.webm', video.thumbnail_path, function (err, test) {
+ if (err) throw err
+ expect(test).to.equal(true)
+
+ done()
+ })
})
})
})
})
+ it('Should have the correct thumbnails', function (done) {
+ utils.getVideosList(server.url, function (err, res) {
+ const videos = res.body
+
+ async.each(videos, function (video, callback_each) {
+ if (err) throw err
+ const video_name = video.name.replace(' name', '')
+
+ utils.testImage(server.url, video_name, video.thumbnail_path, function (err, test) {
+ if (err) throw err
+
+ expect(test).to.equal(true)
+ callback_each()
+ })
+ }, done)
+ })
+ })
+
after(function (done) {
process.kill(-server.app.pid)
process.kill(-webtorrent.app.pid)
const child_process = require('child_process')
const exec = child_process.exec
const fork = child_process.fork
+const fs = require('fs')
const pathUtils = require('path')
const request = require('supertest')
flushAndRunMultipleServers: flushAndRunMultipleServers,
runServer: runServer,
searchVideo: searchVideo,
+ testImage: testImage,
uploadVideo: uploadVideo
}
.end(end)
}
+function testImage (url, video_name, image_path, callback) {
+ request(url)
+ .get(image_path)
+ .expect(200)
+ .end(function (err, res) {
+ if (err) return callback(err)
+
+ fs.readFile(pathUtils.join(__dirname, 'fixtures', video_name + '.jpg'), function (err, data) {
+ if (err) return callback(err)
+
+ callback(null, data.equals(res.body))
+ })
+ })
+}
+
function uploadVideo (url, access_token, name, description, fixture, special_status, end) {
if (!end) {
end = special_status