diff options
author | Chocobozzz <me@florianbigard.com> | 2021-04-07 10:36:13 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2021-04-08 10:07:53 +0200 |
commit | 213e30ef90806369529684ac9c247d73b8dc7928 (patch) | |
tree | 7f834f2485a074b1d3052745fa5236d34c0f26db /shared/extra-utils/videos | |
parent | 2cb03dc1f4e01ba491c36caff30c33fe9c5bad89 (diff) | |
download | PeerTube-213e30ef90806369529684ac9c247d73b8dc7928.tar.gz PeerTube-213e30ef90806369529684ac9c247d73b8dc7928.tar.zst PeerTube-213e30ef90806369529684ac9c247d73b8dc7928.zip |
Add banner tests
Diffstat (limited to 'shared/extra-utils/videos')
-rw-r--r-- | shared/extra-utils/videos/video-channels.ts | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/shared/extra-utils/videos/video-channels.ts b/shared/extra-utils/videos/video-channels.ts index 3ff445c2a..d0dfb5856 100644 --- a/shared/extra-utils/videos/video-channels.ts +++ b/shared/extra-utils/videos/video-channels.ts | |||
@@ -3,7 +3,7 @@ | |||
3 | import * as request from 'supertest' | 3 | import * as request from 'supertest' |
4 | import { VideoChannelUpdate } from '../../models/videos/channel/video-channel-update.model' | 4 | import { VideoChannelUpdate } from '../../models/videos/channel/video-channel-update.model' |
5 | import { VideoChannelCreate } from '../../models/videos/channel/video-channel-create.model' | 5 | import { VideoChannelCreate } from '../../models/videos/channel/video-channel-create.model' |
6 | import { makeGetRequest, updateAvatarRequest } from '../requests/requests' | 6 | import { makeDeleteRequest, makeGetRequest, updateImageRequest } from '../requests/requests' |
7 | import { ServerInfo } from '../server/servers' | 7 | import { ServerInfo } from '../server/servers' |
8 | import { User } from '../../models/users/user.model' | 8 | import { User } from '../../models/users/user.model' |
9 | import { getMyUserInformation } from '../users/users' | 9 | import { getMyUserInformation } from '../users/users' |
@@ -129,16 +129,32 @@ function getVideoChannel (url: string, channelName: string) { | |||
129 | .expect('Content-Type', /json/) | 129 | .expect('Content-Type', /json/) |
130 | } | 130 | } |
131 | 131 | ||
132 | function updateVideoChannelAvatar (options: { | 132 | function updateVideoChannelImage (options: { |
133 | url: string | 133 | url: string |
134 | accessToken: string | 134 | accessToken: string |
135 | fixture: string | 135 | fixture: string |
136 | videoChannelName: string | number | 136 | videoChannelName: string | number |
137 | type: 'avatar' | 'banner' | ||
137 | }) { | 138 | }) { |
139 | const path = `/api/v1/video-channels/${options.videoChannelName}/${options.type}/pick` | ||
138 | 140 | ||
139 | const path = '/api/v1/video-channels/' + options.videoChannelName + '/avatar/pick' | 141 | return updateImageRequest({ ...options, path, fieldname: options.type + 'file' }) |
142 | } | ||
143 | |||
144 | function deleteVideoChannelImage (options: { | ||
145 | url: string | ||
146 | accessToken: string | ||
147 | videoChannelName: string | number | ||
148 | type: 'avatar' | 'banner' | ||
149 | }) { | ||
150 | const path = `/api/v1/video-channels/${options.videoChannelName}/${options.type}` | ||
140 | 151 | ||
141 | return updateAvatarRequest(Object.assign(options, { path })) | 152 | return makeDeleteRequest({ |
153 | url: options.url, | ||
154 | token: options.accessToken, | ||
155 | path, | ||
156 | statusCodeExpected: 204 | ||
157 | }) | ||
142 | } | 158 | } |
143 | 159 | ||
144 | function setDefaultVideoChannel (servers: ServerInfo[]) { | 160 | function setDefaultVideoChannel (servers: ServerInfo[]) { |
@@ -157,12 +173,13 @@ function setDefaultVideoChannel (servers: ServerInfo[]) { | |||
157 | // --------------------------------------------------------------------------- | 173 | // --------------------------------------------------------------------------- |
158 | 174 | ||
159 | export { | 175 | export { |
160 | updateVideoChannelAvatar, | 176 | updateVideoChannelImage, |
161 | getVideoChannelsList, | 177 | getVideoChannelsList, |
162 | getAccountVideoChannelsList, | 178 | getAccountVideoChannelsList, |
163 | addVideoChannel, | 179 | addVideoChannel, |
164 | updateVideoChannel, | 180 | updateVideoChannel, |
165 | deleteVideoChannel, | 181 | deleteVideoChannel, |
166 | getVideoChannel, | 182 | getVideoChannel, |
167 | setDefaultVideoChannel | 183 | setDefaultVideoChannel, |
184 | deleteVideoChannelImage | ||
168 | } | 185 | } |