Fix video update test

pull/71/head
Chocobozzz 2017-06-12 21:31:58 +02:00
parent 75d612ce3c
commit c3d19a4907
2 changed files with 16 additions and 19 deletions

View File

@ -356,7 +356,7 @@ function updateVideo (req: express.Request, res: express.Response, finalCallback
return rollbackTransaction(err, t, finalCallback) return rollbackTransaction(err, t, finalCallback)
} }
logger.info('Video with name %s updated.', videoInfosToUpdate.name) logger.info('Video with name %s updated.', videoInstance.name)
return finalCallback(null) return finalCallback(null)
}) })
} }

View File

@ -272,26 +272,23 @@ function updateVideo (url, accessToken, id, attributes, specialStatus, end) {
} }
const path = '/api/v1/videos/' + id const path = '/api/v1/videos/' + id
const body = {}
const req = request(url) if (attributes.name) body.name = attributes.name
.put(path) if (attributes.category) body.category = attributes.category
.set('Accept', 'application/json') if (attributes.licence) body.licence = attributes.licence
.set('Authorization', 'Bearer ' + accessToken) if (attributes.language) body.language = attributes.language
if (attributes.nsfw) body.nsfw = attributes.nsfw
if (attributes.description) body.description = attributes.description
if (attributes.tags) body.tags = attributes.tags
if (attributes.name) req.field('name', attributes.name) request(url)
if (attributes.category) req.field('category', attributes.category) .put(path)
if (attributes.licence) req.field('licence', attributes.licence) .send(body)
if (attributes.language) req.field('language', attributes.language) .set('Accept', 'application/json')
if (attributes.nsfw) req.field('nsfw', attributes.nsfw) .set('Authorization', 'Bearer ' + accessToken)
if (attributes.description) req.field('description', attributes.description) .expect(specialStatus)
.end(end)
if (attributes.tags) {
for (let i = 0; i < attributes.tags.length; i++) {
req.field('tags[' + i + ']', attributes.tags[i])
}
}
req.expect(specialStatus).end(end)
} }
function rateVideo (url, accessToken, id, rating, specialStatus, end) { function rateVideo (url, accessToken, id, rating, specialStatus, end) {