import * as request from 'supertest'
import { VideoChannelCreate, VideoChannelUpdate } from '../../../../shared/models/videos'
+import { updateAvatarRequest } from '../index'
function getVideoChannelsList (url: string, start: number, count: number, sort?: string) {
const path = '/api/v1/video-channels'
.expect('Content-Type', /json/)
}
-function getAccountVideoChannelsList (url: string, accountId: number | string, specialStatus = 200) {
- const path = '/api/v1/accounts/' + accountId + '/video-channels'
+function getAccountVideoChannelsList (url: string, accountName: string, specialStatus = 200) {
+ const path = '/api/v1/accounts/' + accountName + '/video-channels'
return request(url)
.get(path)
function updateVideoChannel (
url: string,
token: string,
- channelId: number | string,
+ channelName: string,
attributes: VideoChannelUpdate,
expectedStatus = 204
) {
const body = {}
- const path = '/api/v1/video-channels/' + channelId
+ const path = '/api/v1/video-channels/' + channelName
if (attributes.displayName) body['displayName'] = attributes.displayName
if (attributes.description) body['description'] = attributes.description
.expect(expectedStatus)
}
-function deleteVideoChannel (url: string, token: string, channelId: number | string, expectedStatus = 204) {
- const path = '/api/v1/video-channels/' + channelId
+function deleteVideoChannel (url: string, token: string, channelName: string, expectedStatus = 204) {
+ const path = '/api/v1/video-channels/' + channelName
return request(url)
.delete(path)
.expect(expectedStatus)
}
-function getVideoChannel (url: string, channelId: number | string) {
- const path = '/api/v1/video-channels/' + channelId
+function getVideoChannel (url: string, channelName: string) {
+ const path = '/api/v1/video-channels/' + channelName
return request(url)
.get(path)
.expect('Content-Type', /json/)
}
+function updateVideoChannelAvatar (options: {
+ url: string,
+ accessToken: string,
+ fixture: string,
+ videoChannelName: string | number
+}) {
+
+ const path = '/api/v1/video-channels/' + options.videoChannelName + '/avatar/pick'
+
+ return updateAvatarRequest(Object.assign(options, { path }))
+}
+
// ---------------------------------------------------------------------------
export {
+ updateVideoChannelAvatar,
getVideoChannelsList,
getAccountVideoChannelsList,
addVideoChannel,