diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-06-12 21:31:58 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-06-12 21:37:56 +0200 |
commit | c3d19a49070aedb0e9accedf46465196b677406e (patch) | |
tree | 5e8512df3a9debfe2b4119249e249c815a74c1ca /server/tests | |
parent | 75d612ce3ca9d6f69fe8e4e83dc3070d9ab56615 (diff) | |
download | PeerTube-c3d19a49070aedb0e9accedf46465196b677406e.tar.gz PeerTube-c3d19a49070aedb0e9accedf46465196b677406e.tar.zst PeerTube-c3d19a49070aedb0e9accedf46465196b677406e.zip |
Fix video update test
Diffstat (limited to 'server/tests')
-rw-r--r-- | server/tests/utils/videos.js | 33 |
1 files changed, 15 insertions, 18 deletions
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 | ||
297 | function rateVideo (url, accessToken, id, rating, specialStatus, end) { | 294 | function rateVideo (url, accessToken, id, rating, specialStatus, end) { |