diff options
author | Chocobozzz <me@florianbigard.com> | 2019-03-05 10:58:44 +0100 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2019-03-18 11:17:59 +0100 |
commit | df0b219d36bf6852cdf2a7ad09ed4a41c6bccefa (patch) | |
tree | c4984e854f5dc18e5c27afd73b843bd52c143034 /shared/utils/videos/video-channels.ts | |
parent | 07b1a18aa678d260009a93e36606c5c5f585723d (diff) | |
download | PeerTube-df0b219d36bf6852cdf2a7ad09ed4a41c6bccefa.tar.gz PeerTube-df0b219d36bf6852cdf2a7ad09ed4a41c6bccefa.tar.zst PeerTube-df0b219d36bf6852cdf2a7ad09ed4a41c6bccefa.zip |
Add playlist rest tests
Diffstat (limited to 'shared/utils/videos/video-channels.ts')
-rw-r--r-- | shared/utils/videos/video-channels.ts | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/shared/utils/videos/video-channels.ts b/shared/utils/videos/video-channels.ts index 3935c261e..93a257bf9 100644 --- a/shared/utils/videos/video-channels.ts +++ b/shared/utils/videos/video-channels.ts | |||
@@ -1,6 +1,8 @@ | |||
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 { updateAvatarRequest } from '../requests/requests' |
4 | import { getMyUserInformation, ServerInfo } from '..' | ||
5 | import { User } from '../..' | ||
4 | 6 | ||
5 | function getVideoChannelsList (url: string, start: number, count: number, sort?: string) { | 7 | function getVideoChannelsList (url: string, start: number, count: number, sort?: string) { |
6 | const path = '/api/v1/video-channels' | 8 | const path = '/api/v1/video-channels' |
@@ -105,6 +107,19 @@ function updateVideoChannelAvatar (options: { | |||
105 | return updateAvatarRequest(Object.assign(options, { path })) | 107 | return updateAvatarRequest(Object.assign(options, { path })) |
106 | } | 108 | } |
107 | 109 | ||
110 | function setDefaultVideoChannel (servers: ServerInfo[]) { | ||
111 | const tasks: Promise<any>[] = [] | ||
112 | |||
113 | for (const server of servers) { | ||
114 | const p = getMyUserInformation(server.url, server.accessToken) | ||
115 | .then(res => server.videoChannel = (res.body as User).videoChannels[0]) | ||
116 | |||
117 | tasks.push(p) | ||
118 | } | ||
119 | |||
120 | return Promise.all(tasks) | ||
121 | } | ||
122 | |||
108 | // --------------------------------------------------------------------------- | 123 | // --------------------------------------------------------------------------- |
109 | 124 | ||
110 | export { | 125 | export { |
@@ -114,5 +129,6 @@ export { | |||
114 | addVideoChannel, | 129 | addVideoChannel, |
115 | updateVideoChannel, | 130 | updateVideoChannel, |
116 | deleteVideoChannel, | 131 | deleteVideoChannel, |
117 | getVideoChannel | 132 | getVideoChannel, |
133 | setDefaultVideoChannel | ||
118 | } | 134 | } |