diff options
Diffstat (limited to 'server/tests/api/utils.js')
-rw-r--r-- | server/tests/api/utils.js | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/server/tests/api/utils.js b/server/tests/api/utils.js index c6430c930..e0068eada 100644 --- a/server/tests/api/utils.js +++ b/server/tests/api/utils.js | |||
@@ -349,7 +349,7 @@ function testImage (url, videoName, imagePath, callback) { | |||
349 | }) | 349 | }) |
350 | } | 350 | } |
351 | 351 | ||
352 | function uploadVideo (url, accessToken, name, description, fixture, specialStatus, end) { | 352 | function uploadVideo (url, accessToken, name, description, tags, fixture, specialStatus, end) { |
353 | if (!end) { | 353 | if (!end) { |
354 | end = specialStatus | 354 | end = specialStatus |
355 | specialStatus = 204 | 355 | specialStatus = 204 |
@@ -357,15 +357,20 @@ function uploadVideo (url, accessToken, name, description, fixture, specialStatu | |||
357 | 357 | ||
358 | const path = '/api/v1/videos' | 358 | const path = '/api/v1/videos' |
359 | 359 | ||
360 | request(url) | 360 | const req = request(url) |
361 | .post(path) | 361 | .post(path) |
362 | .set('Accept', 'application/json') | 362 | .set('Accept', 'application/json') |
363 | .set('Authorization', 'Bearer ' + accessToken) | 363 | .set('Authorization', 'Bearer ' + accessToken) |
364 | .field('name', name) | 364 | .field('name', name) |
365 | .field('description', description) | 365 | .field('description', description) |
366 | .attach('videofile', pathUtils.join(__dirname, 'fixtures', fixture)) | 366 | |
367 | .expect(specialStatus) | 367 | for (let i = 0; i < tags.length; i++) { |
368 | .end(end) | 368 | req.field('tags[' + i + ']', tags[i]) |
369 | } | ||
370 | |||
371 | req.attach('videofile', pathUtils.join(__dirname, 'fixtures', fixture)) | ||
372 | .expect(specialStatus) | ||
373 | .end(end) | ||
369 | } | 374 | } |
370 | 375 | ||
371 | // --------------------------------------------------------------------------- | 376 | // --------------------------------------------------------------------------- |