aboutsummaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-06-12 21:31:58 +0200
committerChocobozzz <florian.bigard@gmail.com>2017-06-12 21:37:56 +0200
commitc3d19a49070aedb0e9accedf46465196b677406e (patch)
tree5e8512df3a9debfe2b4119249e249c815a74c1ca /server
parent75d612ce3ca9d6f69fe8e4e83dc3070d9ab56615 (diff)
downloadPeerTube-c3d19a49070aedb0e9accedf46465196b677406e.tar.gz
PeerTube-c3d19a49070aedb0e9accedf46465196b677406e.tar.zst
PeerTube-c3d19a49070aedb0e9accedf46465196b677406e.zip
Fix video update test
Diffstat (limited to 'server')
-rw-r--r--server/controllers/api/videos/index.ts2
-rw-r--r--server/tests/utils/videos.js33
2 files changed, 16 insertions, 19 deletions
diff --git a/server/controllers/api/videos/index.ts b/server/controllers/api/videos/index.ts
index 3b2ac4a6c..5e8cf2d25 100644
--- a/server/controllers/api/videos/index.ts
+++ b/server/controllers/api/videos/index.ts
@@ -356,7 +356,7 @@ function updateVideo (req: express.Request, res: express.Response, finalCallback
356 return rollbackTransaction(err, t, finalCallback) 356 return rollbackTransaction(err, t, finalCallback)
357 } 357 }
358 358
359 logger.info('Video with name %s updated.', videoInfosToUpdate.name) 359 logger.info('Video with name %s updated.', videoInstance.name)
360 return finalCallback(null) 360 return finalCallback(null)
361 }) 361 })
362} 362}
diff --git a/server/tests/utils/videos.js b/server/tests/utils/videos.js
index f0eeec497..6e7aabc5d 100644
--- a/server/tests/utils/videos.js
+++ b/server/tests/utils/videos.js
@@ -272,26 +272,23 @@ function updateVideo (url, accessToken, id, attributes, specialStatus, end) {
272 } 272 }
273 273
274 const path = '/api/v1/videos/' + id 274 const path = '/api/v1/videos/' + id
275 const body = {}
275 276
276 const req = request(url) 277 if (attributes.name) body.name = attributes.name
277 .put(path) 278 if (attributes.category) body.category = attributes.category
278 .set('Accept', 'application/json') 279 if (attributes.licence) body.licence = attributes.licence
279 .set('Authorization', 'Bearer ' + accessToken) 280 if (attributes.language) body.language = attributes.language
281 if (attributes.nsfw) body.nsfw = attributes.nsfw
282 if (attributes.description) body.description = attributes.description
283 if (attributes.tags) body.tags = attributes.tags
280 284
281 if (attributes.name) req.field('name', attributes.name) 285 request(url)
282 if (attributes.category) req.field('category', attributes.category) 286 .put(path)
283 if (attributes.licence) req.field('licence', attributes.licence) 287 .send(body)
284 if (attributes.language) req.field('language', attributes.language) 288 .set('Accept', 'application/json')
285 if (attributes.nsfw) req.field('nsfw', attributes.nsfw) 289 .set('Authorization', 'Bearer ' + accessToken)
286 if (attributes.description) req.field('description', attributes.description) 290 .expect(specialStatus)
287 291 .end(end)
288 if (attributes.tags) {
289 for (let i = 0; i < attributes.tags.length; i++) {
290 req.field('tags[' + i + ']', attributes.tags[i])
291 }
292 }
293
294 req.expect(specialStatus).end(end)
295} 292}
296 293
297function rateVideo (url, accessToken, id, rating, specialStatus, end) { 294function rateVideo (url, accessToken, id, rating, specialStatus, end) {