aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/videos
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-04-07 10:36:13 +0200
committerChocobozzz <chocobozzz@cpy.re>2021-04-08 10:07:53 +0200
commit213e30ef90806369529684ac9c247d73b8dc7928 (patch)
tree7f834f2485a074b1d3052745fa5236d34c0f26db /server/tests/api/videos
parent2cb03dc1f4e01ba491c36caff30c33fe9c5bad89 (diff)
downloadPeerTube-213e30ef90806369529684ac9c247d73b8dc7928.tar.gz
PeerTube-213e30ef90806369529684ac9c247d73b8dc7928.tar.zst
PeerTube-213e30ef90806369529684ac9c247d73b8dc7928.zip
Add banner tests
Diffstat (limited to 'server/tests/api/videos')
-rw-r--r--server/tests/api/videos/video-channels.ts86
1 files changed, 70 insertions, 16 deletions
diff --git a/server/tests/api/videos/video-channels.ts b/server/tests/api/videos/video-channels.ts
index 367f99fdd..8033b9ba5 100644
--- a/server/tests/api/videos/video-channels.ts
+++ b/server/tests/api/videos/video-channels.ts
@@ -5,13 +5,14 @@ import * as chai from 'chai'
5import { 5import {
6 cleanupTests, 6 cleanupTests,
7 createUser, 7 createUser,
8 deleteVideoChannelImage,
8 doubleFollow, 9 doubleFollow,
9 flushAndRunMultipleServers, 10 flushAndRunMultipleServers,
10 getVideo, 11 getVideo,
11 getVideoChannelVideos, 12 getVideoChannelVideos,
12 testImage, 13 testImage,
13 updateVideo, 14 updateVideo,
14 updateVideoChannelAvatar, 15 updateVideoChannelImage,
15 uploadVideo, 16 uploadVideo,
16 userLogin, 17 userLogin,
17 wait 18 wait
@@ -21,7 +22,6 @@ import {
21 deleteVideoChannel, 22 deleteVideoChannel,
22 getAccountVideoChannelsList, 23 getAccountVideoChannelsList,
23 getMyUserInformation, 24 getMyUserInformation,
24 getVideoChannel,
25 getVideoChannelsList, 25 getVideoChannelsList,
26 ServerInfo, 26 ServerInfo,
27 setAccessTokensToServers, 27 setAccessTokensToServers,
@@ -33,6 +33,13 @@ import { User, Video, VideoChannel, VideoDetails } from '../../../../shared/inde
33 33
34const expect = chai.expect 34const expect = chai.expect
35 35
36async function findChannel (server: ServerInfo, channelId: number) {
37 const res = await getVideoChannelsList(server.url, 0, 5, '-name')
38 const videoChannel = res.body.data.find(c => c.id === channelId)
39
40 return videoChannel as VideoChannel
41}
42
36describe('Test video channels', function () { 43describe('Test video channels', function () {
37 let servers: ServerInfo[] 44 let servers: ServerInfo[]
38 let userInfo: User 45 let userInfo: User
@@ -262,38 +269,85 @@ describe('Test video channels', function () {
262 }) 269 })
263 270
264 it('Should update video channel avatar', async function () { 271 it('Should update video channel avatar', async function () {
265 this.timeout(5000) 272 this.timeout(15000)
266 273
267 const fixture = 'avatar.png' 274 const fixture = 'avatar.png'
268 275
269 await updateVideoChannelAvatar({ 276 await updateVideoChannelImage({
270 url: servers[0].url, 277 url: servers[0].url,
271 accessToken: servers[0].accessToken, 278 accessToken: servers[0].accessToken,
272 videoChannelName: 'second_video_channel', 279 videoChannelName: 'second_video_channel',
273 fixture 280 fixture,
281 type: 'avatar'
274 }) 282 })
275 283
276 await waitJobs(servers) 284 await waitJobs(servers)
285
286 for (const server of servers) {
287 const videoChannel = await findChannel(server, secondVideoChannelId)
288
289 await testImage(server.url, 'avatar-resized', videoChannel.avatar.path, '.png')
290 }
277 }) 291 })
278 292
279 it('Should have video channel avatar updated', async function () { 293 it('Should update video channel banner', async function () {
294 this.timeout(15000)
295
296 const fixture = 'banner.jpg'
297
298 await updateVideoChannelImage({
299 url: servers[0].url,
300 accessToken: servers[0].accessToken,
301 videoChannelName: 'second_video_channel',
302 fixture,
303 type: 'banner'
304 })
305
306 await waitJobs(servers)
307
280 for (const server of servers) { 308 for (const server of servers) {
281 const res = await getVideoChannelsList(server.url, 0, 1, '-name') 309 const videoChannel = await findChannel(server, secondVideoChannelId)
282 310
283 const videoChannel = res.body.data.find(c => c.id === secondVideoChannelId) 311 await testImage(server.url, 'banner-resized', videoChannel.banner.path)
312 }
313 })
284 314
285 await testImage(server.url, 'avatar-resized', videoChannel.avatar.path, '.png') 315 it('Should delete the video channel avatar', async function () {
316 this.timeout(15000)
317
318 await deleteVideoChannelImage({
319 url: servers[0].url,
320 accessToken: servers[0].accessToken,
321 videoChannelName: 'second_video_channel',
322 type: 'avatar'
323 })
324
325 await waitJobs(servers)
326
327 for (const server of servers) {
328 const videoChannel = await findChannel(server, secondVideoChannelId)
329
330 expect(videoChannel.avatar).to.be.null
286 } 331 }
287 }) 332 })
288 333
289 it('Should get video channel', async function () { 334 it('Should delete the video channel banner', async function () {
290 const res = await getVideoChannel(servers[0].url, 'second_video_channel') 335 this.timeout(15000)
336
337 await deleteVideoChannelImage({
338 url: servers[0].url,
339 accessToken: servers[0].accessToken,
340 videoChannelName: 'second_video_channel',
341 type: 'banner'
342 })
291 343
292 const videoChannel = res.body 344 await waitJobs(servers)
293 expect(videoChannel.name).to.equal('second_video_channel') 345
294 expect(videoChannel.displayName).to.equal('video channel updated') 346 for (const server of servers) {
295 expect(videoChannel.description).to.equal('video channel description updated') 347 const videoChannel = await findChannel(server, secondVideoChannelId)
296 expect(videoChannel.support).to.equal('video channel support text updated') 348
349 expect(videoChannel.banner).to.be.null
350 }
297 }) 351 })
298 352
299 it('Should list the second video channel videos', async function () { 353 it('Should list the second video channel videos', async function () {