aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests')
-rw-r--r--server/tests/api/check-params/videos.js65
-rw-r--r--server/tests/api/multiple-pods.js10
-rw-r--r--server/tests/api/single-pod.js10
-rw-r--r--server/tests/real-world/real-world.js1
-rw-r--r--server/tests/real-world/tools/upload.js6
-rw-r--r--server/tests/utils/videos.js3
6 files changed, 94 insertions, 1 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 }
diff --git a/server/tests/api/multiple-pods.js b/server/tests/api/multiple-pods.js
index 69ef38c20..cc4f7be70 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 nsfw: true,
87 description: 'my super description for pod 1', 88 description: 'my super description for pod 1',
88 tags: [ 'tag1p1', 'tag2p1' ], 89 tags: [ 'tag1p1', 'tag2p1' ],
89 fixture: 'video_short1.webm' 90 fixture: 'video_short1.webm'
@@ -112,6 +113,7 @@ describe('Test multiple pods', function () {
112 expect(video.categoryLabel).to.equal('Sports') 113 expect(video.categoryLabel).to.equal('Sports')
113 expect(video.licence).to.equal(4) 114 expect(video.licence).to.equal(4)
114 expect(video.licenceLabel).to.equal('Attribution - Non Commercial') 115 expect(video.licenceLabel).to.equal('Attribution - Non Commercial')
116 expect(video.nsfw).to.be.truthy
115 expect(video.description).to.equal('my super description for pod 1') 117 expect(video.description).to.equal('my super description for pod 1')
116 expect(video.podHost).to.equal('localhost:9001') 118 expect(video.podHost).to.equal('localhost:9001')
117 expect(video.magnetUri).to.exist 119 expect(video.magnetUri).to.exist
@@ -155,6 +157,7 @@ describe('Test multiple pods', function () {
155 name: 'my super name for pod 2', 157 name: 'my super name for pod 2',
156 category: 4, 158 category: 4,
157 licence: 3, 159 licence: 3,
160 nsfw: true,
158 description: 'my super description for pod 2', 161 description: 'my super description for pod 2',
159 tags: [ 'tag1p2', 'tag2p2', 'tag3p2' ], 162 tags: [ 'tag1p2', 'tag2p2', 'tag3p2' ],
160 fixture: 'video_short2.webm' 163 fixture: 'video_short2.webm'
@@ -183,6 +186,7 @@ describe('Test multiple pods', function () {
183 expect(video.categoryLabel).to.equal('Art') 186 expect(video.categoryLabel).to.equal('Art')
184 expect(video.licence).to.equal(3) 187 expect(video.licence).to.equal(3)
185 expect(video.licenceLabel).to.equal('Attribution - No Derivatives') 188 expect(video.licenceLabel).to.equal('Attribution - No Derivatives')
189 expect(video.nsfw).to.be.falsy
186 expect(video.description).to.equal('my super description for pod 2') 190 expect(video.description).to.equal('my super description for pod 2')
187 expect(video.podHost).to.equal('localhost:9002') 191 expect(video.podHost).to.equal('localhost:9002')
188 expect(video.magnetUri).to.exist 192 expect(video.magnetUri).to.exist
@@ -226,6 +230,7 @@ describe('Test multiple pods', function () {
226 name: 'my super name for pod 3', 230 name: 'my super name for pod 3',
227 category: 6, 231 category: 6,
228 licence: 5, 232 licence: 5,
233 nsfw: true,
229 description: 'my super description for pod 3', 234 description: 'my super description for pod 3',
230 tags: [ 'tag1p3' ], 235 tags: [ 'tag1p3' ],
231 fixture: 'video_short3.webm' 236 fixture: 'video_short3.webm'
@@ -237,6 +242,7 @@ describe('Test multiple pods', function () {
237 name: 'my super name for pod 3-2', 242 name: 'my super name for pod 3-2',
238 category: 7, 243 category: 7,
239 licence: 6, 244 licence: 6,
245 nsfw: false,
240 description: 'my super description for pod 3-2', 246 description: 'my super description for pod 3-2',
241 tags: [ 'tag2p3', 'tag3p3', 'tag4p3' ], 247 tags: [ 'tag2p3', 'tag3p3', 'tag4p3' ],
242 fixture: 'video_short.webm' 248 fixture: 'video_short.webm'
@@ -275,6 +281,7 @@ describe('Test multiple pods', function () {
275 expect(video1.categoryLabel).to.equal('Travels') 281 expect(video1.categoryLabel).to.equal('Travels')
276 expect(video1.licence).to.equal(5) 282 expect(video1.licence).to.equal(5)
277 expect(video1.licenceLabel).to.equal('Attribution - Non Commercial - Share Alike') 283 expect(video1.licenceLabel).to.equal('Attribution - Non Commercial - Share Alike')
284 expect(video1.nsfw).to.be.truthy
278 expect(video1.description).to.equal('my super description for pod 3') 285 expect(video1.description).to.equal('my super description for pod 3')
279 expect(video1.podHost).to.equal('localhost:9003') 286 expect(video1.podHost).to.equal('localhost:9003')
280 expect(video1.magnetUri).to.exist 287 expect(video1.magnetUri).to.exist
@@ -289,6 +296,7 @@ describe('Test multiple pods', function () {
289 expect(video2.categoryLabel).to.equal('Gaming') 296 expect(video2.categoryLabel).to.equal('Gaming')
290 expect(video2.licence).to.equal(6) 297 expect(video2.licence).to.equal(6)
291 expect(video2.licenceLabel).to.equal('Attribution - Non Commercial - No Derivatives') 298 expect(video2.licenceLabel).to.equal('Attribution - Non Commercial - No Derivatives')
299 expect(video2.nsfw).to.be.falsy
292 expect(video2.description).to.equal('my super description for pod 3-2') 300 expect(video2.description).to.equal('my super description for pod 3-2')
293 expect(video2.podHost).to.equal('localhost:9003') 301 expect(video2.podHost).to.equal('localhost:9003')
294 expect(video2.magnetUri).to.exist 302 expect(video2.magnetUri).to.exist
@@ -638,6 +646,7 @@ describe('Test multiple pods', function () {
638 name: 'my super video updated', 646 name: 'my super video updated',
639 category: 10, 647 category: 10,
640 licence: 7, 648 licence: 7,
649 nsfw: true,
641 description: 'my super description updated', 650 description: 'my super description updated',
642 tags: [ 'tagup1', 'tagup2' ] 651 tags: [ 'tagup1', 'tagup2' ]
643 } 652 }
@@ -668,6 +677,7 @@ describe('Test multiple pods', function () {
668 expect(videoUpdated.categoryLabel).to.equal('Entertainment') 677 expect(videoUpdated.categoryLabel).to.equal('Entertainment')
669 expect(videoUpdated.licence).to.equal(7) 678 expect(videoUpdated.licence).to.equal(7)
670 expect(videoUpdated.licenceLabel).to.equal('Public Domain Dedication') 679 expect(videoUpdated.licenceLabel).to.equal('Public Domain Dedication')
680 expect(videoUpdated.nsfw).to.be.truthy
671 expect(videoUpdated.description).to.equal('my super description updated') 681 expect(videoUpdated.description).to.equal('my super description updated')
672 expect(videoUpdated.tags).to.deep.equal([ 'tagup1', 'tagup2' ]) 682 expect(videoUpdated.tags).to.deep.equal([ 'tagup1', 'tagup2' ])
673 expect(miscsUtils.dateIsValid(videoUpdated.updatedAt, 20000)).to.be.true 683 expect(miscsUtils.dateIsValid(videoUpdated.updatedAt, 20000)).to.be.true
diff --git a/server/tests/api/single-pod.js b/server/tests/api/single-pod.js
index 6d7ebdc9b..aff6d56ec 100644
--- a/server/tests/api/single-pod.js
+++ b/server/tests/api/single-pod.js
@@ -86,6 +86,7 @@ describe('Test a single pod', function () {
86 const videoAttributes = { 86 const videoAttributes = {
87 name: 'my super name', 87 name: 'my super name',
88 category: 2, 88 category: 2,
89 nsfw: true,
89 licence: 6, 90 licence: 6,
90 tags: [ 'tag1', 'tag2', 'tag3' ] 91 tags: [ 'tag1', 'tag2', 'tag3' ]
91 } 92 }
@@ -109,6 +110,7 @@ describe('Test a single pod', function () {
109 expect(video.categoryLabel).to.equal('Films') 110 expect(video.categoryLabel).to.equal('Films')
110 expect(video.licence).to.equal(6) 111 expect(video.licence).to.equal(6)
111 expect(video.licenceLabel).to.equal('Attribution - Non Commercial - No Derivatives') 112 expect(video.licenceLabel).to.equal('Attribution - Non Commercial - No Derivatives')
113 expect(video.nsfw).to.be.truthy
112 expect(video.description).to.equal('my super description') 114 expect(video.description).to.equal('my super description')
113 expect(video.podHost).to.equal('localhost:9001') 115 expect(video.podHost).to.equal('localhost:9001')
114 expect(video.magnetUri).to.exist 116 expect(video.magnetUri).to.exist
@@ -148,6 +150,7 @@ describe('Test a single pod', function () {
148 expect(video.categoryLabel).to.equal('Films') 150 expect(video.categoryLabel).to.equal('Films')
149 expect(video.licence).to.equal(6) 151 expect(video.licence).to.equal(6)
150 expect(video.licenceLabel).to.equal('Attribution - Non Commercial - No Derivatives') 152 expect(video.licenceLabel).to.equal('Attribution - Non Commercial - No Derivatives')
153 expect(video.nsfw).to.be.truthy
151 expect(video.description).to.equal('my super description') 154 expect(video.description).to.equal('my super description')
152 expect(video.podHost).to.equal('localhost:9001') 155 expect(video.podHost).to.equal('localhost:9001')
153 expect(video.magnetUri).to.exist 156 expect(video.magnetUri).to.exist
@@ -191,6 +194,7 @@ describe('Test a single pod', function () {
191 expect(video.categoryLabel).to.equal('Films') 194 expect(video.categoryLabel).to.equal('Films')
192 expect(video.licence).to.equal(6) 195 expect(video.licence).to.equal(6)
193 expect(video.licenceLabel).to.equal('Attribution - Non Commercial - No Derivatives') 196 expect(video.licenceLabel).to.equal('Attribution - Non Commercial - No Derivatives')
197 expect(video.nsfw).to.be.truthy
194 expect(video.description).to.equal('my super description') 198 expect(video.description).to.equal('my super description')
195 expect(video.podHost).to.equal('localhost:9001') 199 expect(video.podHost).to.equal('localhost:9001')
196 expect(video.author).to.equal('root') 200 expect(video.author).to.equal('root')
@@ -250,6 +254,7 @@ describe('Test a single pod', function () {
250 expect(video.categoryLabel).to.equal('Films') 254 expect(video.categoryLabel).to.equal('Films')
251 expect(video.licence).to.equal(6) 255 expect(video.licence).to.equal(6)
252 expect(video.licenceLabel).to.equal('Attribution - Non Commercial - No Derivatives') 256 expect(video.licenceLabel).to.equal('Attribution - Non Commercial - No Derivatives')
257 expect(video.nsfw).to.be.truthy
253 expect(video.description).to.equal('my super description') 258 expect(video.description).to.equal('my super description')
254 expect(video.podHost).to.equal('localhost:9001') 259 expect(video.podHost).to.equal('localhost:9001')
255 expect(video.author).to.equal('root') 260 expect(video.author).to.equal('root')
@@ -347,6 +352,7 @@ describe('Test a single pod', function () {
347 description: video + ' description', 352 description: video + ' description',
348 category: 2, 353 category: 2,
349 licence: 1, 354 licence: 1,
355 nsfw: true,
350 tags: [ 'tag1', 'tag2', 'tag3' ], 356 tags: [ 'tag1', 'tag2', 'tag3' ],
351 fixture: video 357 fixture: video
352 } 358 }
@@ -572,6 +578,7 @@ describe('Test a single pod', function () {
572 name: 'my super video updated', 578 name: 'my super video updated',
573 category: 4, 579 category: 4,
574 licence: 2, 580 licence: 2,
581 nsfw: false,
575 description: 'my super description updated', 582 description: 'my super description updated',
576 tags: [ 'tagup1', 'tagup2' ] 583 tags: [ 'tagup1', 'tagup2' ]
577 } 584 }
@@ -591,6 +598,7 @@ describe('Test a single pod', function () {
591 expect(video.categoryLabel).to.equal('Art') 598 expect(video.categoryLabel).to.equal('Art')
592 expect(video.licence).to.equal(2) 599 expect(video.licence).to.equal(2)
593 expect(video.licenceLabel).to.equal('Attribution - Share Alike') 600 expect(video.licenceLabel).to.equal('Attribution - Share Alike')
601 expect(video.nsfw).to.be.truthy
594 expect(video.description).to.equal('my super description updated') 602 expect(video.description).to.equal('my super description updated')
595 expect(video.podHost).to.equal('localhost:9001') 603 expect(video.podHost).to.equal('localhost:9001')
596 expect(video.author).to.equal('root') 604 expect(video.author).to.equal('root')
@@ -632,6 +640,7 @@ describe('Test a single pod', function () {
632 expect(video.categoryLabel).to.equal('Art') 640 expect(video.categoryLabel).to.equal('Art')
633 expect(video.licence).to.equal(2) 641 expect(video.licence).to.equal(2)
634 expect(video.licenceLabel).to.equal('Attribution - Share Alike') 642 expect(video.licenceLabel).to.equal('Attribution - Share Alike')
643 expect(video.nsfw).to.be.truthy
635 expect(video.description).to.equal('my super description updated') 644 expect(video.description).to.equal('my super description updated')
636 expect(video.podHost).to.equal('localhost:9001') 645 expect(video.podHost).to.equal('localhost:9001')
637 expect(video.author).to.equal('root') 646 expect(video.author).to.equal('root')
@@ -663,6 +672,7 @@ describe('Test a single pod', function () {
663 expect(video.categoryLabel).to.equal('Art') 672 expect(video.categoryLabel).to.equal('Art')
664 expect(video.licence).to.equal(2) 673 expect(video.licence).to.equal(2)
665 expect(video.licenceLabel).to.equal('Attribution - Share Alike') 674 expect(video.licenceLabel).to.equal('Attribution - Share Alike')
675 expect(video.nsfw).to.be.truthy
666 expect(video.description).to.equal('hello everybody') 676 expect(video.description).to.equal('hello everybody')
667 expect(video.podHost).to.equal('localhost:9001') 677 expect(video.podHost).to.equal('localhost:9001')
668 expect(video.author).to.equal('root') 678 expect(video.author).to.equal('root')
diff --git a/server/tests/real-world/real-world.js b/server/tests/real-world/real-world.js
index 7777768c8..ddce45cde 100644
--- a/server/tests/real-world/real-world.js
+++ b/server/tests/real-world/real-world.js
@@ -205,6 +205,7 @@ function upload (servers, numServer, callback) {
205 const videoAttributes = { 205 const videoAttributes = {
206 name: Date.now() + ' name', 206 name: Date.now() + ' name',
207 category: 4, 207 category: 4,
208 nsfw: false,
208 licence: 2, 209 licence: 2,
209 description: Date.now() + ' description', 210 description: Date.now() + ' description',
210 tags: [ Date.now().toString().substring(0, 5) + 't1', Date.now().toString().substring(0, 5) + 't2' ], 211 tags: [ Date.now().toString().substring(0, 5) + 't1', Date.now().toString().substring(0, 5) + 't2' ],
diff --git a/server/tests/real-world/tools/upload.js b/server/tests/real-world/tools/upload.js
index 7b97ebf0b..4b6dbe603 100644
--- a/server/tests/real-world/tools/upload.js
+++ b/server/tests/real-world/tools/upload.js
@@ -9,6 +9,7 @@ program
9 .option('-u, --url <url>', 'Server url') 9 .option('-u, --url <url>', 'Server url')
10 .option('-a, --access-token <token>', 'Access token') 10 .option('-a, --access-token <token>', 'Access token')
11 .option('-n, --name <name>', 'Video name') 11 .option('-n, --name <name>', 'Video name')
12 .option('-x, --nsfw', 'Video is Not Safe For Work')
12 .option('-c, --category <category number>', 'Category number') 13 .option('-c, --category <category number>', 'Category number')
13 .option('-l, --licence <licence number>', 'Licence number') 14 .option('-l, --licence <licence number>', 'Licence number')
14 .option('-d, --description <description>', 'Video description') 15 .option('-d, --description <description>', 'Video description')
@@ -22,6 +23,7 @@ if (
22 !program.name || 23 !program.name ||
23 !program.category || 24 !program.category ||
24 !program.licence || 25 !program.licence ||
26 !program.nsfw ||
25 !program.description || 27 !program.description ||
26 !program.tags || 28 !program.tags ||
27 !Array.isArray(program.tags) || 29 !Array.isArray(program.tags) ||
@@ -40,6 +42,7 @@ fs.access(program.file, fs.F_OK, function (err) {
40 program.name, 42 program.name,
41 program.category, 43 program.category,
42 program.licence, 44 program.licence,
45 program.nsfw,
43 program.description, 46 program.description,
44 program.tags, 47 program.tags,
45 program.file 48 program.file
@@ -52,13 +55,14 @@ function list (val) {
52 return val.split(',') 55 return val.split(',')
53} 56}
54 57
55function upload (url, accessToken, name, category, licence, description, tags, fixture) { 58function upload (url, accessToken, name, category, licence, nsfw, description, tags, fixture) {
56 console.log('Uploading %s video...', program.name) 59 console.log('Uploading %s video...', program.name)
57 60
58 const videoAttributes = { 61 const videoAttributes = {
59 name, 62 name,
60 category, 63 category,
61 licence, 64 licence,
65 nsfw,
62 description, 66 description,
63 tags, 67 tags,
64 fixture 68 fixture
diff --git a/server/tests/utils/videos.js b/server/tests/utils/videos.js
index d1e0b7b14..3c7d99eec 100644
--- a/server/tests/utils/videos.js
+++ b/server/tests/utils/videos.js
@@ -218,6 +218,7 @@ function uploadVideo (url, accessToken, videoAttributesArg, specialStatus, end)
218 name: 'my super video', 218 name: 'my super video',
219 category: 5, 219 category: 5,
220 licence: 4, 220 licence: 4,
221 nsfw: true,
221 description: 'my super description', 222 description: 'my super description',
222 tags: [ 'tag' ], 223 tags: [ 'tag' ],
223 fixture: 'video_short.webm' 224 fixture: 'video_short.webm'
@@ -231,6 +232,7 @@ function uploadVideo (url, accessToken, videoAttributesArg, specialStatus, end)
231 .field('name', attributes.name) 232 .field('name', attributes.name)
232 .field('category', attributes.category) 233 .field('category', attributes.category)
233 .field('licence', attributes.licence) 234 .field('licence', attributes.licence)
235 .field('nsfw', attributes.nsfw)
234 .field('description', attributes.description) 236 .field('description', attributes.description)
235 237
236 for (let i = 0; i < attributes.tags.length; i++) { 238 for (let i = 0; i < attributes.tags.length; i++) {
@@ -265,6 +267,7 @@ function updateVideo (url, accessToken, id, attributes, specialStatus, end) {
265 if (attributes.name) req.field('name', attributes.name) 267 if (attributes.name) req.field('name', attributes.name)
266 if (attributes.category) req.field('category', attributes.category) 268 if (attributes.category) req.field('category', attributes.category)
267 if (attributes.licence) req.field('licence', attributes.licence) 269 if (attributes.licence) req.field('licence', attributes.licence)
270 if (attributes.nsfw) req.field('nsfw', attributes.nsfw)
268 if (attributes.description) req.field('description', attributes.description) 271 if (attributes.description) req.field('description', attributes.description)
269 272
270 if (attributes.tags) { 273 if (attributes.tags) {