aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/check-params/videos.js
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-03-28 21:19:46 +0200
committerChocobozzz <florian.bigard@gmail.com>2017-03-28 21:19:46 +0200
commit31b59b477459d4f26ed8ef089a0e5553fb6a332b (patch)
tree70de15dc172045d01ad45718f55c22d5ca43b354 /server/tests/api/check-params/videos.js
parentd07137b90b2b2b0c1e93a6f0e7bf8719b133027c (diff)
downloadPeerTube-31b59b477459d4f26ed8ef089a0e5553fb6a332b.tar.gz
PeerTube-31b59b477459d4f26ed8ef089a0e5553fb6a332b.tar.zst
PeerTube-31b59b477459d4f26ed8ef089a0e5553fb6a332b.zip
Server: add nsfw attribute
Diffstat (limited to 'server/tests/api/check-params/videos.js')
-rw-r--r--server/tests/api/check-params/videos.js65
1 files changed, 65 insertions, 0 deletions
diff --git a/server/tests/api/check-params/videos.js b/server/tests/api/check-params/videos.js
index e58f9893b..551fe687b 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 nsfw: false,
117 description: 'my super description', 118 description: 'my super description',
118 tags: [ 'tag1', 'tag2' ] 119 tags: [ 'tag1', 'tag2' ]
119 } 120 }
@@ -128,6 +129,7 @@ describe('Test videos API validator', function () {
128 name: 'My very very very very very very very very very very very very very very very very long name', 129 name: 'My very very very very very very very very very very very very very very very very long name',
129 category: 5, 130 category: 5,
130 licence: 1, 131 licence: 1,
132 nsfw: false,
131 description: 'my super description', 133 description: 'my super description',
132 tags: [ 'tag1', 'tag2' ] 134 tags: [ 'tag1', 'tag2' ]
133 } 135 }
@@ -141,6 +143,7 @@ describe('Test videos API validator', function () {
141 const data = { 143 const data = {
142 name: 'my super name', 144 name: 'my super name',
143 licence: 1, 145 licence: 1,
146 nsfw: false,
144 description: 'my super description', 147 description: 'my super description',
145 tags: [ 'tag1', 'tag2' ] 148 tags: [ 'tag1', 'tag2' ]
146 } 149 }
@@ -155,6 +158,7 @@ describe('Test videos API validator', function () {
155 name: 'my super name', 158 name: 'my super name',
156 category: 125, 159 category: 125,
157 licence: 1, 160 licence: 1,
161 nsfw: false,
158 description: 'my super description', 162 description: 'my super description',
159 tags: [ 'tag1', 'tag2' ] 163 tags: [ 'tag1', 'tag2' ]
160 } 164 }
@@ -168,6 +172,7 @@ describe('Test videos API validator', function () {
168 const data = { 172 const data = {
169 name: 'my super name', 173 name: 'my super name',
170 category: 5, 174 category: 5,
175 nsfw: false,
171 description: 'my super description', 176 description: 'my super description',
172 tags: [ 'tag1', 'tag2' ] 177 tags: [ 'tag1', 'tag2' ]
173 } 178 }
@@ -182,6 +187,36 @@ describe('Test videos API validator', function () {
182 name: 'my super name', 187 name: 'my super name',
183 category: 5, 188 category: 5,
184 licence: 125, 189 licence: 125,
190 nsfw: false,
191 description: 'my super description',
192 tags: [ 'tag1', 'tag2' ]
193 }
194 const attach = {
195 'videofile': pathUtils.join(__dirname, '..', 'fixtures', 'video_short.webm')
196 }
197 requestsUtils.makePostUploadRequest(server.url, path, server.accessToken, data, attach, done)
198 })
199
200 it('Should fail without nsfw attribute', function (done) {
201 const data = {
202 name: 'my super name',
203 category: 5,
204 licence: 4,
205 description: 'my super description',
206 tags: [ 'tag1', 'tag2' ]
207 }
208 const attach = {
209 'videofile': pathUtils.join(__dirname, '..', 'fixtures', 'video_short.webm')
210 }
211 requestsUtils.makePostUploadRequest(server.url, path, server.accessToken, data, attach, done)
212 })
213
214 it('Should fail with a bad nsfw attribue', function (done) {
215 const data = {
216 name: 'my super name',
217 category: 5,
218 licence: 4,
219 nsfw: 2,
185 description: 'my super description', 220 description: 'my super description',
186 tags: [ 'tag1', 'tag2' ] 221 tags: [ 'tag1', 'tag2' ]
187 } 222 }
@@ -196,6 +231,7 @@ describe('Test videos API validator', function () {
196 name: 'my super name', 231 name: 'my super name',
197 category: 5, 232 category: 5,
198 licence: 1, 233 licence: 1,
234 nsfw: false,
199 tags: [ 'tag1', 'tag2' ] 235 tags: [ 'tag1', 'tag2' ]
200 } 236 }
201 const attach = { 237 const attach = {
@@ -209,6 +245,7 @@ describe('Test videos API validator', function () {
209 name: 'my super name', 245 name: 'my super name',
210 category: 5, 246 category: 5,
211 licence: 1, 247 licence: 1,
248 nsfw: false,
212 description: 'my super description which is very very very very very very very very very very very very very very' + 249 description: 'my super description which is very very very very very very very very very very very very very very' +
213 'very very very very very very very 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' +
214 'very very very very very very very very very very very very very very very long', 251 'very very very very very very very very very very very very very very very long',
@@ -225,6 +262,7 @@ describe('Test videos API validator', function () {
225 name: 'my super name', 262 name: 'my super name',
226 category: 5, 263 category: 5,
227 licence: 1, 264 licence: 1,
265 nsfw: false,
228 description: 'my super description', 266 description: 'my super description',
229 tags: [ 'tag1', 'tag2', 'tag3', 'tag4' ] 267 tags: [ 'tag1', 'tag2', 'tag3', 'tag4' ]
230 } 268 }
@@ -239,6 +277,7 @@ describe('Test videos API validator', function () {
239 name: 'my super name', 277 name: 'my super name',
240 category: 5, 278 category: 5,
241 licence: 1, 279 licence: 1,
280 nsfw: false,
242 description: 'my super description', 281 description: 'my super description',
243 tags: [ 'tag1', 't' ] 282 tags: [ 'tag1', 't' ]
244 } 283 }
@@ -253,6 +292,7 @@ describe('Test videos API validator', function () {
253 name: 'my super name', 292 name: 'my super name',
254 category: 5, 293 category: 5,
255 licence: 1, 294 licence: 1,
295 nsfw: false,
256 description: 'my super description', 296 description: 'my super description',
257 tags: [ 'mysupertagtoolong', 'tag1' ] 297 tags: [ 'mysupertagtoolong', 'tag1' ]
258 } 298 }
@@ -267,6 +307,7 @@ describe('Test videos API validator', function () {
267 name: 'my super name', 307 name: 'my super name',
268 category: 5, 308 category: 5,
269 licence: 1, 309 licence: 1,
310 nsfw: false,
270 description: 'my super description', 311 description: 'my super description',
271 tags: [ 'tag1', 'tag2' ] 312 tags: [ 'tag1', 'tag2' ]
272 } 313 }
@@ -279,6 +320,7 @@ describe('Test videos API validator', function () {
279 name: 'my super name', 320 name: 'my super name',
280 category: 5, 321 category: 5,
281 licence: 1, 322 licence: 1,
323 nsfw: false,
282 description: 'my super description', 324 description: 'my super description',
283 tags: [ 'tag1', 'tag2' ] 325 tags: [ 'tag1', 'tag2' ]
284 } 326 }
@@ -293,6 +335,7 @@ describe('Test videos API validator', function () {
293 name: 'my super name', 335 name: 'my super name',
294 category: 5, 336 category: 5,
295 licence: 1, 337 licence: 1,
338 nsfw: false,
296 description: 'my super description', 339 description: 'my super description',
297 tags: [ 'tag1', 'tag2' ] 340 tags: [ 'tag1', 'tag2' ]
298 } 341 }
@@ -307,6 +350,7 @@ describe('Test videos API validator', function () {
307 name: 'my super name', 350 name: 'my super name',
308 category: 5, 351 category: 5,
309 licence: 1, 352 licence: 1,
353 nsfw: false,
310 description: 'my super description', 354 description: 'my super description',
311 tags: [ 'tag1', 'tag2' ] 355 tags: [ 'tag1', 'tag2' ]
312 } 356 }
@@ -345,6 +389,7 @@ describe('Test videos API validator', function () {
345 const data = { 389 const data = {
346 category: 5, 390 category: 5,
347 licence: 2, 391 licence: 2,
392 nsfw: false,
348 description: 'my super description', 393 description: 'my super description',
349 tags: [ 'tag1', 'tag2' ] 394 tags: [ 'tag1', 'tag2' ]
350 } 395 }
@@ -355,6 +400,7 @@ describe('Test videos API validator', function () {
355 const data = { 400 const data = {
356 category: 5, 401 category: 5,
357 licence: 2, 402 licence: 2,
403 nsfw: false,
358 description: 'my super description', 404 description: 'my super description',
359 tags: [ 'tag1', 'tag2' ] 405 tags: [ 'tag1', 'tag2' ]
360 } 406 }
@@ -366,6 +412,7 @@ describe('Test videos API validator', function () {
366 name: 'My very very very very very very very very very very very very very very very very long name', 412 name: 'My very very very very very very very very very very very very very very very very long name',
367 category: 5, 413 category: 5,
368 licence: 2, 414 licence: 2,
415 nsfw: false,
369 description: 'my super description', 416 description: 'my super description',
370 tags: [ 'tag1', 'tag2' ] 417 tags: [ 'tag1', 'tag2' ]
371 } 418 }
@@ -377,6 +424,7 @@ describe('Test videos API validator', function () {
377 name: 'my super name', 424 name: 'my super name',
378 category: 128, 425 category: 128,
379 licence: 2, 426 licence: 2,
427 nsfw: false,
380 description: 'my super description', 428 description: 'my super description',
381 tags: [ 'tag1', 'tag2' ] 429 tags: [ 'tag1', 'tag2' ]
382 } 430 }
@@ -388,6 +436,19 @@ describe('Test videos API validator', function () {
388 name: 'my super name', 436 name: 'my super name',
389 category: 5, 437 category: 5,
390 licence: 128, 438 licence: 128,
439 nsfw: false,
440 description: 'my super description',
441 tags: [ 'tag1', 'tag2' ]
442 }
443 requestsUtils.makePutBodyRequest(server.url, path + videoId, server.accessToken, data, done)
444 })
445
446 it('Should fail with a bad nsfw attribute', function (done) {
447 const data = {
448 name: 'my super name',
449 category: 5,
450 licence: 5,
451 nsfw: -4,
391 description: 'my super description', 452 description: 'my super description',
392 tags: [ 'tag1', 'tag2' ] 453 tags: [ 'tag1', 'tag2' ]
393 } 454 }
@@ -399,6 +460,7 @@ describe('Test videos API validator', function () {
399 name: 'my super name', 460 name: 'my super name',
400 category: 5, 461 category: 5,
401 licence: 2, 462 licence: 2,
463 nsfw: false,
402 description: 'my super description which is very very very very very very very very very very very very very very' + 464 description: 'my super description which is very very very very very very very very very very very very very very' +
403 'very very very very very very very 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' +
404 'very very very very very very very very very very very very very very very long', 466 'very very very very very very very very very very very very very very very long',
@@ -412,6 +474,7 @@ describe('Test videos API validator', function () {
412 name: 'my super name', 474 name: 'my super name',
413 category: 5, 475 category: 5,
414 licence: 2, 476 licence: 2,
477 nsfw: false,
415 description: 'my super description', 478 description: 'my super description',
416 tags: [ 'tag1', 'tag2', 'tag3', 'tag4' ] 479 tags: [ 'tag1', 'tag2', 'tag3', 'tag4' ]
417 } 480 }
@@ -423,6 +486,7 @@ describe('Test videos API validator', function () {
423 name: 'my super name', 486 name: 'my super name',
424 category: 5, 487 category: 5,
425 licence: 2, 488 licence: 2,
489 nsfw: false,
426 description: 'my super description', 490 description: 'my super description',
427 tags: [ 'tag1', 't' ] 491 tags: [ 'tag1', 't' ]
428 } 492 }
@@ -434,6 +498,7 @@ describe('Test videos API validator', function () {
434 name: 'my super name', 498 name: 'my super name',
435 category: 5, 499 category: 5,
436 licence: 2, 500 licence: 2,
501 nsfw: false,
437 description: 'my super description', 502 description: 'my super description',
438 tags: [ 'mysupertagtoolong', 'tag1' ] 503 tags: [ 'mysupertagtoolong', 'tag1' ]
439 } 504 }