aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/check-params/videos.js
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api/check-params/videos.js')
-rw-r--r--server/tests/api/check-params/videos.js56
1 files changed, 56 insertions, 0 deletions
diff --git a/server/tests/api/check-params/videos.js b/server/tests/api/check-params/videos.js
index 551fe687b..1a24d26cc 100644
--- a/server/tests/api/check-params/videos.js
+++ b/server/tests/api/check-params/videos.js
@@ -114,6 +114,7 @@ describe('Test videos API validator', function () {
114 const data = { 114 const data = {
115 category: 5, 115 category: 5,
116 licence: 1, 116 licence: 1,
117 language: 6,
117 nsfw: false, 118 nsfw: false,
118 description: 'my super description', 119 description: 'my super description',
119 tags: [ 'tag1', 'tag2' ] 120 tags: [ 'tag1', 'tag2' ]
@@ -129,6 +130,7 @@ describe('Test videos API validator', function () {
129 name: 'My very very very very very very very very very very very very very very very very long name', 130 name: 'My very very very very very very very very very very very very very very very very long name',
130 category: 5, 131 category: 5,
131 licence: 1, 132 licence: 1,
133 language: 6,
132 nsfw: false, 134 nsfw: false,
133 description: 'my super description', 135 description: 'my super description',
134 tags: [ 'tag1', 'tag2' ] 136 tags: [ 'tag1', 'tag2' ]
@@ -143,6 +145,7 @@ describe('Test videos API validator', function () {
143 const data = { 145 const data = {
144 name: 'my super name', 146 name: 'my super name',
145 licence: 1, 147 licence: 1,
148 language: 6,
146 nsfw: false, 149 nsfw: false,
147 description: 'my super description', 150 description: 'my super description',
148 tags: [ 'tag1', 'tag2' ] 151 tags: [ 'tag1', 'tag2' ]
@@ -158,6 +161,7 @@ describe('Test videos API validator', function () {
158 name: 'my super name', 161 name: 'my super name',
159 category: 125, 162 category: 125,
160 licence: 1, 163 licence: 1,
164 language: 6,
161 nsfw: false, 165 nsfw: false,
162 description: 'my super description', 166 description: 'my super description',
163 tags: [ 'tag1', 'tag2' ] 167 tags: [ 'tag1', 'tag2' ]
@@ -172,6 +176,7 @@ describe('Test videos API validator', function () {
172 const data = { 176 const data = {
173 name: 'my super name', 177 name: 'my super name',
174 category: 5, 178 category: 5,
179 language: 6,
175 nsfw: false, 180 nsfw: false,
176 description: 'my super description', 181 description: 'my super description',
177 tags: [ 'tag1', 'tag2' ] 182 tags: [ 'tag1', 'tag2' ]
@@ -187,6 +192,23 @@ describe('Test videos API validator', function () {
187 name: 'my super name', 192 name: 'my super name',
188 category: 5, 193 category: 5,
189 licence: 125, 194 licence: 125,
195 language: 6,
196 nsfw: false,
197 description: 'my super description',
198 tags: [ 'tag1', 'tag2' ]
199 }
200 const attach = {
201 'videofile': pathUtils.join(__dirname, '..', 'fixtures', 'video_short.webm')
202 }
203 requestsUtils.makePostUploadRequest(server.url, path, server.accessToken, data, attach, done)
204 })
205
206 it('Should fail with a bad language', function (done) {
207 const data = {
208 name: 'my super name',
209 category: 5,
210 licence: 4,
211 language: 563,
190 nsfw: false, 212 nsfw: false,
191 description: 'my super description', 213 description: 'my super description',
192 tags: [ 'tag1', 'tag2' ] 214 tags: [ 'tag1', 'tag2' ]
@@ -202,6 +224,7 @@ describe('Test videos API validator', function () {
202 name: 'my super name', 224 name: 'my super name',
203 category: 5, 225 category: 5,
204 licence: 4, 226 licence: 4,
227 language: 6,
205 description: 'my super description', 228 description: 'my super description',
206 tags: [ 'tag1', 'tag2' ] 229 tags: [ 'tag1', 'tag2' ]
207 } 230 }
@@ -216,6 +239,7 @@ describe('Test videos API validator', function () {
216 name: 'my super name', 239 name: 'my super name',
217 category: 5, 240 category: 5,
218 licence: 4, 241 licence: 4,
242 language: 6,
219 nsfw: 2, 243 nsfw: 2,
220 description: 'my super description', 244 description: 'my super description',
221 tags: [ 'tag1', 'tag2' ] 245 tags: [ 'tag1', 'tag2' ]
@@ -231,6 +255,7 @@ describe('Test videos API validator', function () {
231 name: 'my super name', 255 name: 'my super name',
232 category: 5, 256 category: 5,
233 licence: 1, 257 licence: 1,
258 language: 6,
234 nsfw: false, 259 nsfw: false,
235 tags: [ 'tag1', 'tag2' ] 260 tags: [ 'tag1', 'tag2' ]
236 } 261 }
@@ -245,6 +270,7 @@ describe('Test videos API validator', function () {
245 name: 'my super name', 270 name: 'my super name',
246 category: 5, 271 category: 5,
247 licence: 1, 272 licence: 1,
273 language: 6,
248 nsfw: false, 274 nsfw: false,
249 description: 'my super description which is very very very very very very very very very very very very very very' + 275 description: 'my super description which is very very very very very very very very very very very very very very' +
250 'very very very very very very very very very very very very very very very very very very very very very' + 276 'very very very very very very very very very very very very very very very very very very very very very' +
@@ -262,6 +288,7 @@ describe('Test videos API validator', function () {
262 name: 'my super name', 288 name: 'my super name',
263 category: 5, 289 category: 5,
264 licence: 1, 290 licence: 1,
291 language: 6,
265 nsfw: false, 292 nsfw: false,
266 description: 'my super description', 293 description: 'my super description',
267 tags: [ 'tag1', 'tag2', 'tag3', 'tag4' ] 294 tags: [ 'tag1', 'tag2', 'tag3', 'tag4' ]
@@ -277,6 +304,7 @@ describe('Test videos API validator', function () {
277 name: 'my super name', 304 name: 'my super name',
278 category: 5, 305 category: 5,
279 licence: 1, 306 licence: 1,
307 language: 6,
280 nsfw: false, 308 nsfw: false,
281 description: 'my super description', 309 description: 'my super description',
282 tags: [ 'tag1', 't' ] 310 tags: [ 'tag1', 't' ]
@@ -292,6 +320,7 @@ describe('Test videos API validator', function () {
292 name: 'my super name', 320 name: 'my super name',
293 category: 5, 321 category: 5,
294 licence: 1, 322 licence: 1,
323 language: 6,
295 nsfw: false, 324 nsfw: false,
296 description: 'my super description', 325 description: 'my super description',
297 tags: [ 'mysupertagtoolong', 'tag1' ] 326 tags: [ 'mysupertagtoolong', 'tag1' ]
@@ -307,6 +336,7 @@ describe('Test videos API validator', function () {
307 name: 'my super name', 336 name: 'my super name',
308 category: 5, 337 category: 5,
309 licence: 1, 338 licence: 1,
339 language: 6,
310 nsfw: false, 340 nsfw: false,
311 description: 'my super description', 341 description: 'my super description',
312 tags: [ 'tag1', 'tag2' ] 342 tags: [ 'tag1', 'tag2' ]
@@ -320,6 +350,7 @@ describe('Test videos API validator', function () {
320 name: 'my super name', 350 name: 'my super name',
321 category: 5, 351 category: 5,
322 licence: 1, 352 licence: 1,
353 language: 6,
323 nsfw: false, 354 nsfw: false,
324 description: 'my super description', 355 description: 'my super description',
325 tags: [ 'tag1', 'tag2' ] 356 tags: [ 'tag1', 'tag2' ]
@@ -335,6 +366,7 @@ describe('Test videos API validator', function () {
335 name: 'my super name', 366 name: 'my super name',
336 category: 5, 367 category: 5,
337 licence: 1, 368 licence: 1,
369 language: 6,
338 nsfw: false, 370 nsfw: false,
339 description: 'my super description', 371 description: 'my super description',
340 tags: [ 'tag1', 'tag2' ] 372 tags: [ 'tag1', 'tag2' ]
@@ -350,6 +382,7 @@ describe('Test videos API validator', function () {
350 name: 'my super name', 382 name: 'my super name',
351 category: 5, 383 category: 5,
352 licence: 1, 384 licence: 1,
385 language: 6,
353 nsfw: false, 386 nsfw: false,
354 description: 'my super description', 387 description: 'my super description',
355 tags: [ 'tag1', 'tag2' ] 388 tags: [ 'tag1', 'tag2' ]
@@ -389,6 +422,7 @@ describe('Test videos API validator', function () {
389 const data = { 422 const data = {
390 category: 5, 423 category: 5,
391 licence: 2, 424 licence: 2,
425 language: 6,
392 nsfw: false, 426 nsfw: false,
393 description: 'my super description', 427 description: 'my super description',
394 tags: [ 'tag1', 'tag2' ] 428 tags: [ 'tag1', 'tag2' ]
@@ -400,6 +434,7 @@ describe('Test videos API validator', function () {
400 const data = { 434 const data = {
401 category: 5, 435 category: 5,
402 licence: 2, 436 licence: 2,
437 language: 6,
403 nsfw: false, 438 nsfw: false,
404 description: 'my super description', 439 description: 'my super description',
405 tags: [ 'tag1', 'tag2' ] 440 tags: [ 'tag1', 'tag2' ]
@@ -412,6 +447,7 @@ describe('Test videos API validator', function () {
412 name: 'My very very very very very very very very very very very very very very very very long name', 447 name: 'My very very very very very very very very very very very very very very very very long name',
413 category: 5, 448 category: 5,
414 licence: 2, 449 licence: 2,
450 language: 6,
415 nsfw: false, 451 nsfw: false,
416 description: 'my super description', 452 description: 'my super description',
417 tags: [ 'tag1', 'tag2' ] 453 tags: [ 'tag1', 'tag2' ]
@@ -424,6 +460,7 @@ describe('Test videos API validator', function () {
424 name: 'my super name', 460 name: 'my super name',
425 category: 128, 461 category: 128,
426 licence: 2, 462 licence: 2,
463 language: 6,
427 nsfw: false, 464 nsfw: false,
428 description: 'my super description', 465 description: 'my super description',
429 tags: [ 'tag1', 'tag2' ] 466 tags: [ 'tag1', 'tag2' ]
@@ -436,6 +473,20 @@ describe('Test videos API validator', function () {
436 name: 'my super name', 473 name: 'my super name',
437 category: 5, 474 category: 5,
438 licence: 128, 475 licence: 128,
476 language: 6,
477 nsfw: false,
478 description: 'my super description',
479 tags: [ 'tag1', 'tag2' ]
480 }
481 requestsUtils.makePutBodyRequest(server.url, path + videoId, server.accessToken, data, done)
482 })
483
484 it('Should fail with a bad language', function (done) {
485 const data = {
486 name: 'my super name',
487 category: 5,
488 licence: 3,
489 language: 896,
439 nsfw: false, 490 nsfw: false,
440 description: 'my super description', 491 description: 'my super description',
441 tags: [ 'tag1', 'tag2' ] 492 tags: [ 'tag1', 'tag2' ]
@@ -448,6 +499,7 @@ describe('Test videos API validator', function () {
448 name: 'my super name', 499 name: 'my super name',
449 category: 5, 500 category: 5,
450 licence: 5, 501 licence: 5,
502 language: 6,
451 nsfw: -4, 503 nsfw: -4,
452 description: 'my super description', 504 description: 'my super description',
453 tags: [ 'tag1', 'tag2' ] 505 tags: [ 'tag1', 'tag2' ]
@@ -460,6 +512,7 @@ describe('Test videos API validator', function () {
460 name: 'my super name', 512 name: 'my super name',
461 category: 5, 513 category: 5,
462 licence: 2, 514 licence: 2,
515 language: 6,
463 nsfw: false, 516 nsfw: false,
464 description: 'my super description which is very very very very very very very very very very very very very very' + 517 description: 'my super description which is very very very very very very very very very very very very very very' +
465 'very very very very very very very very very very very very very very very very very very very very very' + 518 'very very very very very very very very very very very very very very very very very very very very very' +
@@ -474,6 +527,7 @@ describe('Test videos API validator', function () {
474 name: 'my super name', 527 name: 'my super name',
475 category: 5, 528 category: 5,
476 licence: 2, 529 licence: 2,
530 language: 6,
477 nsfw: false, 531 nsfw: false,
478 description: 'my super description', 532 description: 'my super description',
479 tags: [ 'tag1', 'tag2', 'tag3', 'tag4' ] 533 tags: [ 'tag1', 'tag2', 'tag3', 'tag4' ]
@@ -486,6 +540,7 @@ describe('Test videos API validator', function () {
486 name: 'my super name', 540 name: 'my super name',
487 category: 5, 541 category: 5,
488 licence: 2, 542 licence: 2,
543 language: 6,
489 nsfw: false, 544 nsfw: false,
490 description: 'my super description', 545 description: 'my super description',
491 tags: [ 'tag1', 't' ] 546 tags: [ 'tag1', 't' ]
@@ -498,6 +553,7 @@ describe('Test videos API validator', function () {
498 name: 'my super name', 553 name: 'my super name',
499 category: 5, 554 category: 5,
500 licence: 2, 555 licence: 2,
556 language: 6,
501 nsfw: false, 557 nsfw: false,
502 description: 'my super description', 558 description: 'my super description',
503 tags: [ 'mysupertagtoolong', 'tag1' ] 559 tags: [ 'mysupertagtoolong', 'tag1' ]