1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-06 03:50:26 +02:00

Server: Add some cli tools to make it easy to upload a lot of videos

This commit is contained in:
Chocobozzz 2016-07-20 19:16:00 +02:00
parent 2bd3f17127
commit 677618d4a6
4 changed files with 188 additions and 1 deletions

View file

@ -11,6 +11,7 @@ const testUtils = {
dateIsValid: dateIsValid,
flushTests: flushTests,
getAllVideosListBy: getAllVideosListBy,
getClient: getClient,
getFriendsList: getFriendsList,
getVideo: getVideo,
getVideosList: getVideosList,
@ -60,6 +61,17 @@ function getAllVideosListBy (url, end) {
.end(end)
}
function getClient (url, end) {
const path = '/api/v1/users/client'
request(url)
.get(path)
.set('Accept', 'application/json')
.expect(200)
.expect('Content-Type', /json/)
.end(end)
}
function getFriendsList (url, end) {
const path = '/api/v1/pods/'
@ -390,7 +402,14 @@ function uploadVideo (url, accessToken, name, description, tags, fixture, specia
req.field('tags[' + i + ']', tags[i])
}
req.attach('videofile', pathUtils.join(__dirname, 'fixtures', fixture))
let filepath = ''
if (pathUtils.isAbsolute(fixture)) {
filepath = fixture
} else {
filepath = pathUtils.join(__dirname, 'fixtures', fixture)
}
req.attach('videofile', filepath)
.expect(specialStatus)
.end(end)
}