aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-06-06 14:15:03 +0200
committerChocobozzz <florian.bigard@gmail.com>2016-06-06 14:15:03 +0200
commitbe587647f98a4b83ca06a61fe55c7ac5d60927c6 (patch)
tree8a28a1cb9c9a06d80803ecd3fa00aa6767bb3f8b /server/tests/api
parent8483b2216454afdb88f6aa53cad5eecd8c394bc0 (diff)
downloadPeerTube-be587647f98a4b83ca06a61fe55c7ac5d60927c6.tar.gz
PeerTube-be587647f98a4b83ca06a61fe55c7ac5d60927c6.tar.zst
PeerTube-be587647f98a4b83ca06a61fe55c7ac5d60927c6.zip
Add tags support to server
Diffstat (limited to 'server/tests/api')
-rw-r--r--server/tests/api/checkParams.js104
-rw-r--r--server/tests/api/friendsAdvanced.js3
-rw-r--r--server/tests/api/multiplePods.js28
-rw-r--r--server/tests/api/singlePod.js16
-rw-r--r--server/tests/api/users.js19
-rw-r--r--server/tests/api/utils.js25
6 files changed, 166 insertions, 29 deletions
diff --git a/server/tests/api/checkParams.js b/server/tests/api/checkParams.js
index e02fd0da5..95a7738f8 100644
--- a/server/tests/api/checkParams.js
+++ b/server/tests/api/checkParams.js
@@ -23,7 +23,14 @@ describe('Test parameters validator', function () {
23 23
24 Object.keys(fields).forEach(function (field) { 24 Object.keys(fields).forEach(function (field) {
25 const value = fields[field] 25 const value = fields[field]
26 req.field(field, value) 26
27 if (Array.isArray(value)) {
28 for (let i = 0; i < value.length; i++) {
29 req.field(field + '[' + i + ']', value[i])
30 }
31 } else {
32 req.field(field, value)
33 }
27 }) 34 })
28 35
29 Object.keys(attaches).forEach(function (attach) { 36 Object.keys(attaches).forEach(function (attach) {
@@ -198,7 +205,8 @@ describe('Test parameters validator', function () {
198 205
199 it('Should fail without name', function (done) { 206 it('Should fail without name', function (done) {
200 const data = { 207 const data = {
201 description: 'my super description' 208 description: 'my super description',
209 tags: [ 'tag1', 'tag2' ]
202 } 210 }
203 const attach = { 211 const attach = {
204 'videofile': pathUtils.join(__dirname, 'fixtures', 'video_short.webm') 212 'videofile': pathUtils.join(__dirname, 'fixtures', 'video_short.webm')
@@ -209,7 +217,8 @@ describe('Test parameters validator', function () {
209 it('Should fail with a long name', function (done) { 217 it('Should fail with a long name', function (done) {
210 const data = { 218 const data = {
211 name: 'My very very very very very very very very very very very very very very very very long name', 219 name: 'My very very very very very very very very very very very very very very very very long name',
212 description: 'my super description' 220 description: 'my super description',
221 tags: [ 'tag1', 'tag2' ]
213 } 222 }
214 const attach = { 223 const attach = {
215 'videofile': pathUtils.join(__dirname, 'fixtures', 'video_short.webm') 224 'videofile': pathUtils.join(__dirname, 'fixtures', 'video_short.webm')
@@ -219,7 +228,8 @@ describe('Test parameters validator', function () {
219 228
220 it('Should fail without description', function (done) { 229 it('Should fail without description', function (done) {
221 const data = { 230 const data = {
222 name: 'my super name' 231 name: 'my super name',
232 tags: [ 'tag1', 'tag2' ]
223 } 233 }
224 const attach = { 234 const attach = {
225 'videofile': pathUtils.join(__dirname, 'fixtures', 'video_short.webm') 235 'videofile': pathUtils.join(__dirname, 'fixtures', 'video_short.webm')
@@ -232,7 +242,8 @@ describe('Test parameters validator', function () {
232 name: 'my super name', 242 name: 'my super name',
233 description: 'my super description which is very very very very very very very very very very very very very very' + 243 description: 'my super description which is very very very very very very very very very very very very very very' +
234 'very very very very very very very very very very very very very very very very very very very very very' + 244 'very very very very very very very very very very very very very very very very very very very very very' +
235 'very very very very very very very very very very very very very very very long' 245 'very very very very very very very very very very very very very very very long',
246 tags: [ 'tag1', 'tag2' ]
236 } 247 }
237 const attach = { 248 const attach = {
238 'videofile': pathUtils.join(__dirname, 'fixtures', 'video_short.webm') 249 'videofile': pathUtils.join(__dirname, 'fixtures', 'video_short.webm')
@@ -240,11 +251,83 @@ describe('Test parameters validator', function () {
240 makePostRequest(path, server.accessToken, data, attach, done) 251 makePostRequest(path, server.accessToken, data, attach, done)
241 }) 252 })
242 253
243 it('Should fail without an input file', function (done) { 254 it('Should fail without tags', function (done) {
244 const data = { 255 const data = {
245 name: 'my super name', 256 name: 'my super name',
246 description: 'my super description' 257 description: 'my super description'
247 } 258 }
259 const attach = {
260 'videofile': pathUtils.join(__dirname, 'fixtures', 'video_short.webm')
261 }
262 makePostRequest(path, server.accessToken, data, attach, done)
263 })
264
265 it('Should fail with too many tags', function (done) {
266 const data = {
267 name: 'my super name',
268 description: 'my super description',
269 tags: [ 'tag1', 'tag2', 'tag3', 'tag4' ]
270 }
271 const attach = {
272 'videofile': pathUtils.join(__dirname, 'fixtures', 'video_short.webm')
273 }
274 makePostRequest(path, server.accessToken, data, attach, done)
275 })
276
277 it('Should fail with not enough tags', function (done) {
278 const data = {
279 name: 'my super name',
280 description: 'my super description',
281 tags: [ ]
282 }
283 const attach = {
284 'videofile': pathUtils.join(__dirname, 'fixtures', 'video_short.webm')
285 }
286 makePostRequest(path, server.accessToken, data, attach, done)
287 })
288
289 it('Should fail with a tag length too low', function (done) {
290 const data = {
291 name: 'my super name',
292 description: 'my super description',
293 tags: [ 'tag1', 't' ]
294 }
295 const attach = {
296 'videofile': pathUtils.join(__dirname, 'fixtures', 'video_short.webm')
297 }
298 makePostRequest(path, server.accessToken, data, attach, done)
299 })
300
301 it('Should fail with a tag length too big', function (done) {
302 const data = {
303 name: 'my super name',
304 description: 'my super description',
305 tags: [ 'mysupertagtoolong', 'tag1' ]
306 }
307 const attach = {
308 'videofile': pathUtils.join(__dirname, 'fixtures', 'video_short.webm')
309 }
310 makePostRequest(path, server.accessToken, data, attach, done)
311 })
312
313 it('Should fail with malformed tags', function (done) {
314 const data = {
315 name: 'my super name',
316 description: 'my super description',
317 tags: [ 'my tag' ]
318 }
319 const attach = {
320 'videofile': pathUtils.join(__dirname, 'fixtures', 'video_short.webm')
321 }
322 makePostRequest(path, server.accessToken, data, attach, done)
323 })
324
325 it('Should fail without an input file', function (done) {
326 const data = {
327 name: 'my super name',
328 description: 'my super description',
329 tags: [ 'tag1', 'tag2' ]
330 }
248 const attach = {} 331 const attach = {}
249 makePostRequest(path, server.accessToken, data, attach, done) 332 makePostRequest(path, server.accessToken, data, attach, done)
250 }) 333 })
@@ -252,7 +335,8 @@ describe('Test parameters validator', function () {
252 it('Should fail without an incorrect input file', function (done) { 335 it('Should fail without an incorrect input file', function (done) {
253 const data = { 336 const data = {
254 name: 'my super name', 337 name: 'my super name',
255 description: 'my super description' 338 description: 'my super description',
339 tags: [ 'tag1', 'tag2' ]
256 } 340 }
257 const attach = { 341 const attach = {
258 'videofile': pathUtils.join(__dirname, 'fixtures', 'video_short_fake.webm') 342 'videofile': pathUtils.join(__dirname, 'fixtures', 'video_short_fake.webm')
@@ -263,7 +347,8 @@ describe('Test parameters validator', function () {
263 it('Should fail with a too big duration', function (done) { 347 it('Should fail with a too big duration', function (done) {
264 const data = { 348 const data = {
265 name: 'my super name', 349 name: 'my super name',
266 description: 'my super description' 350 description: 'my super description',
351 tags: [ 'tag1', 'tag2' ]
267 } 352 }
268 const attach = { 353 const attach = {
269 'videofile': pathUtils.join(__dirname, 'fixtures', 'video_too_long.webm') 354 'videofile': pathUtils.join(__dirname, 'fixtures', 'video_too_long.webm')
@@ -274,7 +359,8 @@ describe('Test parameters validator', function () {
274 it('Should succeed with the correct parameters', function (done) { 359 it('Should succeed with the correct parameters', function (done) {
275 const data = { 360 const data = {
276 name: 'my super name', 361 name: 'my super name',
277 description: 'my super description' 362 description: 'my super description',
363 tags: [ 'tag1', 'tag2' ]
278 } 364 }
279 const attach = { 365 const attach = {
280 'videofile': pathUtils.join(__dirname, 'fixtures', 'video_short.webm') 366 'videofile': pathUtils.join(__dirname, 'fixtures', 'video_short.webm')
diff --git a/server/tests/api/friendsAdvanced.js b/server/tests/api/friendsAdvanced.js
index 7b895b6b5..86620254e 100644
--- a/server/tests/api/friendsAdvanced.js
+++ b/server/tests/api/friendsAdvanced.js
@@ -27,10 +27,11 @@ describe('Test advanced friends', function () {
27 function uploadVideo (podNumber, callback) { 27 function uploadVideo (podNumber, callback) {
28 const name = 'my super video' 28 const name = 'my super video'
29 const description = 'my super description' 29 const description = 'my super description'
30 const tags = [ 'tag1', 'tag2' ]
30 const fixture = 'video_short.webm' 31 const fixture = 'video_short.webm'
31 const server = servers[podNumber - 1] 32 const server = servers[podNumber - 1]
32 33
33 return utils.uploadVideo(server.url, server.accessToken, name, description, fixture, callback) 34 return utils.uploadVideo(server.url, server.accessToken, name, description, tags, fixture, callback)
34 } 35 }
35 36
36 function getVideos (podNumber, callback) { 37 function getVideos (podNumber, callback) {
diff --git a/server/tests/api/multiplePods.js b/server/tests/api/multiplePods.js
index dac6dd410..40326c260 100644
--- a/server/tests/api/multiplePods.js
+++ b/server/tests/api/multiplePods.js
@@ -75,7 +75,11 @@ describe('Test multiple pods', function () {
75 75
76 async.series([ 76 async.series([
77 function (next) { 77 function (next) {
78 utils.uploadVideo(servers[0].url, servers[0].accessToken, 'my super name for pod 1', 'my super description for pod 1', 'video_short1.webm', next) 78 const name = 'my super name for pod 1'
79 const description = 'my super description for pod 1'
80 const tags = [ 'tag1p1', 'tag2p1' ]
81 const file = 'video_short1.webm'
82 utils.uploadVideo(servers[0].url, servers[0].accessToken, name, description, tags, file, next)
79 }, 83 },
80 function (next) { 84 function (next) {
81 setTimeout(next, 11000) 85 setTimeout(next, 11000)
@@ -99,6 +103,7 @@ describe('Test multiple pods', function () {
99 expect(video.podUrl).to.equal('localhost:9001') 103 expect(video.podUrl).to.equal('localhost:9001')
100 expect(video.magnetUri).to.exist 104 expect(video.magnetUri).to.exist
101 expect(video.duration).to.equal(10) 105 expect(video.duration).to.equal(10)
106 expect(video.tags).to.deep.equal([ 'tag1p1', 'tag2p1' ])
102 expect(utils.dateIsValid(video.createdDate)).to.be.true 107 expect(utils.dateIsValid(video.createdDate)).to.be.true
103 108
104 if (server.url !== 'http://localhost:9001') { 109 if (server.url !== 'http://localhost:9001') {
@@ -131,7 +136,11 @@ describe('Test multiple pods', function () {
131 136
132 async.series([ 137 async.series([
133 function (next) { 138 function (next) {
134 utils.uploadVideo(servers[1].url, servers[1].accessToken, 'my super name for pod 2', 'my super description for pod 2', 'video_short2.webm', next) 139 const name = 'my super name for pod 2'
140 const description = 'my super description for pod 2'
141 const tags = [ 'tag1p2', 'tag2p2', 'tag3p2' ]
142 const file = 'video_short2.webm'
143 utils.uploadVideo(servers[1].url, servers[1].accessToken, name, description, tags, file, next)
135 }, 144 },
136 function (next) { 145 function (next) {
137 setTimeout(next, 11000) 146 setTimeout(next, 11000)
@@ -155,6 +164,7 @@ describe('Test multiple pods', function () {
155 expect(video.podUrl).to.equal('localhost:9002') 164 expect(video.podUrl).to.equal('localhost:9002')
156 expect(video.magnetUri).to.exist 165 expect(video.magnetUri).to.exist
157 expect(video.duration).to.equal(5) 166 expect(video.duration).to.equal(5)
167 expect(video.tags).to.deep.equal([ 'tag1p2', 'tag2p2', 'tag3p2' ])
158 expect(utils.dateIsValid(video.createdDate)).to.be.true 168 expect(utils.dateIsValid(video.createdDate)).to.be.true
159 169
160 if (server.url !== 'http://localhost:9002') { 170 if (server.url !== 'http://localhost:9002') {
@@ -187,10 +197,18 @@ describe('Test multiple pods', function () {
187 197
188 async.series([ 198 async.series([
189 function (next) { 199 function (next) {
190 utils.uploadVideo(servers[2].url, servers[2].accessToken, 'my super name for pod 3', 'my super description for pod 3', 'video_short3.webm', next) 200 const name = 'my super name for pod 3'
201 const description = 'my super description for pod 3'
202 const tags = [ 'tag1p3' ]
203 const file = 'video_short3.webm'
204 utils.uploadVideo(servers[2].url, servers[2].accessToken, name, description, tags, file, next)
191 }, 205 },
192 function (next) { 206 function (next) {
193 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) 207 const name = 'my super name for pod 3-2'
208 const description = 'my super description for pod 3-2'
209 const tags = [ 'tag2p3', 'tag3p3', 'tag4p3' ]
210 const file = 'video_short.webm'
211 utils.uploadVideo(servers[2].url, servers[2].accessToken, name, description, tags, file, next)
194 }, 212 },
195 function (next) { 213 function (next) {
196 setTimeout(next, 22000) 214 setTimeout(next, 22000)
@@ -224,6 +242,7 @@ describe('Test multiple pods', function () {
224 expect(video1.podUrl).to.equal('localhost:9003') 242 expect(video1.podUrl).to.equal('localhost:9003')
225 expect(video1.magnetUri).to.exist 243 expect(video1.magnetUri).to.exist
226 expect(video1.duration).to.equal(5) 244 expect(video1.duration).to.equal(5)
245 expect(video1.tags).to.deep.equal([ 'tag1p3' ])
227 expect(utils.dateIsValid(video1.createdDate)).to.be.true 246 expect(utils.dateIsValid(video1.createdDate)).to.be.true
228 247
229 expect(video2.name).to.equal('my super name for pod 3-2') 248 expect(video2.name).to.equal('my super name for pod 3-2')
@@ -231,6 +250,7 @@ describe('Test multiple pods', function () {
231 expect(video2.podUrl).to.equal('localhost:9003') 250 expect(video2.podUrl).to.equal('localhost:9003')
232 expect(video2.magnetUri).to.exist 251 expect(video2.magnetUri).to.exist
233 expect(video2.duration).to.equal(5) 252 expect(video2.duration).to.equal(5)
253 expect(video2.tags).to.deep.equal([ 'tag2p3', 'tag3p3', 'tag4p3' ])
234 expect(utils.dateIsValid(video2.createdDate)).to.be.true 254 expect(utils.dateIsValid(video2.createdDate)).to.be.true
235 255
236 if (server.url !== 'http://localhost:9003') { 256 if (server.url !== 'http://localhost:9003') {
diff --git a/server/tests/api/singlePod.js b/server/tests/api/singlePod.js
index 296dd0aa4..ef882b080 100644
--- a/server/tests/api/singlePod.js
+++ b/server/tests/api/singlePod.js
@@ -57,7 +57,11 @@ describe('Test a single pod', function () {
57 57
58 it('Should upload the video', function (done) { 58 it('Should upload the video', function (done) {
59 this.timeout(5000) 59 this.timeout(5000)
60 utils.uploadVideo(server.url, server.accessToken, 'my super name', 'my super description', 'video_short.webm', done) 60 const name = 'my super name'
61 const description = 'my super description'
62 const tags = [ 'tag1', 'tag2', 'tag3' ]
63 const file = 'video_short.webm'
64 utils.uploadVideo(server.url, server.accessToken, name, description, tags, file, done)
61 }) 65 })
62 66
63 it('Should seed the uploaded video', function (done) { 67 it('Should seed the uploaded video', function (done) {
@@ -78,6 +82,7 @@ describe('Test a single pod', function () {
78 expect(video.magnetUri).to.exist 82 expect(video.magnetUri).to.exist
79 expect(video.author).to.equal('root') 83 expect(video.author).to.equal('root')
80 expect(video.isLocal).to.be.true 84 expect(video.isLocal).to.be.true
85 expect(video.tags).to.deep.equal([ 'tag1', 'tag2', 'tag3' ])
81 expect(utils.dateIsValid(video.createdDate)).to.be.true 86 expect(utils.dateIsValid(video.createdDate)).to.be.true
82 87
83 utils.testImage(server.url, 'video_short.webm', video.thumbnailPath, function (err, test) { 88 utils.testImage(server.url, 'video_short.webm', video.thumbnailPath, function (err, test) {
@@ -112,6 +117,7 @@ describe('Test a single pod', function () {
112 expect(video.magnetUri).to.exist 117 expect(video.magnetUri).to.exist
113 expect(video.author).to.equal('root') 118 expect(video.author).to.equal('root')
114 expect(video.isLocal).to.be.true 119 expect(video.isLocal).to.be.true
120 expect(video.tags).to.deep.equal([ 'tag1', 'tag2', 'tag3' ])
115 expect(utils.dateIsValid(video.createdDate)).to.be.true 121 expect(utils.dateIsValid(video.createdDate)).to.be.true
116 122
117 utils.testImage(server.url, 'video_short.webm', video.thumbnailPath, function (err, test) { 123 utils.testImage(server.url, 'video_short.webm', video.thumbnailPath, function (err, test) {
@@ -143,6 +149,7 @@ describe('Test a single pod', function () {
143 expect(video.podUrl).to.equal('localhost:9001') 149 expect(video.podUrl).to.equal('localhost:9001')
144 expect(video.author).to.equal('root') 150 expect(video.author).to.equal('root')
145 expect(video.isLocal).to.be.true 151 expect(video.isLocal).to.be.true
152 expect(video.tags).to.deep.equal([ 'tag1', 'tag2', 'tag3' ])
146 expect(utils.dateIsValid(video.createdDate)).to.be.true 153 expect(utils.dateIsValid(video.createdDate)).to.be.true
147 154
148 utils.testImage(server.url, 'video_short.webm', video.thumbnailPath, function (err, test) { 155 utils.testImage(server.url, 'video_short.webm', video.thumbnailPath, function (err, test) {
@@ -168,6 +175,7 @@ describe('Test a single pod', function () {
168 expect(video.podUrl).to.equal('localhost:9001') 175 expect(video.podUrl).to.equal('localhost:9001')
169 expect(video.author).to.equal('root') 176 expect(video.author).to.equal('root')
170 expect(video.isLocal).to.be.true 177 expect(video.isLocal).to.be.true
178 expect(video.tags).to.deep.equal([ 'tag1', 'tag2', 'tag3' ])
171 expect(utils.dateIsValid(video.createdDate)).to.be.true 179 expect(utils.dateIsValid(video.createdDate)).to.be.true
172 180
173 utils.testImage(server.url, 'video_short.webm', video.thumbnailPath, function (err, test) { 181 utils.testImage(server.url, 'video_short.webm', video.thumbnailPath, function (err, test) {
@@ -235,7 +243,11 @@ describe('Test a single pod', function () {
235 'video_short1.webm', 'video_short2.webm', 'video_short3.webm' 243 'video_short1.webm', 'video_short2.webm', 'video_short3.webm'
236 ] 244 ]
237 async.each(videos, function (video, callbackEach) { 245 async.each(videos, function (video, callbackEach) {
238 utils.uploadVideo(server.url, server.accessToken, video + ' name', video + ' description', video, callbackEach) 246 const name = video + ' name'
247 const description = video + ' description'
248 const tags = [ 'tag1', 'tag2', 'tag3' ]
249
250 utils.uploadVideo(server.url, server.accessToken, name, description, tags, video, callbackEach)
239 }, done) 251 }, done)
240 }) 252 })
241 253
diff --git a/server/tests/api/users.js b/server/tests/api/users.js
index 9ab5083a0..7ab426d85 100644
--- a/server/tests/api/users.js
+++ b/server/tests/api/users.js
@@ -79,7 +79,12 @@ describe('Test users', function () {
79 79
80 it('Should not be able to upload a video', function (done) { 80 it('Should not be able to upload a video', function (done) {
81 accessToken = 'mysupertoken' 81 accessToken = 'mysupertoken'
82 utils.uploadVideo(server.url, accessToken, 'my super name', 'my super description', 'video_short.webm', 401, done) 82
83 const name = 'my super name'
84 const description = 'my super description'
85 const tags = [ 'tag1', 'tag2' ]
86 const video = 'video_short.webm'
87 utils.uploadVideo(server.url, accessToken, name, description, tags, video, 401, done)
83 }) 88 })
84 89
85 it('Should not be able to make friends', function (done) { 90 it('Should not be able to make friends', function (done) {
@@ -102,7 +107,11 @@ describe('Test users', function () {
102 }) 107 })
103 108
104 it('Should upload the video with the correct token', function (done) { 109 it('Should upload the video with the correct token', function (done) {
105 utils.uploadVideo(server.url, accessToken, 'my super name', 'my super description', 'video_short.webm', 204, function (err, res) { 110 const name = 'my super name'
111 const description = 'my super description'
112 const tags = [ 'tag1', 'tag2' ]
113 const video = 'video_short.webm'
114 utils.uploadVideo(server.url, accessToken, name, description, tags, video, 204, function (err, res) {
106 if (err) throw err 115 if (err) throw err
107 116
108 utils.getVideosList(server.url, function (err, res) { 117 utils.getVideosList(server.url, function (err, res) {
@@ -118,7 +127,11 @@ describe('Test users', function () {
118 }) 127 })
119 128
120 it('Should upload the video again with the correct token', function (done) { 129 it('Should upload the video again with the correct token', function (done) {
121 utils.uploadVideo(server.url, accessToken, 'my super name 2', 'my super description 2', 'video_short.webm', 204, done) 130 const name = 'my super name 2'
131 const description = 'my super description 2'
132 const tags = [ 'tag1' ]
133 const video = 'video_short.webm'
134 utils.uploadVideo(server.url, accessToken, name, description, tags, video, 204, done)
122 }) 135 })
123 136
124 it('Should not be able to remove the video with an incorrect token', function (done) { 137 it('Should not be able to remove the video with an incorrect token', function (done) {
diff --git a/server/tests/api/utils.js b/server/tests/api/utils.js
index c6430c930..e0068eada 100644
--- a/server/tests/api/utils.js
+++ b/server/tests/api/utils.js
@@ -349,7 +349,7 @@ function testImage (url, videoName, imagePath, callback) {
349 }) 349 })
350} 350}
351 351
352function uploadVideo (url, accessToken, name, description, fixture, specialStatus, end) { 352function uploadVideo (url, accessToken, name, description, tags, fixture, specialStatus, end) {
353 if (!end) { 353 if (!end) {
354 end = specialStatus 354 end = specialStatus
355 specialStatus = 204 355 specialStatus = 204
@@ -357,15 +357,20 @@ function uploadVideo (url, accessToken, name, description, fixture, specialStatu
357 357
358 const path = '/api/v1/videos' 358 const path = '/api/v1/videos'
359 359
360 request(url) 360 const req = request(url)
361 .post(path) 361 .post(path)
362 .set('Accept', 'application/json') 362 .set('Accept', 'application/json')
363 .set('Authorization', 'Bearer ' + accessToken) 363 .set('Authorization', 'Bearer ' + accessToken)
364 .field('name', name) 364 .field('name', name)
365 .field('description', description) 365 .field('description', description)
366 .attach('videofile', pathUtils.join(__dirname, 'fixtures', fixture)) 366
367 .expect(specialStatus) 367 for (let i = 0; i < tags.length; i++) {
368 .end(end) 368 req.field('tags[' + i + ']', tags[i])
369 }
370
371 req.attach('videofile', pathUtils.join(__dirname, 'fixtures', fixture))
372 .expect(specialStatus)
373 .end(end)
369} 374}
370 375
371// --------------------------------------------------------------------------- 376// ---------------------------------------------------------------------------