"scripty": "^1.5.0",
"segfault-handler": "^1.0.0",
"ursa": "^0.9.1",
- "validator": "^5.0.0",
"webtorrent": "^0.93.2",
"winston": "^2.1.1",
"ws": "^1.0.1"
magnetUri: torrent.magnetURI,
author: res.locals.oauth.token.user.username,
duration: videoFile.duration,
- thumbnail: thumbnailName
+ thumbnail: thumbnailName,
+ tags: videoInfos.tags
}
Videos.add(videoData, function (err, insertedVideo) {
return callback(null)
}
- ], function (err) {
+ ], function andFinally (err) {
if (err) {
logger.error('Cannot insert the video.')
return next(err)
return callback(null)
}
- ], function (err) {
+ ], function andFinally (err) {
if (err) {
logger.error('Errors when removed the video.', { error: err })
return next(err)
magnetUri: videoObj.magnetUri,
author: videoObj.author,
duration: videoObj.duration,
+ tags: videoObj.tags,
thumbnailPath: constants.THUMBNAILS_STATIC_PATH + '/' + videoObj.thumbnail,
createdDate: videoObj.createdDate
}
'use strict'
-const validator = require('validator')
+const validator = require('express-validator').validator
const constants = require('../initializers/constants')
+const VIDEOS_CONSTRAINTS_FIELDS = constants.VIDEOS_CONSTRAINTS_FIELDS
const customValidators = {
- eachIsRemoteVideosAddValid: eachIsRemoteVideosAddValid,
- eachIsRemoteVideosRemoveValid: eachIsRemoteVideosRemoveValid,
- isArray: isArray
-}
-
-function eachIsRemoteVideosAddValid (values) {
- return values.every(function (val) {
- return validator.isLength(val.name, 1, 50) &&
- validator.isLength(val.description, 1, 50) &&
- validator.isLength(val.magnetUri, 10) &&
- validator.isURL(val.podUrl) &&
- !isNaN(val.duration) &&
- val.duration >= 0 &&
- val.duration < constants.MAXIMUM_VIDEO_DURATION &&
- validator.isLength(val.author, 1, constants.MAXIMUM_AUTHOR_LENGTH) &&
- validator.isBase64(val.thumbnailBase64) &&
- validator.isByteLength(val.thumbnailBase64, { min: 0, max: 20000 }) &&
- validator.isDate(val.createdDate)
+ exists: exists,
+ isEachAddRemoteVideosValid: isEachAddRemoteVideosValid,
+ isEachRemoveRemoteVideosValid: isEachRemoveRemoteVideosValid,
+ isArray: isArray,
+ isVideoAuthorValid: isVideoAuthorValid,
+ isVideoDateValid: isVideoDateValid,
+ isVideoDescriptionValid: isVideoDescriptionValid,
+ isVideoDurationValid: isVideoDurationValid,
+ isVideoMagnetUriValid: isVideoMagnetUriValid,
+ isVideoNameValid: isVideoNameValid,
+ isVideoPodUrlValid: isVideoPodUrlValid,
+ isVideoTagsValid: isVideoTagsValid,
+ isVideoThumbnailValid: isVideoThumbnailValid
+}
+
+function exists (value) {
+ return value !== undefined && value !== null
+}
+
+function isEachAddRemoteVideosValid (videos) {
+ return videos.every(function (video) {
+ return isVideoAuthorValid(video.author) &&
+ isVideoDateValid(video.createdDate) &&
+ isVideoDescriptionValid(video.description) &&
+ isVideoDurationValid(video.duration) &&
+ isVideoMagnetUriValid(video.magnetUri) &&
+ isVideoNameValid(video.name) &&
+ isVideoPodUrlValid(video.podUrl) &&
+ isVideoTagsValid(video.tags) &&
+ isVideoThumbnailValid(video.thumbnailBase64)
})
}
-function eachIsRemoteVideosRemoveValid (values) {
- return values.every(function (val) {
- return validator.isLength(val.magnetUri, 10)
+function isEachRemoveRemoteVideosValid (videos) {
+ return videos.every(function (video) {
+ return isVideoMagnetUriValid(video.magnetUri)
})
}
return Array.isArray(value)
}
+function isVideoAuthorValid (value) {
+ return validator.isLength(value, VIDEOS_CONSTRAINTS_FIELDS.AUTHOR)
+}
+
+function isVideoDateValid (value) {
+ return validator.isDate(value)
+}
+
+function isVideoDescriptionValid (value) {
+ return validator.isLength(value, VIDEOS_CONSTRAINTS_FIELDS.DESCRIPTION)
+}
+
+function isVideoDurationValid (value) {
+ return validator.isInt(value + '', VIDEOS_CONSTRAINTS_FIELDS.DURATION)
+}
+
+function isVideoMagnetUriValid (value) {
+ return validator.isLength(value, VIDEOS_CONSTRAINTS_FIELDS.MAGNET_URI)
+}
+
+function isVideoNameValid (value) {
+ return validator.isLength(value, VIDEOS_CONSTRAINTS_FIELDS.NAME)
+}
+
+function isVideoPodUrlValid (value) {
+ return validator.isURL(value)
+}
+
+function isVideoTagsValid (tags) {
+ return isArray(tags) &&
+ validator.isInt(tags.length, VIDEOS_CONSTRAINTS_FIELDS.TAGS) &&
+ tags.every(function (tag) {
+ return validator.isAlphanumeric(tag) &&
+ validator.isLength(tag, VIDEOS_CONSTRAINTS_FIELDS.TAG)
+ })
+}
+
+function isVideoThumbnailValid (value) {
+ return validator.isBase64(value) &&
+ validator.isByteLength(value, VIDEOS_CONSTRAINTS_FIELDS.THUMBNAIL)
+}
+
// ---------------------------------------------------------------------------
module.exports = customValidators
+
+// ---------------------------------------------------------------------------
// Time to wait between requests to the friends (10 min)
let INTERVAL = 600000
-// Max length of the author username
-const MAXIMUM_AUTHOR_LENGTH = 20
-// 2 hours maximum for the duration of a video (in seconds)
-let MAXIMUM_VIDEO_DURATION = 7200
-
// Number of results by default for the pagination
const PAGINATION_COUNT_DEFAULT = 15
// Path for access to thumbnails with express router
const THUMBNAILS_STATIC_PATH = '/static/thumbnails'
+const VIDEOS_CONSTRAINTS_FIELDS = {
+ NAME: { min: 1, max: 50 }, // Length
+ DESCRIPTION: { min: 1, max: 250 }, // Length
+ MAGNET_URI: { min: 10 }, // Length
+ DURATION: { min: 1, max: 7200 }, // Number
+ AUTHOR: { min: 3, max: 20 }, // Length
+ TAGS: { min: 1, max: 3 }, // Number of total tags
+ TAG: { min: 2, max: 10 }, // Length
+ THUMBNAIL: { min: 0, max: 20000 } // Bytes
+}
+
// Special constants for a test instance
if (isTestInstance() === true) {
FRIEND_BASE_SCORE = 20
INTERVAL = 10000
- MAXIMUM_VIDEO_DURATION = 14
+ VIDEOS_CONSTRAINTS_FIELDS.DURATION.max = 14
REQUEST_RETRIES = 2
}
API_VERSION: API_VERSION,
FRIEND_BASE_SCORE: FRIEND_BASE_SCORE,
INTERVAL: INTERVAL,
- MAXIMUM_AUTHOR_LENGTH: MAXIMUM_AUTHOR_LENGTH,
- MAXIMUM_VIDEO_DURATION: MAXIMUM_VIDEO_DURATION,
PAGINATION_COUNT_DEFAULT: PAGINATION_COUNT_DEFAULT,
PODS_SCORE: PODS_SCORE,
REQUEST_RETRIES: REQUEST_RETRIES,
SEARCHABLE_COLUMNS: SEARCHABLE_COLUMNS,
SORTABLE_COLUMNS: SORTABLE_COLUMNS,
THUMBNAILS_SIZE: THUMBNAILS_SIZE,
- THUMBNAILS_STATIC_PATH: THUMBNAILS_STATIC_PATH
+ THUMBNAILS_STATIC_PATH: THUMBNAILS_STATIC_PATH,
+ VIDEOS_CONSTRAINTS_FIELDS: VIDEOS_CONSTRAINTS_FIELDS
}
// ---------------------------------------------------------------------------
magnetUri: video.magnetUri,
podUrl: video.podUrl,
duration: video.duration,
- thumbnail: thumbnailName
+ thumbnail: thumbnailName,
+ tags: video.tags
}
remoteVideos.push(params)
function remoteVideosAdd (req, res, next) {
req.checkBody('data').isArray()
- req.checkBody('data').eachIsRemoteVideosAddValid()
+ req.checkBody('data').isEachAddRemoteVideosValid()
logger.debug('Checking remoteVideosAdd parameters', { parameters: req.body })
function remoteVideosRemove (req, res, next) {
req.checkBody('data').isArray()
- req.checkBody('data').eachIsRemoteVideosRemoveValid()
+ req.checkBody('data').isEachRemoveRemoteVideosValid()
logger.debug('Checking remoteVideosRemove parameters', { parameters: req.body })
const checkErrors = require('./utils').checkErrors
const constants = require('../../initializers/constants')
+const customValidators = require('../../helpers/customValidators')
const logger = require('../../helpers/logger')
const videos = require('../../lib/videos')
const Videos = require('../../models/videos')
function videosAdd (req, res, next) {
req.checkFiles('videofile[0].originalname', 'Should have an input video').notEmpty()
req.checkFiles('videofile[0].mimetype', 'Should have a correct mime type').matches(/video\/(webm)|(mp4)|(ogg)/i)
- req.checkBody('name', 'Should have a name').isLength(1, 50)
- req.checkBody('description', 'Should have a description').isLength(1, 250)
+ req.checkBody('name', 'Should have a valid name').isVideoNameValid()
+ req.checkBody('description', 'Should have a valid description').isVideoDescriptionValid()
+ req.checkBody('tags', 'Should have correct tags').isVideoTagsValid()
logger.debug('Checking videosAdd parameters', { parameters: req.body, files: req.files })
return res.status(400).send('Cannot retrieve metadata of the file.')
}
- if (duration > constants.MAXIMUM_VIDEO_DURATION) {
+ if (!customValidators.isVideoDurationValid(duration)) {
return res.status(400).send('Duration of the video file is too big (max: ' + constants.MAXIMUM_VIDEO_DURATION + 's).')
}
Videos.get(req.params.id, function (err, video) {
if (err) {
logger.error('Error in videosGet request validator.', { error: err })
- res.sendStatus(500)
+ return res.sendStatus(500)
}
const state = videos.getVideoState(video)
Videos.get(req.params.id, function (err, video) {
if (err) {
logger.error('Error in videosRemove request validator.', { error: err })
- res.sendStatus(500)
+ return res.sendStatus(500)
}
const state = videos.getVideoState(video)
function videosSearch (req, res, next) {
const searchableColumns = constants.SEARCHABLE_COLUMNS.VIDEOS
- req.checkParams('value', 'Should have a name').notEmpty()
+ req.checkParams('value', 'Should have a valid search').notEmpty()
req.checkQuery('field', 'Should have correct searchable column').optional().isIn(searchableColumns)
logger.debug('Checking videosSearch parameters', { parameters: req.params })
author: String,
duration: Number,
thumbnail: String,
+ tags: [ String ],
createdDate: {
type: Date,
default: Date.now
Object.keys(fields).forEach(function (field) {
const value = fields[field]
- req.field(field, value)
+
+ if (Array.isArray(value)) {
+ for (let i = 0; i < value.length; i++) {
+ req.field(field + '[' + i + ']', value[i])
+ }
+ } else {
+ req.field(field, value)
+ }
})
Object.keys(attaches).forEach(function (attach) {
it('Should fail without name', function (done) {
const data = {
- description: 'my super description'
+ description: 'my super description',
+ tags: [ 'tag1', 'tag2' ]
}
const attach = {
'videofile': pathUtils.join(__dirname, 'fixtures', 'video_short.webm')
it('Should fail with a long name', function (done) {
const data = {
name: 'My very very very very very very very very very very very very very very very very long name',
- description: 'my super description'
+ description: 'my super description',
+ tags: [ 'tag1', 'tag2' ]
}
const attach = {
'videofile': pathUtils.join(__dirname, 'fixtures', 'video_short.webm')
it('Should fail without description', function (done) {
const data = {
- name: 'my super name'
+ name: 'my super name',
+ tags: [ 'tag1', 'tag2' ]
}
const attach = {
'videofile': pathUtils.join(__dirname, 'fixtures', 'video_short.webm')
name: 'my super name',
description: 'my super description which is very very very very very very very very very very very very very very' +
'very very very very very very very very very very very very very very very very very very very very very' +
- 'very very very very very very very very very very very very very very very long'
+ 'very very very very very very very very very very very very very very very long',
+ tags: [ 'tag1', 'tag2' ]
}
const attach = {
'videofile': pathUtils.join(__dirname, 'fixtures', 'video_short.webm')
makePostRequest(path, server.accessToken, data, attach, done)
})
- it('Should fail without an input file', function (done) {
+ it('Should fail without tags', function (done) {
const data = {
name: 'my super name',
description: 'my super description'
}
+ const attach = {
+ 'videofile': pathUtils.join(__dirname, 'fixtures', 'video_short.webm')
+ }
+ makePostRequest(path, server.accessToken, data, attach, done)
+ })
+
+ it('Should fail with too many tags', function (done) {
+ const data = {
+ name: 'my super name',
+ description: 'my super description',
+ tags: [ 'tag1', 'tag2', 'tag3', 'tag4' ]
+ }
+ const attach = {
+ 'videofile': pathUtils.join(__dirname, 'fixtures', 'video_short.webm')
+ }
+ makePostRequest(path, server.accessToken, data, attach, done)
+ })
+
+ it('Should fail with not enough tags', function (done) {
+ const data = {
+ name: 'my super name',
+ description: 'my super description',
+ tags: [ ]
+ }
+ const attach = {
+ 'videofile': pathUtils.join(__dirname, 'fixtures', 'video_short.webm')
+ }
+ makePostRequest(path, server.accessToken, data, attach, done)
+ })
+
+ it('Should fail with a tag length too low', function (done) {
+ const data = {
+ name: 'my super name',
+ description: 'my super description',
+ tags: [ 'tag1', 't' ]
+ }
+ const attach = {
+ 'videofile': pathUtils.join(__dirname, 'fixtures', 'video_short.webm')
+ }
+ makePostRequest(path, server.accessToken, data, attach, done)
+ })
+
+ it('Should fail with a tag length too big', function (done) {
+ const data = {
+ name: 'my super name',
+ description: 'my super description',
+ tags: [ 'mysupertagtoolong', 'tag1' ]
+ }
+ const attach = {
+ 'videofile': pathUtils.join(__dirname, 'fixtures', 'video_short.webm')
+ }
+ makePostRequest(path, server.accessToken, data, attach, done)
+ })
+
+ it('Should fail with malformed tags', function (done) {
+ const data = {
+ name: 'my super name',
+ description: 'my super description',
+ tags: [ 'my tag' ]
+ }
+ const attach = {
+ 'videofile': pathUtils.join(__dirname, 'fixtures', 'video_short.webm')
+ }
+ makePostRequest(path, server.accessToken, data, attach, done)
+ })
+
+ it('Should fail without an input file', function (done) {
+ const data = {
+ name: 'my super name',
+ description: 'my super description',
+ tags: [ 'tag1', 'tag2' ]
+ }
const attach = {}
makePostRequest(path, server.accessToken, data, attach, done)
})
it('Should fail without an incorrect input file', function (done) {
const data = {
name: 'my super name',
- description: 'my super description'
+ description: 'my super description',
+ tags: [ 'tag1', 'tag2' ]
}
const attach = {
'videofile': pathUtils.join(__dirname, 'fixtures', 'video_short_fake.webm')
it('Should fail with a too big duration', function (done) {
const data = {
name: 'my super name',
- description: 'my super description'
+ description: 'my super description',
+ tags: [ 'tag1', 'tag2' ]
}
const attach = {
'videofile': pathUtils.join(__dirname, 'fixtures', 'video_too_long.webm')
it('Should succeed with the correct parameters', function (done) {
const data = {
name: 'my super name',
- description: 'my super description'
+ description: 'my super description',
+ tags: [ 'tag1', 'tag2' ]
}
const attach = {
'videofile': pathUtils.join(__dirname, 'fixtures', 'video_short.webm')
function uploadVideo (podNumber, callback) {
const name = 'my super video'
const description = 'my super description'
+ const tags = [ 'tag1', 'tag2' ]
const fixture = 'video_short.webm'
const server = servers[podNumber - 1]
- return utils.uploadVideo(server.url, server.accessToken, name, description, fixture, callback)
+ return utils.uploadVideo(server.url, server.accessToken, name, description, tags, fixture, callback)
}
function getVideos (podNumber, callback) {
async.series([
function (next) {
- utils.uploadVideo(servers[0].url, servers[0].accessToken, 'my super name for pod 1', 'my super description for pod 1', 'video_short1.webm', next)
+ const name = 'my super name for pod 1'
+ const description = 'my super description for pod 1'
+ const tags = [ 'tag1p1', 'tag2p1' ]
+ const file = 'video_short1.webm'
+ utils.uploadVideo(servers[0].url, servers[0].accessToken, name, description, tags, file, next)
},
function (next) {
setTimeout(next, 11000)
expect(video.podUrl).to.equal('localhost:9001')
expect(video.magnetUri).to.exist
expect(video.duration).to.equal(10)
+ expect(video.tags).to.deep.equal([ 'tag1p1', 'tag2p1' ])
expect(utils.dateIsValid(video.createdDate)).to.be.true
if (server.url !== 'http://localhost:9001') {
async.series([
function (next) {
- utils.uploadVideo(servers[1].url, servers[1].accessToken, 'my super name for pod 2', 'my super description for pod 2', 'video_short2.webm', next)
+ const name = 'my super name for pod 2'
+ const description = 'my super description for pod 2'
+ const tags = [ 'tag1p2', 'tag2p2', 'tag3p2' ]
+ const file = 'video_short2.webm'
+ utils.uploadVideo(servers[1].url, servers[1].accessToken, name, description, tags, file, next)
},
function (next) {
setTimeout(next, 11000)
expect(video.podUrl).to.equal('localhost:9002')
expect(video.magnetUri).to.exist
expect(video.duration).to.equal(5)
+ expect(video.tags).to.deep.equal([ 'tag1p2', 'tag2p2', 'tag3p2' ])
expect(utils.dateIsValid(video.createdDate)).to.be.true
if (server.url !== 'http://localhost:9002') {
async.series([
function (next) {
- utils.uploadVideo(servers[2].url, servers[2].accessToken, 'my super name for pod 3', 'my super description for pod 3', 'video_short3.webm', next)
+ const name = 'my super name for pod 3'
+ const description = 'my super description for pod 3'
+ const tags = [ 'tag1p3' ]
+ const file = 'video_short3.webm'
+ utils.uploadVideo(servers[2].url, servers[2].accessToken, name, description, tags, file, next)
},
function (next) {
- utils.uploadVideo(servers[2].url, servers[2].accessToken, 'my super name for pod 3-2', 'my super description for pod 3-2', 'video_short.webm', next)
+ const name = 'my super name for pod 3-2'
+ const description = 'my super description for pod 3-2'
+ const tags = [ 'tag2p3', 'tag3p3', 'tag4p3' ]
+ const file = 'video_short.webm'
+ utils.uploadVideo(servers[2].url, servers[2].accessToken, name, description, tags, file, next)
},
function (next) {
setTimeout(next, 22000)
expect(video1.podUrl).to.equal('localhost:9003')
expect(video1.magnetUri).to.exist
expect(video1.duration).to.equal(5)
+ expect(video1.tags).to.deep.equal([ 'tag1p3' ])
expect(utils.dateIsValid(video1.createdDate)).to.be.true
expect(video2.name).to.equal('my super name for pod 3-2')
expect(video2.podUrl).to.equal('localhost:9003')
expect(video2.magnetUri).to.exist
expect(video2.duration).to.equal(5)
+ expect(video2.tags).to.deep.equal([ 'tag2p3', 'tag3p3', 'tag4p3' ])
expect(utils.dateIsValid(video2.createdDate)).to.be.true
if (server.url !== 'http://localhost:9003') {
it('Should upload the video', function (done) {
this.timeout(5000)
- utils.uploadVideo(server.url, server.accessToken, 'my super name', 'my super description', 'video_short.webm', done)
+ const name = 'my super name'
+ const description = 'my super description'
+ const tags = [ 'tag1', 'tag2', 'tag3' ]
+ const file = 'video_short.webm'
+ utils.uploadVideo(server.url, server.accessToken, name, description, tags, file, done)
})
it('Should seed the uploaded video', function (done) {
expect(video.magnetUri).to.exist
expect(video.author).to.equal('root')
expect(video.isLocal).to.be.true
+ expect(video.tags).to.deep.equal([ 'tag1', 'tag2', 'tag3' ])
expect(utils.dateIsValid(video.createdDate)).to.be.true
utils.testImage(server.url, 'video_short.webm', video.thumbnailPath, function (err, test) {
expect(video.magnetUri).to.exist
expect(video.author).to.equal('root')
expect(video.isLocal).to.be.true
+ expect(video.tags).to.deep.equal([ 'tag1', 'tag2', 'tag3' ])
expect(utils.dateIsValid(video.createdDate)).to.be.true
utils.testImage(server.url, 'video_short.webm', video.thumbnailPath, function (err, test) {
expect(video.podUrl).to.equal('localhost:9001')
expect(video.author).to.equal('root')
expect(video.isLocal).to.be.true
+ expect(video.tags).to.deep.equal([ 'tag1', 'tag2', 'tag3' ])
expect(utils.dateIsValid(video.createdDate)).to.be.true
utils.testImage(server.url, 'video_short.webm', video.thumbnailPath, function (err, test) {
expect(video.podUrl).to.equal('localhost:9001')
expect(video.author).to.equal('root')
expect(video.isLocal).to.be.true
+ expect(video.tags).to.deep.equal([ 'tag1', 'tag2', 'tag3' ])
expect(utils.dateIsValid(video.createdDate)).to.be.true
utils.testImage(server.url, 'video_short.webm', video.thumbnailPath, function (err, test) {
'video_short1.webm', 'video_short2.webm', 'video_short3.webm'
]
async.each(videos, function (video, callbackEach) {
- utils.uploadVideo(server.url, server.accessToken, video + ' name', video + ' description', video, callbackEach)
+ const name = video + ' name'
+ const description = video + ' description'
+ const tags = [ 'tag1', 'tag2', 'tag3' ]
+
+ utils.uploadVideo(server.url, server.accessToken, name, description, tags, video, callbackEach)
}, done)
})
it('Should not be able to upload a video', function (done) {
accessToken = 'mysupertoken'
- utils.uploadVideo(server.url, accessToken, 'my super name', 'my super description', 'video_short.webm', 401, done)
+
+ const name = 'my super name'
+ const description = 'my super description'
+ const tags = [ 'tag1', 'tag2' ]
+ const video = 'video_short.webm'
+ utils.uploadVideo(server.url, accessToken, name, description, tags, video, 401, done)
})
it('Should not be able to make friends', function (done) {
})
it('Should upload the video with the correct token', function (done) {
- utils.uploadVideo(server.url, accessToken, 'my super name', 'my super description', 'video_short.webm', 204, function (err, res) {
+ const name = 'my super name'
+ const description = 'my super description'
+ const tags = [ 'tag1', 'tag2' ]
+ const video = 'video_short.webm'
+ utils.uploadVideo(server.url, accessToken, name, description, tags, video, 204, function (err, res) {
if (err) throw err
utils.getVideosList(server.url, function (err, res) {
})
it('Should upload the video again with the correct token', function (done) {
- utils.uploadVideo(server.url, accessToken, 'my super name 2', 'my super description 2', 'video_short.webm', 204, done)
+ const name = 'my super name 2'
+ const description = 'my super description 2'
+ const tags = [ 'tag1' ]
+ const video = 'video_short.webm'
+ utils.uploadVideo(server.url, accessToken, name, description, tags, video, 204, done)
})
it('Should not be able to remove the video with an incorrect token', function (done) {
})
}
-function uploadVideo (url, accessToken, name, description, fixture, specialStatus, end) {
+function uploadVideo (url, accessToken, name, description, tags, fixture, specialStatus, end) {
if (!end) {
end = specialStatus
specialStatus = 204
const path = '/api/v1/videos'
- request(url)
- .post(path)
- .set('Accept', 'application/json')
- .set('Authorization', 'Bearer ' + accessToken)
- .field('name', name)
- .field('description', description)
- .attach('videofile', pathUtils.join(__dirname, 'fixtures', fixture))
- .expect(specialStatus)
- .end(end)
+ const req = request(url)
+ .post(path)
+ .set('Accept', 'application/json')
+ .set('Authorization', 'Bearer ' + accessToken)
+ .field('name', name)
+ .field('description', description)
+
+ for (let i = 0; i < tags.length; i++) {
+ req.field('tags[' + i + ']', tags[i])
+ }
+
+ req.attach('videofile', pathUtils.join(__dirname, 'fixtures', fixture))
+ .expect(specialStatus)
+ .end(end)
}
// ---------------------------------------------------------------------------