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,
setAccessTokensToServers,
updateVideoChannel
} from '../../utils/index'
-import { getAccountsList } from '../../utils/users/accounts'
+import { waitJobs } from '../../utils/server/jobs'
const expect = chai.expect
firstVideoChannelUUID = user.videoChannels[0].uuid
}
- await wait(5000)
+ await waitJobs(servers)
})
it('Should have one video channel (created with root)', async () => {
videoUUID = res.body.video.uuid
}
- await wait(3000)
+ await waitJobs(servers)
})
it('Should have two video channels when getting my information', async () => {
})
it('Should have two video channels when getting account channels on server 1', async function () {
- const res = await getAccountVideoChannelsList(servers[0].url, userInfo.account.uuid)
+ const res = await getAccountVideoChannelsList(servers[0].url, userInfo.account.name + '@' + userInfo.account.host)
expect(res.body.total).to.equal(2)
expect(res.body.data).to.be.an('array')
expect(res.body.data).to.have.lengthOf(2)
})
it('Should have one video channel when getting account channels on server 2', async function () {
- const res = await getAccountVideoChannelsList(servers[1].url, userInfo.account.uuid)
+ const res = await getAccountVideoChannelsList(servers[1].url, userInfo.account.name + '@' + userInfo.account.host)
expect(res.body.total).to.equal(1)
expect(res.body.data).to.be.an('array')
expect(res.body.data).to.have.lengthOf(1)
await updateVideoChannel(servers[0].url, servers[0].accessToken, secondVideoChannelId, videoChannelAttributes)
- await wait(3000)
+ await waitJobs(servers)
})
it('Should have video channel updated', async 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)
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 () {
after(async function () {
killallServers(servers)
-
- // Keep the logs if the test failed
- if (this['ok']) {
- await flushTests()
- }
})
})