From 7519127b5cb44095f78f6bf4c51d4ebf2b7d5e88 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Mon, 11 Feb 2019 14:41:55 +0100 Subject: Add originallyPublishedAt unit tests --- server/tests/api/check-params/videos.ts | 16 +++++++++++++++- server/tests/api/videos/multiple-servers.ts | 6 +++++- 2 files changed, 20 insertions(+), 2 deletions(-) (limited to 'server/tests/api') diff --git a/server/tests/api/check-params/videos.ts b/server/tests/api/check-params/videos.ts index 878ffe025..3eccaee44 100644 --- a/server/tests/api/check-params/videos.ts +++ b/server/tests/api/check-params/videos.ts @@ -185,7 +185,8 @@ describe('Test videos API validator', function () { support: 'my super support text', tags: [ 'tag1', 'tag2' ], privacy: VideoPrivacy.PUBLIC, - channelId: channelId + channelId: channelId, + originallyPublishedAt: new Date().toISOString() } }) @@ -313,6 +314,13 @@ describe('Test videos API validator', function () { await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) }) + it('Should fail with a bad originally published at attribute', async function () { + const fields = immutableAssign(baseCorrectParams, { 'originallyPublishedAt': 'toto' }) + const attaches = baseCorrectAttaches + + await makeUploadRequest({ url: server.url, path: path + '/upload', token: server.accessToken, fields, attaches }) + }) + it('Should fail without an input file', async function () { const fields = baseCorrectParams const attaches = {} @@ -534,6 +542,12 @@ describe('Test videos API validator', function () { await makePutBodyRequest({ url: server.url, path: path + videoId, token: server.accessToken, fields }) }) + it('Should fail with a bad originally published at param', async function () { + const fields = immutableAssign(baseCorrectParams, { originallyPublishedAt: 'toto' }) + + await makePutBodyRequest({ url: server.url, path: path + videoId, token: server.accessToken, fields }) + }) + it('Should fail with an incorrect thumbnail file', async function () { const fields = baseCorrectParams const attaches = { diff --git a/server/tests/api/videos/multiple-servers.ts b/server/tests/api/videos/multiple-servers.ts index 1b471ba79..7e2fcb630 100644 --- a/server/tests/api/videos/multiple-servers.ts +++ b/server/tests/api/videos/multiple-servers.ts @@ -98,6 +98,7 @@ describe('Test multiple servers', function () { nsfw: true, description: 'my super description for server 1', support: 'my super support text for server 1', + originallyPublishedAt: '2019-02-10T13:38:14.449Z', tags: [ 'tag1p1', 'tag2p1' ], channelId: videoChannelId, fixture: 'video_short1.webm' @@ -118,6 +119,7 @@ describe('Test multiple servers', function () { nsfw: true, description: 'my super description for server 1', support: 'my super support text for server 1', + originallyPublishedAt: '2019-02-10T13:38:14.449Z', account: { name: 'root', host: 'localhost:9001' @@ -625,6 +627,7 @@ describe('Test multiple servers', function () { support: 'my super support text updated', tags: [ 'tag_up_1', 'tag_up_2' ], thumbnailfile: 'thumbnail.jpg', + originallyPublishedAt: '2019-02-11T13:38:14.449Z', previewfile: 'preview.jpg' } @@ -652,6 +655,7 @@ describe('Test multiple servers', function () { nsfw: true, description: 'my super description updated', support: 'my super support text updated', + originallyPublishedAt: '2019-02-11T13:38:14.449Z', account: { name: 'root', host: 'localhost:9003' @@ -983,7 +987,7 @@ describe('Test multiple servers', function () { isLocal, duration: 5, commentsEnabled: false, - downloadEnabled: false, + downloadEnabled: true, tags: [ ], privacy: VideoPrivacy.PUBLIC, channel: { -- cgit v1.2.3