]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/real-world/real-world.js
Server: refractoring upload/update video test utils
[github/Chocobozzz/PeerTube.git] / server / tests / real-world / real-world.js
index 239b790ae0d0bab87a063f1e19a5af8047271b04..32afeec68d0b8f4f437307a3472d44072fe60bd7 100644 (file)
@@ -200,14 +200,16 @@ function exitServers (servers, callback) {
 function upload (servers, numServer, callback) {
   if (!callback) callback = function () {}
 
-  const name = Date.now() + ' name'
-  const description = Date.now() + ' description'
-  const tags = [ Date.now().toString().substring(0, 5) + 't1', Date.now().toString().substring(0, 5) + 't2' ]
-  const file = 'video_short1.webm'
-
   console.log('Uploading video to server ' + numServer)
 
-  videosUtils.uploadVideo(servers[numServer].url, servers[numServer].accessToken, name, description, tags, file, callback)
+  const videoAttributes = {
+    name: Date.now() + ' name',
+    category: 4,
+    description: Date.now() + ' description',
+    tags: [ Date.now().toString().substring(0, 5) + 't1', Date.now().toString().substring(0, 5) + 't2' ],
+    fixture: 'video_short1.webm'
+  }
+  videosUtils.uploadVideo(servers[numServer].url, servers[numServer].accessToken, videoAttributes, callback)
 }
 
 function update (servers, numServer, callback) {
@@ -220,13 +222,15 @@ function update (servers, numServer, callback) {
     if (videos.length === 0) return callback()
 
     const toUpdate = videos[getRandomInt(0, videos.length)].id
-    const name = Date.now() + ' name'
-    const description = Date.now() + ' description'
-    const tags = [ Date.now().toString().substring(0, 5) + 't1', Date.now().toString().substring(0, 5) + 't2' ]
+    const attributes = {
+      name: Date.now() + ' name',
+      description: Date.now() + ' description',
+      tags: [ Date.now().toString().substring(0, 5) + 't1', Date.now().toString().substring(0, 5) + 't2' ]
+    }
 
     console.log('Updating video of server ' + numServer)
 
-    videosUtils.updateVideo(servers[numServer].url, servers[numServer].accessToken, toUpdate, name, description, tags, callback)
+    videosUtils.updateVideo(servers[numServer].url, servers[numServer].accessToken, toUpdate, attributes, callback)
   })
 }