]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/api/utils.js
Change name of fields for add video api
[github/Chocobozzz/PeerTube.git] / server / tests / api / utils.js
index 05142085f148c3199f249abb294417b19c4f3c0f..1b2f6105949b7f7710988e3e431c247157cc40e5 100644 (file)
@@ -9,6 +9,7 @@ const request = require('supertest')
 const testUtils = {
   flushTests: flushTests,
   getFriendsList: getFriendsList,
+  getVideo: getVideo,
   getVideosList: getVideosList,
   makeFriends: makeFriends,
   quitFriends: quitFriends,
@@ -36,6 +37,17 @@ function getFriendsList (url, end) {
     .end(end)
 }
 
+function getVideo (url, id, end) {
+  const path = '/api/v1/videos/' + id
+
+  request(url)
+    .get(path)
+    .set('Accept', 'application/json')
+    .expect(200)
+    .expect('Content-Type', /json/)
+    .end(end)
+}
+
 function getVideosList (url, end) {
   const path = '/api/v1/videos'
 
@@ -173,7 +185,7 @@ function uploadVideo (url, name, description, fixture, end) {
     .set('Accept', 'application/json')
     .field('name', name)
     .field('description', description)
-    .attach('input_video', pathUtils.join(__dirname, 'fixtures', fixture))
+    .attach('videofile', pathUtils.join(__dirname, 'fixtures', fixture))
     .expect(204)
     .end(end)
 }