aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/utils.js
diff options
context:
space:
mode:
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}