X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftests%2Fapi%2Fvideos%2Fvideo-channels.ts;h=e4e3ce9d9e78a2498b8d197e81eb4118e5fa6fd1;hb=4bbfc6c606c8d3794bae25c64c516120af41f4eb;hp=7ae505fd78b046da9218822918e9afa71be3673f;hpb=ad9e39fb815d85e5e718c40540fa75471474fa17;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tests/api/videos/video-channels.ts b/server/tests/api/videos/video-channels.ts index 7ae505fd7..e4e3ce9d9 100644 --- a/server/tests/api/videos/video-channels.ts +++ b/server/tests/api/videos/video-channels.ts @@ -3,7 +3,14 @@ import * as chai from 'chai' import 'mocha' import { User, Video } from '../../../../shared/index' -import { doubleFollow, flushAndRunMultipleServers, getVideoChannelVideos, updateVideo, uploadVideo, wait } from '../../utils' +import { + doubleFollow, + flushAndRunMultipleServers, + getVideoChannelVideos, testImage, + updateVideo, + updateVideoChannelAvatar, + uploadVideo, wait +} from '../../utils' import { addVideoChannel, deleteVideoChannel, @@ -17,6 +24,7 @@ import { setAccessTokensToServers, updateVideoChannel } from '../../utils/index' +import { waitJobs } from '../../utils/server/jobs' const expect = chai.expect @@ -49,7 +57,7 @@ describe('Test video channels', function () { firstVideoChannelUUID = user.videoChannels[0].uuid } - await wait(5000) + await waitJobs(servers) }) it('Should have one video channel (created with root)', async () => { @@ -80,7 +88,7 @@ describe('Test video channels', function () { videoUUID = res.body.video.uuid } - await wait(3000) + await waitJobs(servers) }) it('Should have two video channels when getting my information', async () => { @@ -142,7 +150,7 @@ describe('Test video channels', function () { await updateVideoChannel(servers[0].url, servers[0].accessToken, secondVideoChannelId, videoChannelAttributes) - await wait(3000) + await waitJobs(servers) }) it('Should have video channel updated', async function () { @@ -158,6 +166,31 @@ describe('Test video channels', function () { } }) + it('Should update video channel avatar', async function () { + this.timeout(5000) + + const fixture = 'avatar.png' + + await updateVideoChannelAvatar({ + url: servers[0].url, + accessToken: servers[0].accessToken, + videoChannelId: secondVideoChannelId, + fixture + }) + + await waitJobs(servers) + }) + + it('Should have video channel avatar updated', async function () { + for (const server of servers) { + const res = await getVideoChannelsList(server.url, 0, 1, '-name') + + const videoChannel = res.body.data.find(c => c.id === secondVideoChannelId) + + await testImage(server.url, 'avatar-resized', videoChannel.avatar.path, '.png') + } + }) + it('Should get video channel', async function () { const res = await getVideoChannel(servers[0].url, secondVideoChannelId) @@ -184,7 +217,7 @@ describe('Test video channels', function () { await updateVideo(servers[0].url, servers[0].accessToken, videoUUID, { channelId: firstVideoChannelId }) - await wait(5000) + await waitJobs(servers) }) it('Should list the first video channel videos', async function () { @@ -219,10 +252,5 @@ describe('Test video channels', function () { after(async function () { killallServers(servers) - - // Keep the logs if the test failed - if (this['ok']) { - await flushTests() - } }) })