mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-04 10:19:35 +02:00
Add tests for thumbnails
This commit is contained in:
parent
cbe2f7c348
commit
9e5f374090
9 changed files with 85 additions and 15 deletions
|
@ -3,6 +3,7 @@
|
|||
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')
|
||||
|
||||
|
@ -19,6 +20,7 @@ const testUtils = {
|
|||
flushAndRunMultipleServers: flushAndRunMultipleServers,
|
||||
runServer: runServer,
|
||||
searchVideo: searchVideo,
|
||||
testImage: testImage,
|
||||
uploadVideo: uploadVideo
|
||||
}
|
||||
|
||||
|
@ -252,6 +254,21 @@ function searchVideo (url, search, end) {
|
|||
.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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue