From 2422c46b27790d94fd29a7092170cee5a1b56008 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 15 Feb 2018 14:46:26 +0100 Subject: Implement support field in video and video channel --- server/tests/utils/videos/video-channels.ts | 7 +++++-- server/tests/utils/videos/videos.ts | 10 ++++++---- 2 files changed, 11 insertions(+), 6 deletions(-) (limited to 'server/tests/utils/videos') diff --git a/server/tests/utils/videos/video-channels.ts b/server/tests/utils/videos/video-channels.ts index 062ca8f4d..2d095d8ab 100644 --- a/server/tests/utils/videos/video-channels.ts +++ b/server/tests/utils/videos/video-channels.ts @@ -3,6 +3,7 @@ import * as request from 'supertest' type VideoChannelAttributes = { name?: string description?: string + support?: string } function getVideoChannelsList (url: string, start: number, count: number, sort?: string) { @@ -30,13 +31,14 @@ function getAccountVideoChannelsList (url: string, accountId: number | string, s .expect('Content-Type', /json/) } -function addVideoChannel (url: string, token: string, videoChannelAttributesArg: VideoChannelAttributes, expectedStatus = 204) { +function addVideoChannel (url: string, token: string, videoChannelAttributesArg: VideoChannelAttributes, expectedStatus = 200) { const path = '/api/v1/videos/channels' // Default attributes let attributes = { name: 'my super video channel', - description: 'my super channel description' + description: 'my super channel description', + support: 'my super channel support' } attributes = Object.assign(attributes, videoChannelAttributesArg) @@ -54,6 +56,7 @@ function updateVideoChannel (url: string, token: string, channelId: number, attr if (attributes.name) body['name'] = attributes.name if (attributes.description) body['description'] = attributes.description + if (attributes.support) body['support'] = attributes.support return request(url) .put(path) diff --git a/server/tests/utils/videos/videos.ts b/server/tests/utils/videos/videos.ts index 9a4af0b9f..a06078d40 100644 --- a/server/tests/utils/videos/videos.ts +++ b/server/tests/utils/videos/videos.ts @@ -248,6 +248,7 @@ async function uploadVideo (url: string, accessToken: string, videoAttributesArg channelId: defaultChannelId, nsfw: true, description: 'my super description', + support: 'my super support text', tags: [ 'tag' ], privacy: VideoPrivacy.PUBLIC, commentsEnabled: true, @@ -277,6 +278,10 @@ async function uploadVideo (url: string, accessToken: string, videoAttributesArg req.field('licence', attributes.licence.toString()) } + for (let i = 0; i < attributes.tags.length; i++) { + req.field('tags[' + i + ']', attributes.tags[i]) + } + if (attributes.thumbnailfile !== undefined) { req.attach('thumbnailfile', buildAbsoluteFixturePath(attributes.thumbnailfile)) } @@ -284,10 +289,6 @@ async function uploadVideo (url: string, accessToken: string, videoAttributesArg req.attach('previewfile', buildAbsoluteFixturePath(attributes.previewfile)) } - for (let i = 0; i < attributes.tags.length; i++) { - req.field('tags[' + i + ']', attributes.tags[i]) - } - return req.attach('videofile', buildAbsoluteFixturePath(attributes.fixture)) .expect(specialStatus) } @@ -366,6 +367,7 @@ async function completeVideoCheck ( nsfw: boolean commentsEnabled: boolean description: string + support: string host: string account: string isLocal: boolean, -- cgit v1.2.3