diff options
Diffstat (limited to 'shared/extra-utils/videos')
-rw-r--r-- | shared/extra-utils/videos/video-channels.ts | 37 | ||||
-rw-r--r-- | shared/extra-utils/videos/video-playlists.ts | 4 | ||||
-rw-r--r-- | shared/extra-utils/videos/videos.ts | 9 |
3 files changed, 34 insertions, 16 deletions
diff --git a/shared/extra-utils/videos/video-channels.ts b/shared/extra-utils/videos/video-channels.ts index 93a257bf9..3e79cf15a 100644 --- a/shared/extra-utils/videos/video-channels.ts +++ b/shared/extra-utils/videos/video-channels.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import * as request from 'supertest' | 1 | import * as request from 'supertest' |
2 | import { VideoChannelCreate, VideoChannelUpdate } from '../../models/videos' | 2 | import { VideoChannelCreate, VideoChannelUpdate } from '../../models/videos' |
3 | import { updateAvatarRequest } from '../requests/requests' | 3 | import { makeGetRequest, updateAvatarRequest } from '../requests/requests' |
4 | import { getMyUserInformation, ServerInfo } from '..' | 4 | import { getMyUserInformation, ServerInfo } from '..' |
5 | import { User } from '../..' | 5 | import { User } from '../..' |
6 | 6 | ||
@@ -19,14 +19,28 @@ function getVideoChannelsList (url: string, start: number, count: number, sort?: | |||
19 | .expect('Content-Type', /json/) | 19 | .expect('Content-Type', /json/) |
20 | } | 20 | } |
21 | 21 | ||
22 | function getAccountVideoChannelsList (url: string, accountName: string, specialStatus = 200) { | 22 | function getAccountVideoChannelsList (parameters: { |
23 | url: string, | ||
24 | accountName: string, | ||
25 | start?: number, | ||
26 | count?: number, | ||
27 | sort?: string, | ||
28 | specialStatus?: number | ||
29 | }) { | ||
30 | const { url, accountName, start, count, sort = 'createdAt', specialStatus = 200 } = parameters | ||
31 | |||
23 | const path = '/api/v1/accounts/' + accountName + '/video-channels' | 32 | const path = '/api/v1/accounts/' + accountName + '/video-channels' |
24 | 33 | ||
25 | return request(url) | 34 | return makeGetRequest({ |
26 | .get(path) | 35 | url, |
27 | .set('Accept', 'application/json') | 36 | path, |
28 | .expect(specialStatus) | 37 | query: { |
29 | .expect('Content-Type', /json/) | 38 | start, |
39 | count, | ||
40 | sort | ||
41 | }, | ||
42 | statusCodeExpected: specialStatus | ||
43 | }) | ||
30 | } | 44 | } |
31 | 45 | ||
32 | function addVideoChannel ( | 46 | function addVideoChannel ( |
@@ -60,12 +74,13 @@ function updateVideoChannel ( | |||
60 | attributes: VideoChannelUpdate, | 74 | attributes: VideoChannelUpdate, |
61 | expectedStatus = 204 | 75 | expectedStatus = 204 |
62 | ) { | 76 | ) { |
63 | const body = {} | 77 | const body: any = {} |
64 | const path = '/api/v1/video-channels/' + channelName | 78 | const path = '/api/v1/video-channels/' + channelName |
65 | 79 | ||
66 | if (attributes.displayName) body['displayName'] = attributes.displayName | 80 | if (attributes.displayName) body.displayName = attributes.displayName |
67 | if (attributes.description) body['description'] = attributes.description | 81 | if (attributes.description) body.description = attributes.description |
68 | if (attributes.support) body['support'] = attributes.support | 82 | if (attributes.support) body.support = attributes.support |
83 | if (attributes.bulkVideosSupportUpdate) body.bulkVideosSupportUpdate = attributes.bulkVideosSupportUpdate | ||
69 | 84 | ||
70 | return request(url) | 85 | return request(url) |
71 | .put(path) | 86 | .put(path) |
diff --git a/shared/extra-utils/videos/video-playlists.ts b/shared/extra-utils/videos/video-playlists.ts index 4d110a131..fd62bef19 100644 --- a/shared/extra-utils/videos/video-playlists.ts +++ b/shared/extra-utils/videos/video-playlists.ts | |||
@@ -252,10 +252,10 @@ function reorderVideosPlaylist (options: { | |||
252 | 252 | ||
253 | async function checkPlaylistFilesWereRemoved ( | 253 | async function checkPlaylistFilesWereRemoved ( |
254 | playlistUUID: string, | 254 | playlistUUID: string, |
255 | serverNumber: number, | 255 | internalServerNumber: number, |
256 | directories = [ 'thumbnails' ] | 256 | directories = [ 'thumbnails' ] |
257 | ) { | 257 | ) { |
258 | const testDirectory = 'test' + serverNumber | 258 | const testDirectory = 'test' + internalServerNumber |
259 | 259 | ||
260 | for (const directory of directories) { | 260 | for (const directory of directories) { |
261 | const directoryPath = join(root(), testDirectory, directory) | 261 | const directoryPath = join(root(), testDirectory, directory) |
diff --git a/shared/extra-utils/videos/videos.ts b/shared/extra-utils/videos/videos.ts index b5a07b792..c78563232 100644 --- a/shared/extra-utils/videos/videos.ts +++ b/shared/extra-utils/videos/videos.ts | |||
@@ -362,6 +362,10 @@ async function uploadVideo (url: string, accessToken: string, videoAttributesArg | |||
362 | .field('privacy', attributes.privacy.toString()) | 362 | .field('privacy', attributes.privacy.toString()) |
363 | .field('channelId', attributes.channelId) | 363 | .field('channelId', attributes.channelId) |
364 | 364 | ||
365 | if (attributes.support !== undefined) { | ||
366 | req.field('support', attributes.support) | ||
367 | } | ||
368 | |||
365 | if (attributes.description !== undefined) { | 369 | if (attributes.description !== undefined) { |
366 | req.field('description', attributes.description) | 370 | req.field('description', attributes.description) |
367 | } | 371 | } |
@@ -524,7 +528,6 @@ async function completeVideoCheck ( | |||
524 | expect(video.nsfw).to.equal(attributes.nsfw) | 528 | expect(video.nsfw).to.equal(attributes.nsfw) |
525 | expect(video.description).to.equal(attributes.description) | 529 | expect(video.description).to.equal(attributes.description) |
526 | expect(video.account.id).to.be.a('number') | 530 | expect(video.account.id).to.be.a('number') |
527 | expect(video.account.uuid).to.be.a('string') | ||
528 | expect(video.account.host).to.equal(attributes.account.host) | 531 | expect(video.account.host).to.equal(attributes.account.host) |
529 | expect(video.account.name).to.equal(attributes.account.name) | 532 | expect(video.account.name).to.equal(attributes.account.name) |
530 | expect(video.channel.displayName).to.equal(attributes.channel.displayName) | 533 | expect(video.channel.displayName).to.equal(attributes.channel.displayName) |
@@ -568,8 +571,8 @@ async function completeVideoCheck ( | |||
568 | expect(file).not.to.be.undefined | 571 | expect(file).not.to.be.undefined |
569 | 572 | ||
570 | let extension = extname(attributes.fixture) | 573 | let extension = extname(attributes.fixture) |
571 | // Transcoding enabled on server 2, extension will always be .mp4 | 574 | // Transcoding enabled: extension will always be .mp4 |
572 | if (attributes.account.host === 'localhost:9002') extension = '.mp4' | 575 | if (attributes.files.length > 1) extension = '.mp4' |
573 | 576 | ||
574 | const magnetUri = file.magnetUri | 577 | const magnetUri = file.magnetUri |
575 | expect(file.magnetUri).to.have.lengthOf.above(2) | 578 | expect(file.magnetUri).to.have.lengthOf.above(2) |