aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/check-params/videos.js
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-03-22 21:15:55 +0100
committerChocobozzz <florian.bigard@gmail.com>2017-03-22 21:25:24 +0100
commit6e07c3de88791a0b342e0cc319590048117f9c2d (patch)
tree049f88d3f6d3ec0aeea09702a583deb86d6ef78f /server/tests/api/check-params/videos.js
parent2d7653dc8726185615bab66353c4e3fb8fbb5a5f (diff)
downloadPeerTube-6e07c3de88791a0b342e0cc319590048117f9c2d.tar.gz
PeerTube-6e07c3de88791a0b342e0cc319590048117f9c2d.tar.zst
PeerTube-6e07c3de88791a0b342e0cc319590048117f9c2d.zip
Add video category support
Diffstat (limited to 'server/tests/api/check-params/videos.js')
-rw-r--r--server/tests/api/check-params/videos.js58
1 files changed, 58 insertions, 0 deletions
diff --git a/server/tests/api/check-params/videos.js b/server/tests/api/check-params/videos.js
index 0f5f40b8e..fbfe6f137 100644
--- a/server/tests/api/check-params/videos.js
+++ b/server/tests/api/check-params/videos.js
@@ -112,6 +112,7 @@ describe('Test videos API validator', function () {
112 112
113 it('Should fail without name', function (done) { 113 it('Should fail without name', function (done) {
114 const data = { 114 const data = {
115 category: 5,
115 description: 'my super description', 116 description: 'my super description',
116 tags: [ 'tag1', 'tag2' ] 117 tags: [ 'tag1', 'tag2' ]
117 } 118 }
@@ -124,6 +125,32 @@ describe('Test videos API validator', function () {
124 it('Should fail with a long name', function (done) { 125 it('Should fail with a long name', function (done) {
125 const data = { 126 const data = {
126 name: 'My very very very very very very very very very very very very very very very very long name', 127 name: 'My very very very very very very very very very very very very very very very very long name',
128 category: 5,
129 description: 'my super description',
130 tags: [ 'tag1', 'tag2' ]
131 }
132 const attach = {
133 'videofile': pathUtils.join(__dirname, '..', 'fixtures', 'video_short.webm')
134 }
135 requestsUtils.makePostUploadRequest(server.url, path, server.accessToken, data, attach, done)
136 })
137
138 it('Should fail without a category', function (done) {
139 const data = {
140 name: 'my super name',
141 description: 'my super description',
142 tags: [ 'tag1', 'tag2' ]
143 }
144 const attach = {
145 'videofile': pathUtils.join(__dirname, '..', 'fixtures', 'video_short.webm')
146 }
147 requestsUtils.makePostUploadRequest(server.url, path, server.accessToken, data, attach, done)
148 })
149
150 it('Should fail with a bad category', function (done) {
151 const data = {
152 name: 'my super name',
153 category: 125,
127 description: 'my super description', 154 description: 'my super description',
128 tags: [ 'tag1', 'tag2' ] 155 tags: [ 'tag1', 'tag2' ]
129 } 156 }
@@ -136,6 +163,7 @@ describe('Test videos API validator', function () {
136 it('Should fail without description', function (done) { 163 it('Should fail without description', function (done) {
137 const data = { 164 const data = {
138 name: 'my super name', 165 name: 'my super name',
166 category: 5,
139 tags: [ 'tag1', 'tag2' ] 167 tags: [ 'tag1', 'tag2' ]
140 } 168 }
141 const attach = { 169 const attach = {
@@ -147,6 +175,7 @@ describe('Test videos API validator', function () {
147 it('Should fail with a long description', function (done) { 175 it('Should fail with a long description', function (done) {
148 const data = { 176 const data = {
149 name: 'my super name', 177 name: 'my super name',
178 category: 5,
150 description: 'my super description which is very very very very very very very very very very very very very very' + 179 description: 'my super description which is very very very very very very very very very very very very very very' +
151 'very very very very very very very very very very very very very very very very very very very very very' + 180 'very very very very very very very very very very very very very very very very very very very very very' +
152 'very very very very very very very very very very very very very very very long', 181 'very very very very very very very very very very very very very very very long',
@@ -161,6 +190,7 @@ describe('Test videos API validator', function () {
161 it('Should fail without tags', function (done) { 190 it('Should fail without tags', function (done) {
162 const data = { 191 const data = {
163 name: 'my super name', 192 name: 'my super name',
193 category: 5,
164 description: 'my super description' 194 description: 'my super description'
165 } 195 }
166 const attach = { 196 const attach = {
@@ -172,6 +202,7 @@ describe('Test videos API validator', function () {
172 it('Should fail with too many tags', function (done) { 202 it('Should fail with too many tags', function (done) {
173 const data = { 203 const data = {
174 name: 'my super name', 204 name: 'my super name',
205 category: 5,
175 description: 'my super description', 206 description: 'my super description',
176 tags: [ 'tag1', 'tag2', 'tag3', 'tag4' ] 207 tags: [ 'tag1', 'tag2', 'tag3', 'tag4' ]
177 } 208 }
@@ -184,6 +215,7 @@ describe('Test videos API validator', function () {
184 it('Should fail with not enough tags', function (done) { 215 it('Should fail with not enough tags', function (done) {
185 const data = { 216 const data = {
186 name: 'my super name', 217 name: 'my super name',
218 category: 5,
187 description: 'my super description', 219 description: 'my super description',
188 tags: [ ] 220 tags: [ ]
189 } 221 }
@@ -196,6 +228,7 @@ describe('Test videos API validator', function () {
196 it('Should fail with a tag length too low', function (done) { 228 it('Should fail with a tag length too low', function (done) {
197 const data = { 229 const data = {
198 name: 'my super name', 230 name: 'my super name',
231 category: 5,
199 description: 'my super description', 232 description: 'my super description',
200 tags: [ 'tag1', 't' ] 233 tags: [ 'tag1', 't' ]
201 } 234 }
@@ -208,6 +241,7 @@ describe('Test videos API validator', function () {
208 it('Should fail with a tag length too big', function (done) { 241 it('Should fail with a tag length too big', function (done) {
209 const data = { 242 const data = {
210 name: 'my super name', 243 name: 'my super name',
244 category: 5,
211 description: 'my super description', 245 description: 'my super description',
212 tags: [ 'mysupertagtoolong', 'tag1' ] 246 tags: [ 'mysupertagtoolong', 'tag1' ]
213 } 247 }
@@ -220,6 +254,7 @@ describe('Test videos API validator', function () {
220 it('Should fail with malformed tags', function (done) { 254 it('Should fail with malformed tags', function (done) {
221 const data = { 255 const data = {
222 name: 'my super name', 256 name: 'my super name',
257 category: 5,
223 description: 'my super description', 258 description: 'my super description',
224 tags: [ 'my tag' ] 259 tags: [ 'my tag' ]
225 } 260 }
@@ -232,6 +267,7 @@ describe('Test videos API validator', function () {
232 it('Should fail without an input file', function (done) { 267 it('Should fail without an input file', function (done) {
233 const data = { 268 const data = {
234 name: 'my super name', 269 name: 'my super name',
270 category: 5,
235 description: 'my super description', 271 description: 'my super description',
236 tags: [ 'tag1', 'tag2' ] 272 tags: [ 'tag1', 'tag2' ]
237 } 273 }
@@ -242,6 +278,7 @@ describe('Test videos API validator', function () {
242 it('Should fail without an incorrect input file', function (done) { 278 it('Should fail without an incorrect input file', function (done) {
243 const data = { 279 const data = {
244 name: 'my super name', 280 name: 'my super name',
281 category: 5,
245 description: 'my super description', 282 description: 'my super description',
246 tags: [ 'tag1', 'tag2' ] 283 tags: [ 'tag1', 'tag2' ]
247 } 284 }
@@ -254,6 +291,7 @@ describe('Test videos API validator', function () {
254 it('Should fail with a too big duration', function (done) { 291 it('Should fail with a too big duration', function (done) {
255 const data = { 292 const data = {
256 name: 'my super name', 293 name: 'my super name',
294 category: 5,
257 description: 'my super description', 295 description: 'my super description',
258 tags: [ 'tag1', 'tag2' ] 296 tags: [ 'tag1', 'tag2' ]
259 } 297 }
@@ -266,6 +304,7 @@ describe('Test videos API validator', function () {
266 it('Should succeed with the correct parameters', function (done) { 304 it('Should succeed with the correct parameters', function (done) {
267 const data = { 305 const data = {
268 name: 'my super name', 306 name: 'my super name',
307 category: 5,
269 description: 'my super description', 308 description: 'my super description',
270 tags: [ 'tag1', 'tag2' ] 309 tags: [ 'tag1', 'tag2' ]
271 } 310 }
@@ -302,6 +341,7 @@ describe('Test videos API validator', function () {
302 341
303 it('Should fail without a valid uuid', function (done) { 342 it('Should fail without a valid uuid', function (done) {
304 const data = { 343 const data = {
344 category: 5,
305 description: 'my super description', 345 description: 'my super description',
306 tags: [ 'tag1', 'tag2' ] 346 tags: [ 'tag1', 'tag2' ]
307 } 347 }
@@ -310,6 +350,7 @@ describe('Test videos API validator', function () {
310 350
311 it('Should fail with an unknown id', function (done) { 351 it('Should fail with an unknown id', function (done) {
312 const data = { 352 const data = {
353 category: 5,
313 description: 'my super description', 354 description: 'my super description',
314 tags: [ 'tag1', 'tag2' ] 355 tags: [ 'tag1', 'tag2' ]
315 } 356 }
@@ -319,6 +360,17 @@ describe('Test videos API validator', function () {
319 it('Should fail with a long name', function (done) { 360 it('Should fail with a long name', function (done) {
320 const data = { 361 const data = {
321 name: 'My very very very very very very very very very very very very very very very very long name', 362 name: 'My very very very very very very very very very very very very very very very very long name',
363 category: 5,
364 description: 'my super description',
365 tags: [ 'tag1', 'tag2' ]
366 }
367 requestsUtils.makePutBodyRequest(server.url, path + videoId, server.accessToken, data, done)
368 })
369
370 it('Should fail with a bad category', function (done) {
371 const data = {
372 name: 'my super name',
373 category: 128,
322 description: 'my super description', 374 description: 'my super description',
323 tags: [ 'tag1', 'tag2' ] 375 tags: [ 'tag1', 'tag2' ]
324 } 376 }
@@ -328,6 +380,7 @@ describe('Test videos API validator', function () {
328 it('Should fail with a long description', function (done) { 380 it('Should fail with a long description', function (done) {
329 const data = { 381 const data = {
330 name: 'my super name', 382 name: 'my super name',
383 category: 5,
331 description: 'my super description which is very very very very very very very very very very very very very very' + 384 description: 'my super description which is very very very very very very very very very very very very very very' +
332 'very very very very very very very very very very very very very very very very very very very very very' + 385 'very very very very very very very very very very very very very very very very very very very very very' +
333 'very very very very very very very very very very very very very very very long', 386 'very very very very very very very very very very very very very very very long',
@@ -339,6 +392,7 @@ describe('Test videos API validator', function () {
339 it('Should fail with too many tags', function (done) { 392 it('Should fail with too many tags', function (done) {
340 const data = { 393 const data = {
341 name: 'my super name', 394 name: 'my super name',
395 category: 5,
342 description: 'my super description', 396 description: 'my super description',
343 tags: [ 'tag1', 'tag2', 'tag3', 'tag4' ] 397 tags: [ 'tag1', 'tag2', 'tag3', 'tag4' ]
344 } 398 }
@@ -348,6 +402,7 @@ describe('Test videos API validator', function () {
348 it('Should fail with not enough tags', function (done) { 402 it('Should fail with not enough tags', function (done) {
349 const data = { 403 const data = {
350 name: 'my super name', 404 name: 'my super name',
405 category: 5,
351 description: 'my super description', 406 description: 'my super description',
352 tags: [ ] 407 tags: [ ]
353 } 408 }
@@ -357,6 +412,7 @@ describe('Test videos API validator', function () {
357 it('Should fail with a tag length too low', function (done) { 412 it('Should fail with a tag length too low', function (done) {
358 const data = { 413 const data = {
359 name: 'my super name', 414 name: 'my super name',
415 category: 5,
360 description: 'my super description', 416 description: 'my super description',
361 tags: [ 'tag1', 't' ] 417 tags: [ 'tag1', 't' ]
362 } 418 }
@@ -366,6 +422,7 @@ describe('Test videos API validator', function () {
366 it('Should fail with a tag length too big', function (done) { 422 it('Should fail with a tag length too big', function (done) {
367 const data = { 423 const data = {
368 name: 'my super name', 424 name: 'my super name',
425 category: 5,
369 description: 'my super description', 426 description: 'my super description',
370 tags: [ 'mysupertagtoolong', 'tag1' ] 427 tags: [ 'mysupertagtoolong', 'tag1' ]
371 } 428 }
@@ -375,6 +432,7 @@ describe('Test videos API validator', function () {
375 it('Should fail with malformed tags', function (done) { 432 it('Should fail with malformed tags', function (done) {
376 const data = { 433 const data = {
377 name: 'my super name', 434 name: 'my super name',
435 category: 5,
378 description: 'my super description', 436 description: 'my super description',
379 tags: [ 'my tag' ] 437 tags: [ 'my tag' ]
380 } 438 }