aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/utils.js
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-07-20 19:16:00 +0200
committerChocobozzz <florian.bigard@gmail.com>2016-07-20 19:16:00 +0200
commit677618d4a600a1678088d107850c8f1f8c95255f (patch)
treeb0ea636094a7a6c8188757bcd2a68ce1231e3d6f /server/tests/api/utils.js
parent2bd3f171270aff9717a55f2b89757fe966911af3 (diff)
downloadPeerTube-677618d4a600a1678088d107850c8f1f8c95255f.tar.gz
PeerTube-677618d4a600a1678088d107850c8f1f8c95255f.tar.zst
PeerTube-677618d4a600a1678088d107850c8f1f8c95255f.zip
Server: Add some cli tools to make it easy to upload a lot of videos
Diffstat (limited to 'server/tests/api/utils.js')
-rw-r--r--server/tests/api/utils.js21
1 files changed, 20 insertions, 1 deletions
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 = {
11 dateIsValid: dateIsValid, 11 dateIsValid: dateIsValid,
12 flushTests: flushTests, 12 flushTests: flushTests,
13 getAllVideosListBy: getAllVideosListBy, 13 getAllVideosListBy: getAllVideosListBy,
14 getClient: getClient,
14 getFriendsList: getFriendsList, 15 getFriendsList: getFriendsList,
15 getVideo: getVideo, 16 getVideo: getVideo,
16 getVideosList: getVideosList, 17 getVideosList: getVideosList,
@@ -60,6 +61,17 @@ function getAllVideosListBy (url, end) {
60 .end(end) 61 .end(end)
61} 62}
62 63
64function getClient (url, end) {
65 const path = '/api/v1/users/client'
66
67 request(url)
68 .get(path)
69 .set('Accept', 'application/json')
70 .expect(200)
71 .expect('Content-Type', /json/)
72 .end(end)
73}
74
63function getFriendsList (url, end) { 75function getFriendsList (url, end) {
64 const path = '/api/v1/pods/' 76 const path = '/api/v1/pods/'
65 77
@@ -390,7 +402,14 @@ function uploadVideo (url, accessToken, name, description, tags, fixture, specia
390 req.field('tags[' + i + ']', tags[i]) 402 req.field('tags[' + i + ']', tags[i])
391 } 403 }
392 404
393 req.attach('videofile', pathUtils.join(__dirname, 'fixtures', fixture)) 405 let filepath = ''
406 if (pathUtils.isAbsolute(fixture)) {
407 filepath = fixture
408 } else {
409 filepath = pathUtils.join(__dirname, 'fixtures', fixture)
410 }
411
412 req.attach('videofile', filepath)
394 .expect(specialStatus) 413 .expect(specialStatus)
395 .end(end) 414 .end(end)
396} 415}