From 677618d4a600a1678088d107850c8f1f8c95255f Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 20 Jul 2016 19:16:00 +0200 Subject: Server: Add some cli tools to make it easy to upload a lot of videos --- server/tests/api/utils.js | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'server/tests/api/utils.js') diff --git a/server/tests/api/utils.js b/server/tests/api/utils.js index 314269b5c..3cc769f26 100644 --- a/server/tests/api/utils.js +++ b/server/tests/api/utils.js @@ -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) } -- cgit v1.2.3