From 156c50af3085468a47b8ae73fe8cfcae46b42398 Mon Sep 17 00:00:00 2001 From: Lucas Declercq Date: Sat, 6 Oct 2018 19:17:21 +0200 Subject: Add downloadingEnabled property to video model --- server/tests/api/check-params/video-imports.ts | 1 + server/tests/api/check-params/videos.ts | 2 ++ server/tests/api/server/follows.ts | 1 + server/tests/api/server/handle-down.ts | 1 + server/tests/api/videos/multiple-servers.ts | 6 ++++++ server/tests/api/videos/single-server.ts | 3 +++ server/tests/utils/videos/videos.ts | 6 ++++++ 7 files changed, 20 insertions(+) (limited to 'server/tests') diff --git a/server/tests/api/check-params/video-imports.ts b/server/tests/api/check-params/video-imports.ts index 44645b0e2..8dd87b8ae 100644 --- a/server/tests/api/check-params/video-imports.ts +++ b/server/tests/api/check-params/video-imports.ts @@ -84,6 +84,7 @@ describe('Test video imports API validator', function () { language: 'pt', nsfw: false, commentsEnabled: true, + downloadingEnabled: true, waitTranscoding: true, description: 'my super description', support: 'my super support text', diff --git a/server/tests/api/check-params/videos.ts b/server/tests/api/check-params/videos.ts index 904d22870..c5740087c 100644 --- a/server/tests/api/check-params/videos.ts +++ b/server/tests/api/check-params/videos.ts @@ -175,6 +175,7 @@ describe('Test videos API validator', function () { language: 'pt', nsfw: false, commentsEnabled: true, + downloadingEnabled: true, waitTranscoding: true, description: 'my super description', support: 'my super support text', @@ -419,6 +420,7 @@ describe('Test videos API validator', function () { language: 'pt', nsfw: false, commentsEnabled: false, + downloadingEnabled: false, description: 'my super description', privacy: VideoPrivacy.PUBLIC, tags: [ 'tag1', 'tag2' ] diff --git a/server/tests/api/server/follows.ts b/server/tests/api/server/follows.ts index 310c291bf..5cad1d09d 100644 --- a/server/tests/api/server/follows.ts +++ b/server/tests/api/server/follows.ts @@ -305,6 +305,7 @@ describe('Test follows', function () { }, isLocal, commentsEnabled: true, + downloadingEnabled: true, duration: 5, tags: [ 'tag1', 'tag2', 'tag3' ], privacy: VideoPrivacy.PUBLIC, diff --git a/server/tests/api/server/handle-down.ts b/server/tests/api/server/handle-down.ts index ed15c8090..971de4607 100644 --- a/server/tests/api/server/handle-down.ts +++ b/server/tests/api/server/handle-down.ts @@ -70,6 +70,7 @@ describe('Test handle downs', function () { tags: [ 'tag1p1', 'tag2p1' ], privacy: VideoPrivacy.PUBLIC, commentsEnabled: true, + downloadingEnabled: true, channel: { name: 'root_channel', displayName: 'Main root channel', diff --git a/server/tests/api/videos/multiple-servers.ts b/server/tests/api/videos/multiple-servers.ts index 4553ee855..83e391ccd 100644 --- a/server/tests/api/videos/multiple-servers.ts +++ b/server/tests/api/videos/multiple-servers.ts @@ -127,6 +127,7 @@ describe('Test multiple servers', function () { tags: [ 'tag1p1', 'tag2p1' ], privacy: VideoPrivacy.PUBLIC, commentsEnabled: true, + downloadingEnabled: true, channel: { displayName: 'my channel', name: 'super_channel_name', @@ -198,6 +199,7 @@ describe('Test multiple servers', function () { }, isLocal, commentsEnabled: true, + downloadingEnabled: true, duration: 5, tags: [ 'tag1p2', 'tag2p2', 'tag3p2' ], privacy: VideoPrivacy.PUBLIC, @@ -306,6 +308,7 @@ describe('Test multiple servers', function () { isLocal, duration: 5, commentsEnabled: true, + downloadingEnabled: true, tags: [ 'tag1p3' ], privacy: VideoPrivacy.PUBLIC, channel: { @@ -337,6 +340,7 @@ describe('Test multiple servers', function () { host: 'localhost:9003' }, commentsEnabled: true, + downloadingEnabled: true, isLocal, duration: 5, tags: [ 'tag2p3', 'tag3p3', 'tag4p3' ], @@ -654,6 +658,7 @@ describe('Test multiple servers', function () { isLocal, duration: 5, commentsEnabled: true, + downloadingEnabled: true, tags: [ 'tag_up_1', 'tag_up_2' ], privacy: VideoPrivacy.PUBLIC, channel: { @@ -975,6 +980,7 @@ describe('Test multiple servers', function () { isLocal, duration: 5, commentsEnabled: false, + downloadingEnabled: false, tags: [ ], privacy: VideoPrivacy.PUBLIC, channel: { diff --git a/server/tests/api/videos/single-server.ts b/server/tests/api/videos/single-server.ts index e3d62b7a0..8995a8525 100644 --- a/server/tests/api/videos/single-server.ts +++ b/server/tests/api/videos/single-server.ts @@ -55,6 +55,7 @@ describe('Test a single server', function () { tags: [ 'tag1', 'tag2', 'tag3' ], privacy: VideoPrivacy.PUBLIC, commentsEnabled: true, + downloadingEnabled: true, channel: { displayName: 'Main root channel', name: 'root_channel', @@ -87,6 +88,7 @@ describe('Test a single server', function () { privacy: VideoPrivacy.PUBLIC, duration: 5, commentsEnabled: false, + downloadingEnabled: false, channel: { name: 'root_channel', displayName: 'Main root channel', @@ -356,6 +358,7 @@ describe('Test a single server', function () { nsfw: false, description: 'my super description updated', commentsEnabled: false, + downloadingEnabled: false, tags: [ 'tagup1', 'tagup2' ] } await updateVideo(server.url, server.accessToken, videoId, attributes) diff --git a/server/tests/utils/videos/videos.ts b/server/tests/utils/videos/videos.ts index 87c385f38..a7fd4c8a6 100644 --- a/server/tests/utils/videos/videos.ts +++ b/server/tests/utils/videos/videos.ts @@ -27,6 +27,7 @@ type VideoAttributes = { language?: string nsfw?: boolean commentsEnabled?: boolean + downloadingEnabled?: boolean waitTranscoding?: boolean description?: string tags?: string[] @@ -310,6 +311,7 @@ async function uploadVideo (url: string, accessToken: string, videoAttributesArg tags: [ 'tag' ], privacy: VideoPrivacy.PUBLIC, commentsEnabled: true, + downloadingEnabled: true, fixture: 'video_short.webm' }, videoAttributesArg) @@ -320,6 +322,7 @@ async function uploadVideo (url: string, accessToken: string, videoAttributesArg .field('name', attributes.name) .field('nsfw', JSON.stringify(attributes.nsfw)) .field('commentsEnabled', JSON.stringify(attributes.commentsEnabled)) + .field('downloadingEnabled', JSON.stringify(attributes.downloadingEnabled)) .field('waitTranscoding', JSON.stringify(attributes.waitTranscoding)) .field('privacy', attributes.privacy.toString()) .field('channelId', attributes.channelId) @@ -370,6 +373,7 @@ function updateVideo (url: string, accessToken: string, id: number | string, att if (attributes.language) body['language'] = attributes.language if (attributes.nsfw !== undefined) body['nsfw'] = JSON.stringify(attributes.nsfw) if (attributes.commentsEnabled !== undefined) body['commentsEnabled'] = JSON.stringify(attributes.commentsEnabled) + if (attributes.downloadingEnabled !== undefined) body['downloadingEnabled'] = JSON.stringify(attributes.downloadingEnabled) if (attributes.description) body['description'] = attributes.description if (attributes.tags) body['tags'] = attributes.tags if (attributes.privacy) body['privacy'] = attributes.privacy @@ -435,6 +439,7 @@ async function completeVideoCheck ( language: string nsfw: boolean commentsEnabled: boolean + downloadingEnabled: boolean description: string publishedAt?: string support: string @@ -509,6 +514,7 @@ async function completeVideoCheck ( expect(dateIsValid(videoDetails.channel.createdAt.toString())).to.be.true expect(dateIsValid(videoDetails.channel.updatedAt.toString())).to.be.true expect(videoDetails.commentsEnabled).to.equal(attributes.commentsEnabled) + expect(videoDetails.downloadingEnabled).to.equal(attributes.downloadingEnabled) for (const attributeFile of attributes.files) { const file = videoDetails.files.find(f => f.resolution.id === attributeFile.resolution) -- cgit v1.2.3