aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/real-world
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/real-world')
-rw-r--r--server/tests/real-world/real-world.js25
-rw-r--r--server/tests/real-world/tools/upload.js11
2 files changed, 23 insertions, 13 deletions
diff --git a/server/tests/real-world/real-world.js b/server/tests/real-world/real-world.js
index f17c83f85..32afeec68 100644
--- a/server/tests/real-world/real-world.js
+++ b/server/tests/real-world/real-world.js
@@ -200,15 +200,16 @@ function exitServers (servers, callback) {
200function upload (servers, numServer, callback) { 200function upload (servers, numServer, callback) {
201 if (!callback) callback = function () {} 201 if (!callback) callback = function () {}
202 202
203 const name = Date.now() + ' name'
204 const category = 4
205 const description = Date.now() + ' description'
206 const tags = [ Date.now().toString().substring(0, 5) + 't1', Date.now().toString().substring(0, 5) + 't2' ]
207 const file = 'video_short1.webm'
208
209 console.log('Uploading video to server ' + numServer) 203 console.log('Uploading video to server ' + numServer)
210 204
211 videosUtils.uploadVideo(servers[numServer].url, servers[numServer].accessToken, name, category, description, tags, file, callback) 205 const videoAttributes = {
206 name: Date.now() + ' name',
207 category: 4,
208 description: Date.now() + ' description',
209 tags: [ Date.now().toString().substring(0, 5) + 't1', Date.now().toString().substring(0, 5) + 't2' ],
210 fixture: 'video_short1.webm'
211 }
212 videosUtils.uploadVideo(servers[numServer].url, servers[numServer].accessToken, videoAttributes, callback)
212} 213}
213 214
214function update (servers, numServer, callback) { 215function update (servers, numServer, callback) {
@@ -221,13 +222,15 @@ function update (servers, numServer, callback) {
221 if (videos.length === 0) return callback() 222 if (videos.length === 0) return callback()
222 223
223 const toUpdate = videos[getRandomInt(0, videos.length)].id 224 const toUpdate = videos[getRandomInt(0, videos.length)].id
224 const name = Date.now() + ' name' 225 const attributes = {
225 const description = Date.now() + ' description' 226 name: Date.now() + ' name',
226 const tags = [ Date.now().toString().substring(0, 5) + 't1', Date.now().toString().substring(0, 5) + 't2' ] 227 description: Date.now() + ' description',
228 tags: [ Date.now().toString().substring(0, 5) + 't1', Date.now().toString().substring(0, 5) + 't2' ]
229 }
227 230
228 console.log('Updating video of server ' + numServer) 231 console.log('Updating video of server ' + numServer)
229 232
230 videosUtils.updateVideo(servers[numServer].url, servers[numServer].accessToken, toUpdate, name, description, tags, callback) 233 videosUtils.updateVideo(servers[numServer].url, servers[numServer].accessToken, toUpdate, attributes, callback)
231 }) 234 })
232} 235}
233 236
diff --git a/server/tests/real-world/tools/upload.js b/server/tests/real-world/tools/upload.js
index 49076ee2a..856251c7f 100644
--- a/server/tests/real-world/tools/upload.js
+++ b/server/tests/real-world/tools/upload.js
@@ -49,10 +49,17 @@ function list (val) {
49 return val.split(',') 49 return val.split(',')
50} 50}
51 51
52function upload (url, accessToken, name, category, description, tags, file) { 52function upload (url, accessToken, name, category, description, tags, fixture) {
53 console.log('Uploading %s video...', program.name) 53 console.log('Uploading %s video...', program.name)
54 54
55 utils.uploadVideo(url, accessToken, name, category, description, tags, file, function (err) { 55 const videoAttributes = {
56 name,
57 category,
58 description,
59 tags,
60 fixture
61 }
62 utils.uploadVideo(url, accessToken, videoAttributes, function (err) {
56 if (err) throw err 63 if (err) throw err
57 64
58 console.log('Video uploaded.') 65 console.log('Video uploaded.')