diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-04-07 12:13:37 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-04-07 12:13:37 +0200 |
commit | 3092476e64d09b449b4ad4f5198024afec1b22ca (patch) | |
tree | f2d2bd33578e122188cd2297f60e12813bffdbb7 /server/tests | |
parent | 023553a2bde74c5765b5ea679fc04128c27f18a0 (diff) | |
download | PeerTube-3092476e64d09b449b4ad4f5198024afec1b22ca.tar.gz PeerTube-3092476e64d09b449b4ad4f5198024afec1b22ca.tar.zst PeerTube-3092476e64d09b449b4ad4f5198024afec1b22ca.zip |
Server: add video language attribute
Diffstat (limited to 'server/tests')
-rw-r--r-- | server/tests/api/check-params/videos.js | 56 | ||||
-rw-r--r-- | server/tests/api/multiple-pods.js | 15 | ||||
-rw-r--r-- | server/tests/api/single-pod.js | 29 | ||||
-rw-r--r-- | server/tests/real-world/real-world.js | 3 | ||||
-rw-r--r-- | server/tests/real-world/tools/upload.js | 6 | ||||
-rw-r--r-- | server/tests/utils/videos.js | 15 |
6 files changed, 122 insertions, 2 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' ] |
diff --git a/server/tests/api/multiple-pods.js b/server/tests/api/multiple-pods.js index cc4f7be70..45969e83a 100644 --- a/server/tests/api/multiple-pods.js +++ b/server/tests/api/multiple-pods.js | |||
@@ -84,6 +84,7 @@ describe('Test multiple pods', function () { | |||
84 | name: 'my super name for pod 1', | 84 | name: 'my super name for pod 1', |
85 | category: 5, | 85 | category: 5, |
86 | licence: 4, | 86 | licence: 4, |
87 | language: 9, | ||
87 | nsfw: true, | 88 | nsfw: true, |
88 | description: 'my super description for pod 1', | 89 | description: 'my super description for pod 1', |
89 | tags: [ 'tag1p1', 'tag2p1' ], | 90 | tags: [ 'tag1p1', 'tag2p1' ], |
@@ -113,6 +114,8 @@ describe('Test multiple pods', function () { | |||
113 | expect(video.categoryLabel).to.equal('Sports') | 114 | expect(video.categoryLabel).to.equal('Sports') |
114 | expect(video.licence).to.equal(4) | 115 | expect(video.licence).to.equal(4) |
115 | expect(video.licenceLabel).to.equal('Attribution - Non Commercial') | 116 | expect(video.licenceLabel).to.equal('Attribution - Non Commercial') |
117 | expect(video.language).to.equal(9) | ||
118 | expect(video.languageLabel).to.equal('Japanese') | ||
116 | expect(video.nsfw).to.be.truthy | 119 | expect(video.nsfw).to.be.truthy |
117 | expect(video.description).to.equal('my super description for pod 1') | 120 | expect(video.description).to.equal('my super description for pod 1') |
118 | expect(video.podHost).to.equal('localhost:9001') | 121 | expect(video.podHost).to.equal('localhost:9001') |
@@ -157,6 +160,7 @@ describe('Test multiple pods', function () { | |||
157 | name: 'my super name for pod 2', | 160 | name: 'my super name for pod 2', |
158 | category: 4, | 161 | category: 4, |
159 | licence: 3, | 162 | licence: 3, |
163 | language: 11, | ||
160 | nsfw: true, | 164 | nsfw: true, |
161 | description: 'my super description for pod 2', | 165 | description: 'my super description for pod 2', |
162 | tags: [ 'tag1p2', 'tag2p2', 'tag3p2' ], | 166 | tags: [ 'tag1p2', 'tag2p2', 'tag3p2' ], |
@@ -186,6 +190,8 @@ describe('Test multiple pods', function () { | |||
186 | expect(video.categoryLabel).to.equal('Art') | 190 | expect(video.categoryLabel).to.equal('Art') |
187 | expect(video.licence).to.equal(3) | 191 | expect(video.licence).to.equal(3) |
188 | expect(video.licenceLabel).to.equal('Attribution - No Derivatives') | 192 | expect(video.licenceLabel).to.equal('Attribution - No Derivatives') |
193 | expect(video.language).to.equal(11) | ||
194 | expect(video.languageLabel).to.equal('German') | ||
189 | expect(video.nsfw).to.be.falsy | 195 | expect(video.nsfw).to.be.falsy |
190 | expect(video.description).to.equal('my super description for pod 2') | 196 | expect(video.description).to.equal('my super description for pod 2') |
191 | expect(video.podHost).to.equal('localhost:9002') | 197 | expect(video.podHost).to.equal('localhost:9002') |
@@ -230,6 +236,7 @@ describe('Test multiple pods', function () { | |||
230 | name: 'my super name for pod 3', | 236 | name: 'my super name for pod 3', |
231 | category: 6, | 237 | category: 6, |
232 | licence: 5, | 238 | licence: 5, |
239 | language: 11, | ||
233 | nsfw: true, | 240 | nsfw: true, |
234 | description: 'my super description for pod 3', | 241 | description: 'my super description for pod 3', |
235 | tags: [ 'tag1p3' ], | 242 | tags: [ 'tag1p3' ], |
@@ -242,6 +249,7 @@ describe('Test multiple pods', function () { | |||
242 | name: 'my super name for pod 3-2', | 249 | name: 'my super name for pod 3-2', |
243 | category: 7, | 250 | category: 7, |
244 | licence: 6, | 251 | licence: 6, |
252 | language: 12, | ||
245 | nsfw: false, | 253 | nsfw: false, |
246 | description: 'my super description for pod 3-2', | 254 | description: 'my super description for pod 3-2', |
247 | tags: [ 'tag2p3', 'tag3p3', 'tag4p3' ], | 255 | tags: [ 'tag2p3', 'tag3p3', 'tag4p3' ], |
@@ -281,6 +289,8 @@ describe('Test multiple pods', function () { | |||
281 | expect(video1.categoryLabel).to.equal('Travels') | 289 | expect(video1.categoryLabel).to.equal('Travels') |
282 | expect(video1.licence).to.equal(5) | 290 | expect(video1.licence).to.equal(5) |
283 | expect(video1.licenceLabel).to.equal('Attribution - Non Commercial - Share Alike') | 291 | expect(video1.licenceLabel).to.equal('Attribution - Non Commercial - Share Alike') |
292 | expect(video1.language).to.equal(11) | ||
293 | expect(video1.languageLabel).to.equal('German') | ||
284 | expect(video1.nsfw).to.be.truthy | 294 | expect(video1.nsfw).to.be.truthy |
285 | expect(video1.description).to.equal('my super description for pod 3') | 295 | expect(video1.description).to.equal('my super description for pod 3') |
286 | expect(video1.podHost).to.equal('localhost:9003') | 296 | expect(video1.podHost).to.equal('localhost:9003') |
@@ -296,6 +306,8 @@ describe('Test multiple pods', function () { | |||
296 | expect(video2.categoryLabel).to.equal('Gaming') | 306 | expect(video2.categoryLabel).to.equal('Gaming') |
297 | expect(video2.licence).to.equal(6) | 307 | expect(video2.licence).to.equal(6) |
298 | expect(video2.licenceLabel).to.equal('Attribution - Non Commercial - No Derivatives') | 308 | expect(video2.licenceLabel).to.equal('Attribution - Non Commercial - No Derivatives') |
309 | expect(video2.language).to.equal(12) | ||
310 | expect(video2.languageLabel).to.equal('Korean') | ||
299 | expect(video2.nsfw).to.be.falsy | 311 | expect(video2.nsfw).to.be.falsy |
300 | expect(video2.description).to.equal('my super description for pod 3-2') | 312 | expect(video2.description).to.equal('my super description for pod 3-2') |
301 | expect(video2.podHost).to.equal('localhost:9003') | 313 | expect(video2.podHost).to.equal('localhost:9003') |
@@ -646,6 +658,7 @@ describe('Test multiple pods', function () { | |||
646 | name: 'my super video updated', | 658 | name: 'my super video updated', |
647 | category: 10, | 659 | category: 10, |
648 | licence: 7, | 660 | licence: 7, |
661 | language: 13, | ||
649 | nsfw: true, | 662 | nsfw: true, |
650 | description: 'my super description updated', | 663 | description: 'my super description updated', |
651 | tags: [ 'tagup1', 'tagup2' ] | 664 | tags: [ 'tagup1', 'tagup2' ] |
@@ -677,6 +690,8 @@ describe('Test multiple pods', function () { | |||
677 | expect(videoUpdated.categoryLabel).to.equal('Entertainment') | 690 | expect(videoUpdated.categoryLabel).to.equal('Entertainment') |
678 | expect(videoUpdated.licence).to.equal(7) | 691 | expect(videoUpdated.licence).to.equal(7) |
679 | expect(videoUpdated.licenceLabel).to.equal('Public Domain Dedication') | 692 | expect(videoUpdated.licenceLabel).to.equal('Public Domain Dedication') |
693 | expect(videoUpdated.language).to.equal(13) | ||
694 | expect(videoUpdated.languageLabel).to.equal('French') | ||
680 | expect(videoUpdated.nsfw).to.be.truthy | 695 | expect(videoUpdated.nsfw).to.be.truthy |
681 | expect(videoUpdated.description).to.equal('my super description updated') | 696 | expect(videoUpdated.description).to.equal('my super description updated') |
682 | expect(videoUpdated.tags).to.deep.equal([ 'tagup1', 'tagup2' ]) | 697 | expect(videoUpdated.tags).to.deep.equal([ 'tagup1', 'tagup2' ]) |
diff --git a/server/tests/api/single-pod.js b/server/tests/api/single-pod.js index aff6d56ec..fe388698f 100644 --- a/server/tests/api/single-pod.js +++ b/server/tests/api/single-pod.js | |||
@@ -70,6 +70,19 @@ describe('Test a single pod', function () { | |||
70 | }) | 70 | }) |
71 | }) | 71 | }) |
72 | 72 | ||
73 | it('Should list video languages', function (done) { | ||
74 | videosUtils.getVideoLanguages(server.url, function (err, res) { | ||
75 | if (err) throw err | ||
76 | |||
77 | const languages = res.body | ||
78 | expect(Object.keys(languages)).to.have.length.above(5) | ||
79 | |||
80 | expect(languages[3]).to.equal('Mandarin') | ||
81 | |||
82 | done() | ||
83 | }) | ||
84 | }) | ||
85 | |||
73 | it('Should not have videos', function (done) { | 86 | it('Should not have videos', function (done) { |
74 | videosUtils.getVideosList(server.url, function (err, res) { | 87 | videosUtils.getVideosList(server.url, function (err, res) { |
75 | if (err) throw err | 88 | if (err) throw err |
@@ -110,6 +123,8 @@ describe('Test a single pod', function () { | |||
110 | expect(video.categoryLabel).to.equal('Films') | 123 | expect(video.categoryLabel).to.equal('Films') |
111 | expect(video.licence).to.equal(6) | 124 | expect(video.licence).to.equal(6) |
112 | expect(video.licenceLabel).to.equal('Attribution - Non Commercial - No Derivatives') | 125 | expect(video.licenceLabel).to.equal('Attribution - Non Commercial - No Derivatives') |
126 | expect(video.language).to.equal(3) | ||
127 | expect(video.languageLabel).to.equal('Mandarin') | ||
113 | expect(video.nsfw).to.be.truthy | 128 | expect(video.nsfw).to.be.truthy |
114 | expect(video.description).to.equal('my super description') | 129 | expect(video.description).to.equal('my super description') |
115 | expect(video.podHost).to.equal('localhost:9001') | 130 | expect(video.podHost).to.equal('localhost:9001') |
@@ -150,6 +165,8 @@ describe('Test a single pod', function () { | |||
150 | expect(video.categoryLabel).to.equal('Films') | 165 | expect(video.categoryLabel).to.equal('Films') |
151 | expect(video.licence).to.equal(6) | 166 | expect(video.licence).to.equal(6) |
152 | expect(video.licenceLabel).to.equal('Attribution - Non Commercial - No Derivatives') | 167 | expect(video.licenceLabel).to.equal('Attribution - Non Commercial - No Derivatives') |
168 | expect(video.language).to.equal(3) | ||
169 | expect(video.languageLabel).to.equal('Mandarin') | ||
153 | expect(video.nsfw).to.be.truthy | 170 | expect(video.nsfw).to.be.truthy |
154 | expect(video.description).to.equal('my super description') | 171 | expect(video.description).to.equal('my super description') |
155 | expect(video.podHost).to.equal('localhost:9001') | 172 | expect(video.podHost).to.equal('localhost:9001') |
@@ -194,6 +211,8 @@ describe('Test a single pod', function () { | |||
194 | expect(video.categoryLabel).to.equal('Films') | 211 | expect(video.categoryLabel).to.equal('Films') |
195 | expect(video.licence).to.equal(6) | 212 | expect(video.licence).to.equal(6) |
196 | expect(video.licenceLabel).to.equal('Attribution - Non Commercial - No Derivatives') | 213 | expect(video.licenceLabel).to.equal('Attribution - Non Commercial - No Derivatives') |
214 | expect(video.language).to.equal(3) | ||
215 | expect(video.languageLabel).to.equal('Mandarin') | ||
197 | expect(video.nsfw).to.be.truthy | 216 | expect(video.nsfw).to.be.truthy |
198 | expect(video.description).to.equal('my super description') | 217 | expect(video.description).to.equal('my super description') |
199 | expect(video.podHost).to.equal('localhost:9001') | 218 | expect(video.podHost).to.equal('localhost:9001') |
@@ -254,6 +273,8 @@ describe('Test a single pod', function () { | |||
254 | expect(video.categoryLabel).to.equal('Films') | 273 | expect(video.categoryLabel).to.equal('Films') |
255 | expect(video.licence).to.equal(6) | 274 | expect(video.licence).to.equal(6) |
256 | expect(video.licenceLabel).to.equal('Attribution - Non Commercial - No Derivatives') | 275 | expect(video.licenceLabel).to.equal('Attribution - Non Commercial - No Derivatives') |
276 | expect(video.language).to.equal(3) | ||
277 | expect(video.languageLabel).to.equal('Mandarin') | ||
257 | expect(video.nsfw).to.be.truthy | 278 | expect(video.nsfw).to.be.truthy |
258 | expect(video.description).to.equal('my super description') | 279 | expect(video.description).to.equal('my super description') |
259 | expect(video.podHost).to.equal('localhost:9001') | 280 | expect(video.podHost).to.equal('localhost:9001') |
@@ -352,6 +373,7 @@ describe('Test a single pod', function () { | |||
352 | description: video + ' description', | 373 | description: video + ' description', |
353 | category: 2, | 374 | category: 2, |
354 | licence: 1, | 375 | licence: 1, |
376 | language: 1, | ||
355 | nsfw: true, | 377 | nsfw: true, |
356 | tags: [ 'tag1', 'tag2', 'tag3' ], | 378 | tags: [ 'tag1', 'tag2', 'tag3' ], |
357 | fixture: video | 379 | fixture: video |
@@ -578,6 +600,7 @@ describe('Test a single pod', function () { | |||
578 | name: 'my super video updated', | 600 | name: 'my super video updated', |
579 | category: 4, | 601 | category: 4, |
580 | licence: 2, | 602 | licence: 2, |
603 | language: 5, | ||
581 | nsfw: false, | 604 | nsfw: false, |
582 | description: 'my super description updated', | 605 | description: 'my super description updated', |
583 | tags: [ 'tagup1', 'tagup2' ] | 606 | tags: [ 'tagup1', 'tagup2' ] |
@@ -598,6 +621,8 @@ describe('Test a single pod', function () { | |||
598 | expect(video.categoryLabel).to.equal('Art') | 621 | expect(video.categoryLabel).to.equal('Art') |
599 | expect(video.licence).to.equal(2) | 622 | expect(video.licence).to.equal(2) |
600 | expect(video.licenceLabel).to.equal('Attribution - Share Alike') | 623 | expect(video.licenceLabel).to.equal('Attribution - Share Alike') |
624 | expect(video.language).to.equal(5) | ||
625 | expect(video.languageLabel).to.equal('Arabic') | ||
601 | expect(video.nsfw).to.be.truthy | 626 | expect(video.nsfw).to.be.truthy |
602 | expect(video.description).to.equal('my super description updated') | 627 | expect(video.description).to.equal('my super description updated') |
603 | expect(video.podHost).to.equal('localhost:9001') | 628 | expect(video.podHost).to.equal('localhost:9001') |
@@ -640,6 +665,8 @@ describe('Test a single pod', function () { | |||
640 | expect(video.categoryLabel).to.equal('Art') | 665 | expect(video.categoryLabel).to.equal('Art') |
641 | expect(video.licence).to.equal(2) | 666 | expect(video.licence).to.equal(2) |
642 | expect(video.licenceLabel).to.equal('Attribution - Share Alike') | 667 | expect(video.licenceLabel).to.equal('Attribution - Share Alike') |
668 | expect(video.language).to.equal(5) | ||
669 | expect(video.languageLabel).to.equal('Arabic') | ||
643 | expect(video.nsfw).to.be.truthy | 670 | expect(video.nsfw).to.be.truthy |
644 | expect(video.description).to.equal('my super description updated') | 671 | expect(video.description).to.equal('my super description updated') |
645 | expect(video.podHost).to.equal('localhost:9001') | 672 | expect(video.podHost).to.equal('localhost:9001') |
@@ -672,6 +699,8 @@ describe('Test a single pod', function () { | |||
672 | expect(video.categoryLabel).to.equal('Art') | 699 | expect(video.categoryLabel).to.equal('Art') |
673 | expect(video.licence).to.equal(2) | 700 | expect(video.licence).to.equal(2) |
674 | expect(video.licenceLabel).to.equal('Attribution - Share Alike') | 701 | expect(video.licenceLabel).to.equal('Attribution - Share Alike') |
702 | expect(video.language).to.equal(5) | ||
703 | expect(video.languageLabel).to.equal('Arabic') | ||
675 | expect(video.nsfw).to.be.truthy | 704 | expect(video.nsfw).to.be.truthy |
676 | expect(video.description).to.equal('hello everybody') | 705 | expect(video.description).to.equal('hello everybody') |
677 | expect(video.podHost).to.equal('localhost:9001') | 706 | expect(video.podHost).to.equal('localhost:9001') |
diff --git a/server/tests/real-world/real-world.js b/server/tests/real-world/real-world.js index ddce45cde..21f0732d0 100644 --- a/server/tests/real-world/real-world.js +++ b/server/tests/real-world/real-world.js | |||
@@ -21,7 +21,7 @@ program | |||
21 | .option('-u, --update [weight]', 'Weight for updating videos') | 21 | .option('-u, --update [weight]', 'Weight for updating videos') |
22 | .option('-v, --view [weight]', 'Weight for viewing videos') | 22 | .option('-v, --view [weight]', 'Weight for viewing videos') |
23 | .option('-l, --like [weight]', 'Weight for liking videos') | 23 | .option('-l, --like [weight]', 'Weight for liking videos') |
24 | .option('-s --dislike [weight]', 'Weight for disliking videos') | 24 | .option('-s, --dislike [weight]', 'Weight for disliking videos') |
25 | .option('-p, --pods [n]', 'Number of pods to run (3 or 6)', /^3|6$/, 3) | 25 | .option('-p, --pods [n]', 'Number of pods to run (3 or 6)', /^3|6$/, 3) |
26 | .option('-a, --action [interval]', 'Interval in ms for an action') | 26 | .option('-a, --action [interval]', 'Interval in ms for an action') |
27 | .option('-i, --integrity [interval]', 'Interval in ms for an integrity check') | 27 | .option('-i, --integrity [interval]', 'Interval in ms for an integrity check') |
@@ -207,6 +207,7 @@ function upload (servers, numServer, callback) { | |||
207 | category: 4, | 207 | category: 4, |
208 | nsfw: false, | 208 | nsfw: false, |
209 | licence: 2, | 209 | licence: 2, |
210 | language: 1, | ||
210 | description: Date.now() + ' description', | 211 | description: Date.now() + ' description', |
211 | tags: [ Date.now().toString().substring(0, 5) + 't1', Date.now().toString().substring(0, 5) + 't2' ], | 212 | tags: [ Date.now().toString().substring(0, 5) + 't1', Date.now().toString().substring(0, 5) + 't2' ], |
212 | fixture: 'video_short1.webm' | 213 | fixture: 'video_short1.webm' |
diff --git a/server/tests/real-world/tools/upload.js b/server/tests/real-world/tools/upload.js index 4b6dbe603..efb91e228 100644 --- a/server/tests/real-world/tools/upload.js +++ b/server/tests/real-world/tools/upload.js | |||
@@ -12,6 +12,7 @@ program | |||
12 | .option('-x, --nsfw', 'Video is Not Safe For Work') | 12 | .option('-x, --nsfw', 'Video is Not Safe For Work') |
13 | .option('-c, --category <category number>', 'Category number') | 13 | .option('-c, --category <category number>', 'Category number') |
14 | .option('-l, --licence <licence number>', 'Licence number') | 14 | .option('-l, --licence <licence number>', 'Licence number') |
15 | .option('-g, --language <language number>', 'Language number') | ||
15 | .option('-d, --description <description>', 'Video description') | 16 | .option('-d, --description <description>', 'Video description') |
16 | .option('-t, --tags <tags>', 'Video tags', list) | 17 | .option('-t, --tags <tags>', 'Video tags', list) |
17 | .option('-f, --file <file>', 'Video absolute file path') | 18 | .option('-f, --file <file>', 'Video absolute file path') |
@@ -23,6 +24,7 @@ if ( | |||
23 | !program.name || | 24 | !program.name || |
24 | !program.category || | 25 | !program.category || |
25 | !program.licence || | 26 | !program.licence || |
27 | !program.language || | ||
26 | !program.nsfw || | 28 | !program.nsfw || |
27 | !program.description || | 29 | !program.description || |
28 | !program.tags || | 30 | !program.tags || |
@@ -42,6 +44,7 @@ fs.access(program.file, fs.F_OK, function (err) { | |||
42 | program.name, | 44 | program.name, |
43 | program.category, | 45 | program.category, |
44 | program.licence, | 46 | program.licence, |
47 | program.language, | ||
45 | program.nsfw, | 48 | program.nsfw, |
46 | program.description, | 49 | program.description, |
47 | program.tags, | 50 | program.tags, |
@@ -55,13 +58,14 @@ function list (val) { | |||
55 | return val.split(',') | 58 | return val.split(',') |
56 | } | 59 | } |
57 | 60 | ||
58 | function upload (url, accessToken, name, category, licence, nsfw, description, tags, fixture) { | 61 | function upload (url, accessToken, name, category, licence, language, nsfw, description, tags, fixture) { |
59 | console.log('Uploading %s video...', program.name) | 62 | console.log('Uploading %s video...', program.name) |
60 | 63 | ||
61 | const videoAttributes = { | 64 | const videoAttributes = { |
62 | name, | 65 | name, |
63 | category, | 66 | category, |
64 | licence, | 67 | licence, |
68 | language, | ||
65 | nsfw, | 69 | nsfw, |
66 | description, | 70 | description, |
67 | tags, | 71 | tags, |
diff --git a/server/tests/utils/videos.js b/server/tests/utils/videos.js index 3c7d99eec..f0eeec497 100644 --- a/server/tests/utils/videos.js +++ b/server/tests/utils/videos.js | |||
@@ -7,6 +7,7 @@ const request = require('supertest') | |||
7 | const videosUtils = { | 7 | const videosUtils = { |
8 | getVideoCategories, | 8 | getVideoCategories, |
9 | getVideoLicences, | 9 | getVideoLicences, |
10 | getVideoLanguages, | ||
10 | getAllVideosListBy, | 11 | getAllVideosListBy, |
11 | getVideo, | 12 | getVideo, |
12 | getVideosList, | 13 | getVideosList, |
@@ -46,6 +47,17 @@ function getVideoLicences (url, end) { | |||
46 | .end(end) | 47 | .end(end) |
47 | } | 48 | } |
48 | 49 | ||
50 | function getVideoLanguages (url, end) { | ||
51 | const path = '/api/v1/videos/languages' | ||
52 | |||
53 | request(url) | ||
54 | .get(path) | ||
55 | .set('Accept', 'application/json') | ||
56 | .expect(200) | ||
57 | .expect('Content-Type', /json/) | ||
58 | .end(end) | ||
59 | } | ||
60 | |||
49 | function getAllVideosListBy (url, end) { | 61 | function getAllVideosListBy (url, end) { |
50 | const path = '/api/v1/videos' | 62 | const path = '/api/v1/videos' |
51 | 63 | ||
@@ -218,6 +230,7 @@ function uploadVideo (url, accessToken, videoAttributesArg, specialStatus, end) | |||
218 | name: 'my super video', | 230 | name: 'my super video', |
219 | category: 5, | 231 | category: 5, |
220 | licence: 4, | 232 | licence: 4, |
233 | language: 3, | ||
221 | nsfw: true, | 234 | nsfw: true, |
222 | description: 'my super description', | 235 | description: 'my super description', |
223 | tags: [ 'tag' ], | 236 | tags: [ 'tag' ], |
@@ -232,6 +245,7 @@ function uploadVideo (url, accessToken, videoAttributesArg, specialStatus, end) | |||
232 | .field('name', attributes.name) | 245 | .field('name', attributes.name) |
233 | .field('category', attributes.category) | 246 | .field('category', attributes.category) |
234 | .field('licence', attributes.licence) | 247 | .field('licence', attributes.licence) |
248 | .field('language', attributes.language) | ||
235 | .field('nsfw', attributes.nsfw) | 249 | .field('nsfw', attributes.nsfw) |
236 | .field('description', attributes.description) | 250 | .field('description', attributes.description) |
237 | 251 | ||
@@ -267,6 +281,7 @@ function updateVideo (url, accessToken, id, attributes, specialStatus, end) { | |||
267 | if (attributes.name) req.field('name', attributes.name) | 281 | if (attributes.name) req.field('name', attributes.name) |
268 | if (attributes.category) req.field('category', attributes.category) | 282 | if (attributes.category) req.field('category', attributes.category) |
269 | if (attributes.licence) req.field('licence', attributes.licence) | 283 | if (attributes.licence) req.field('licence', attributes.licence) |
284 | if (attributes.language) req.field('language', attributes.language) | ||
270 | if (attributes.nsfw) req.field('nsfw', attributes.nsfw) | 285 | if (attributes.nsfw) req.field('nsfw', attributes.nsfw) |
271 | if (attributes.description) req.field('description', attributes.description) | 286 | if (attributes.description) req.field('description', attributes.description) |
272 | 287 | ||