aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/check-params
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-03-27 20:53:11 +0200
committerChocobozzz <florian.bigard@gmail.com>2017-03-27 20:53:11 +0200
commit6f0c39e2de400685b7baf8340b9e132f2659365a (patch)
treeb036c6ebf65ff4cb7f5649fc48a0b7201370bddd /server/tests/api/check-params
parent28974889281523eec5b00dd5596c67d99c5167e5 (diff)
downloadPeerTube-6f0c39e2de400685b7baf8340b9e132f2659365a.tar.gz
PeerTube-6f0c39e2de400685b7baf8340b9e132f2659365a.tar.zst
PeerTube-6f0c39e2de400685b7baf8340b9e132f2659365a.zip
Server: add licence video attribute
Diffstat (limited to 'server/tests/api/check-params')
-rw-r--r--server/tests/api/check-params/videos.js59
1 files changed, 59 insertions, 0 deletions
diff --git a/server/tests/api/check-params/videos.js b/server/tests/api/check-params/videos.js
index 03b4db3fe..e58f9893b 100644
--- a/server/tests/api/check-params/videos.js
+++ b/server/tests/api/check-params/videos.js
@@ -113,6 +113,7 @@ describe('Test videos API validator', function () {
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 category: 5,
116 licence: 1,
116 description: 'my super description', 117 description: 'my super description',
117 tags: [ 'tag1', 'tag2' ] 118 tags: [ 'tag1', 'tag2' ]
118 } 119 }
@@ -126,6 +127,7 @@ describe('Test videos API validator', function () {
126 const data = { 127 const data = {
127 name: 'My very very very very very very very very very very very very very very very very long name', 128 name: 'My very very very very very very very very very very very very very very very very long name',
128 category: 5, 129 category: 5,
130 licence: 1,
129 description: 'my super description', 131 description: 'my super description',
130 tags: [ 'tag1', 'tag2' ] 132 tags: [ 'tag1', 'tag2' ]
131 } 133 }
@@ -138,6 +140,7 @@ describe('Test videos API validator', function () {
138 it('Should fail without a category', function (done) { 140 it('Should fail without a category', function (done) {
139 const data = { 141 const data = {
140 name: 'my super name', 142 name: 'my super name',
143 licence: 1,
141 description: 'my super description', 144 description: 'my super description',
142 tags: [ 'tag1', 'tag2' ] 145 tags: [ 'tag1', 'tag2' ]
143 } 146 }
@@ -151,6 +154,34 @@ describe('Test videos API validator', function () {
151 const data = { 154 const data = {
152 name: 'my super name', 155 name: 'my super name',
153 category: 125, 156 category: 125,
157 licence: 1,
158 description: 'my super description',
159 tags: [ 'tag1', 'tag2' ]
160 }
161 const attach = {
162 'videofile': pathUtils.join(__dirname, '..', 'fixtures', 'video_short.webm')
163 }
164 requestsUtils.makePostUploadRequest(server.url, path, server.accessToken, data, attach, done)
165 })
166
167 it('Should fail without a licence', function (done) {
168 const data = {
169 name: 'my super name',
170 category: 5,
171 description: 'my super description',
172 tags: [ 'tag1', 'tag2' ]
173 }
174 const attach = {
175 'videofile': pathUtils.join(__dirname, '..', 'fixtures', 'video_short.webm')
176 }
177 requestsUtils.makePostUploadRequest(server.url, path, server.accessToken, data, attach, done)
178 })
179
180 it('Should fail with a bad licence', function (done) {
181 const data = {
182 name: 'my super name',
183 category: 5,
184 licence: 125,
154 description: 'my super description', 185 description: 'my super description',
155 tags: [ 'tag1', 'tag2' ] 186 tags: [ 'tag1', 'tag2' ]
156 } 187 }
@@ -164,6 +195,7 @@ describe('Test videos API validator', function () {
164 const data = { 195 const data = {
165 name: 'my super name', 196 name: 'my super name',
166 category: 5, 197 category: 5,
198 licence: 1,
167 tags: [ 'tag1', 'tag2' ] 199 tags: [ 'tag1', 'tag2' ]
168 } 200 }
169 const attach = { 201 const attach = {
@@ -176,6 +208,7 @@ describe('Test videos API validator', function () {
176 const data = { 208 const data = {
177 name: 'my super name', 209 name: 'my super name',
178 category: 5, 210 category: 5,
211 licence: 1,
179 description: 'my super description which is very very very very very very very very very very very very very very' + 212 description: 'my super description which is 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' + 213 'very very very very very very very very very very very very very very very very very very very very very' +
181 'very very very very very very very very very very very very very very very long', 214 'very very very very very very very very very very very very very very very long',
@@ -191,6 +224,7 @@ describe('Test videos API validator', function () {
191 const data = { 224 const data = {
192 name: 'my super name', 225 name: 'my super name',
193 category: 5, 226 category: 5,
227 licence: 1,
194 description: 'my super description', 228 description: 'my super description',
195 tags: [ 'tag1', 'tag2', 'tag3', 'tag4' ] 229 tags: [ 'tag1', 'tag2', 'tag3', 'tag4' ]
196 } 230 }
@@ -204,6 +238,7 @@ describe('Test videos API validator', function () {
204 const data = { 238 const data = {
205 name: 'my super name', 239 name: 'my super name',
206 category: 5, 240 category: 5,
241 licence: 1,
207 description: 'my super description', 242 description: 'my super description',
208 tags: [ 'tag1', 't' ] 243 tags: [ 'tag1', 't' ]
209 } 244 }
@@ -217,6 +252,7 @@ describe('Test videos API validator', function () {
217 const data = { 252 const data = {
218 name: 'my super name', 253 name: 'my super name',
219 category: 5, 254 category: 5,
255 licence: 1,
220 description: 'my super description', 256 description: 'my super description',
221 tags: [ 'mysupertagtoolong', 'tag1' ] 257 tags: [ 'mysupertagtoolong', 'tag1' ]
222 } 258 }
@@ -230,6 +266,7 @@ describe('Test videos API validator', function () {
230 const data = { 266 const data = {
231 name: 'my super name', 267 name: 'my super name',
232 category: 5, 268 category: 5,
269 licence: 1,
233 description: 'my super description', 270 description: 'my super description',
234 tags: [ 'tag1', 'tag2' ] 271 tags: [ 'tag1', 'tag2' ]
235 } 272 }
@@ -241,6 +278,7 @@ describe('Test videos API validator', function () {
241 const data = { 278 const data = {
242 name: 'my super name', 279 name: 'my super name',
243 category: 5, 280 category: 5,
281 licence: 1,
244 description: 'my super description', 282 description: 'my super description',
245 tags: [ 'tag1', 'tag2' ] 283 tags: [ 'tag1', 'tag2' ]
246 } 284 }
@@ -254,6 +292,7 @@ describe('Test videos API validator', function () {
254 const data = { 292 const data = {
255 name: 'my super name', 293 name: 'my super name',
256 category: 5, 294 category: 5,
295 licence: 1,
257 description: 'my super description', 296 description: 'my super description',
258 tags: [ 'tag1', 'tag2' ] 297 tags: [ 'tag1', 'tag2' ]
259 } 298 }
@@ -267,6 +306,7 @@ describe('Test videos API validator', function () {
267 const data = { 306 const data = {
268 name: 'my super name', 307 name: 'my super name',
269 category: 5, 308 category: 5,
309 licence: 1,
270 description: 'my super description', 310 description: 'my super description',
271 tags: [ 'tag1', 'tag2' ] 311 tags: [ 'tag1', 'tag2' ]
272 } 312 }
@@ -304,6 +344,7 @@ describe('Test videos API validator', function () {
304 it('Should fail without a valid uuid', function (done) { 344 it('Should fail without a valid uuid', function (done) {
305 const data = { 345 const data = {
306 category: 5, 346 category: 5,
347 licence: 2,
307 description: 'my super description', 348 description: 'my super description',
308 tags: [ 'tag1', 'tag2' ] 349 tags: [ 'tag1', 'tag2' ]
309 } 350 }
@@ -313,6 +354,7 @@ describe('Test videos API validator', function () {
313 it('Should fail with an unknown id', function (done) { 354 it('Should fail with an unknown id', function (done) {
314 const data = { 355 const data = {
315 category: 5, 356 category: 5,
357 licence: 2,
316 description: 'my super description', 358 description: 'my super description',
317 tags: [ 'tag1', 'tag2' ] 359 tags: [ 'tag1', 'tag2' ]
318 } 360 }
@@ -323,6 +365,7 @@ describe('Test videos API validator', function () {
323 const data = { 365 const data = {
324 name: 'My very very very very very very very very very very very very very very very very long name', 366 name: 'My very very very very very very very very very very very very very very very very long name',
325 category: 5, 367 category: 5,
368 licence: 2,
326 description: 'my super description', 369 description: 'my super description',
327 tags: [ 'tag1', 'tag2' ] 370 tags: [ 'tag1', 'tag2' ]
328 } 371 }
@@ -333,6 +376,18 @@ describe('Test videos API validator', function () {
333 const data = { 376 const data = {
334 name: 'my super name', 377 name: 'my super name',
335 category: 128, 378 category: 128,
379 licence: 2,
380 description: 'my super description',
381 tags: [ 'tag1', 'tag2' ]
382 }
383 requestsUtils.makePutBodyRequest(server.url, path + videoId, server.accessToken, data, done)
384 })
385
386 it('Should fail with a bad licence', function (done) {
387 const data = {
388 name: 'my super name',
389 category: 5,
390 licence: 128,
336 description: 'my super description', 391 description: 'my super description',
337 tags: [ 'tag1', 'tag2' ] 392 tags: [ 'tag1', 'tag2' ]
338 } 393 }
@@ -343,6 +398,7 @@ describe('Test videos API validator', function () {
343 const data = { 398 const data = {
344 name: 'my super name', 399 name: 'my super name',
345 category: 5, 400 category: 5,
401 licence: 2,
346 description: 'my super description which is very very very very very very very very very very very very very very' + 402 description: 'my super description which is very very very very very very very very very very very very very very' +
347 'very very very very very very very 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' +
348 'very very very very very very very very very very very very very very very long', 404 'very very very very very very very very very very very very very very very long',
@@ -355,6 +411,7 @@ describe('Test videos API validator', function () {
355 const data = { 411 const data = {
356 name: 'my super name', 412 name: 'my super name',
357 category: 5, 413 category: 5,
414 licence: 2,
358 description: 'my super description', 415 description: 'my super description',
359 tags: [ 'tag1', 'tag2', 'tag3', 'tag4' ] 416 tags: [ 'tag1', 'tag2', 'tag3', 'tag4' ]
360 } 417 }
@@ -365,6 +422,7 @@ describe('Test videos API validator', function () {
365 const data = { 422 const data = {
366 name: 'my super name', 423 name: 'my super name',
367 category: 5, 424 category: 5,
425 licence: 2,
368 description: 'my super description', 426 description: 'my super description',
369 tags: [ 'tag1', 't' ] 427 tags: [ 'tag1', 't' ]
370 } 428 }
@@ -375,6 +433,7 @@ describe('Test videos API validator', function () {
375 const data = { 433 const data = {
376 name: 'my super name', 434 name: 'my super name',
377 category: 5, 435 category: 5,
436 licence: 2,
378 description: 'my super description', 437 description: 'my super description',
379 tags: [ 'mysupertagtoolong', 'tag1' ] 438 tags: [ 'mysupertagtoolong', 'tag1' ]
380 } 439 }