From 31b59b477459d4f26ed8ef089a0e5553fb6a332b Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 28 Mar 2017 21:19:46 +0200 Subject: Server: add nsfw attribute --- server/tests/api/check-params/videos.js | 65 +++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) (limited to 'server/tests/api/check-params') 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 () { const data = { category: 5, licence: 1, + nsfw: false, description: 'my super description', tags: [ 'tag1', 'tag2' ] } @@ -128,6 +129,7 @@ describe('Test videos API validator', function () { name: 'My very very very very very very very very very very very very very very very very long name', category: 5, licence: 1, + nsfw: false, description: 'my super description', tags: [ 'tag1', 'tag2' ] } @@ -141,6 +143,7 @@ describe('Test videos API validator', function () { const data = { name: 'my super name', licence: 1, + nsfw: false, description: 'my super description', tags: [ 'tag1', 'tag2' ] } @@ -155,6 +158,7 @@ describe('Test videos API validator', function () { name: 'my super name', category: 125, licence: 1, + nsfw: false, description: 'my super description', tags: [ 'tag1', 'tag2' ] } @@ -168,6 +172,7 @@ describe('Test videos API validator', function () { const data = { name: 'my super name', category: 5, + nsfw: false, description: 'my super description', tags: [ 'tag1', 'tag2' ] } @@ -182,6 +187,36 @@ describe('Test videos API validator', function () { name: 'my super name', category: 5, licence: 125, + nsfw: false, + description: 'my super description', + tags: [ 'tag1', 'tag2' ] + } + const attach = { + 'videofile': pathUtils.join(__dirname, '..', 'fixtures', 'video_short.webm') + } + requestsUtils.makePostUploadRequest(server.url, path, server.accessToken, data, attach, done) + }) + + it('Should fail without nsfw attribute', function (done) { + const data = { + name: 'my super name', + category: 5, + licence: 4, + description: 'my super description', + tags: [ 'tag1', 'tag2' ] + } + const attach = { + 'videofile': pathUtils.join(__dirname, '..', 'fixtures', 'video_short.webm') + } + requestsUtils.makePostUploadRequest(server.url, path, server.accessToken, data, attach, done) + }) + + it('Should fail with a bad nsfw attribue', function (done) { + const data = { + name: 'my super name', + category: 5, + licence: 4, + nsfw: 2, description: 'my super description', tags: [ 'tag1', 'tag2' ] } @@ -196,6 +231,7 @@ describe('Test videos API validator', function () { name: 'my super name', category: 5, licence: 1, + nsfw: false, tags: [ 'tag1', 'tag2' ] } const attach = { @@ -209,6 +245,7 @@ describe('Test videos API validator', function () { name: 'my super name', category: 5, licence: 1, + nsfw: false, description: 'my super description which is very very very very very very very very very very very very very very' + 'very very very very very very very very very very very very very very very very very very very very very' + '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 () { name: 'my super name', category: 5, licence: 1, + nsfw: false, description: 'my super description', tags: [ 'tag1', 'tag2', 'tag3', 'tag4' ] } @@ -239,6 +277,7 @@ describe('Test videos API validator', function () { name: 'my super name', category: 5, licence: 1, + nsfw: false, description: 'my super description', tags: [ 'tag1', 't' ] } @@ -253,6 +292,7 @@ describe('Test videos API validator', function () { name: 'my super name', category: 5, licence: 1, + nsfw: false, description: 'my super description', tags: [ 'mysupertagtoolong', 'tag1' ] } @@ -267,6 +307,7 @@ describe('Test videos API validator', function () { name: 'my super name', category: 5, licence: 1, + nsfw: false, description: 'my super description', tags: [ 'tag1', 'tag2' ] } @@ -279,6 +320,7 @@ describe('Test videos API validator', function () { name: 'my super name', category: 5, licence: 1, + nsfw: false, description: 'my super description', tags: [ 'tag1', 'tag2' ] } @@ -293,6 +335,7 @@ describe('Test videos API validator', function () { name: 'my super name', category: 5, licence: 1, + nsfw: false, description: 'my super description', tags: [ 'tag1', 'tag2' ] } @@ -307,6 +350,7 @@ describe('Test videos API validator', function () { name: 'my super name', category: 5, licence: 1, + nsfw: false, description: 'my super description', tags: [ 'tag1', 'tag2' ] } @@ -345,6 +389,7 @@ describe('Test videos API validator', function () { const data = { category: 5, licence: 2, + nsfw: false, description: 'my super description', tags: [ 'tag1', 'tag2' ] } @@ -355,6 +400,7 @@ describe('Test videos API validator', function () { const data = { category: 5, licence: 2, + nsfw: false, description: 'my super description', tags: [ 'tag1', 'tag2' ] } @@ -366,6 +412,7 @@ describe('Test videos API validator', function () { name: 'My very very very very very very very very very very very very very very very very long name', category: 5, licence: 2, + nsfw: false, description: 'my super description', tags: [ 'tag1', 'tag2' ] } @@ -377,6 +424,7 @@ describe('Test videos API validator', function () { name: 'my super name', category: 128, licence: 2, + nsfw: false, description: 'my super description', tags: [ 'tag1', 'tag2' ] } @@ -388,6 +436,19 @@ describe('Test videos API validator', function () { name: 'my super name', category: 5, licence: 128, + nsfw: false, + description: 'my super description', + tags: [ 'tag1', 'tag2' ] + } + requestsUtils.makePutBodyRequest(server.url, path + videoId, server.accessToken, data, done) + }) + + it('Should fail with a bad nsfw attribute', function (done) { + const data = { + name: 'my super name', + category: 5, + licence: 5, + nsfw: -4, description: 'my super description', tags: [ 'tag1', 'tag2' ] } @@ -399,6 +460,7 @@ describe('Test videos API validator', function () { name: 'my super name', category: 5, licence: 2, + nsfw: false, description: 'my super description which is very very very very very very very very very very very very very very' + 'very very very very very very very very very very very very very very very very very very very very very' + '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 () { name: 'my super name', category: 5, licence: 2, + nsfw: false, description: 'my super description', tags: [ 'tag1', 'tag2', 'tag3', 'tag4' ] } @@ -423,6 +486,7 @@ describe('Test videos API validator', function () { name: 'my super name', category: 5, licence: 2, + nsfw: false, description: 'my super description', tags: [ 'tag1', 't' ] } @@ -434,6 +498,7 @@ describe('Test videos API validator', function () { name: 'my super name', category: 5, licence: 2, + nsfw: false, description: 'my super description', tags: [ 'mysupertagtoolong', 'tag1' ] } -- cgit v1.2.3