+ const videoChannelAttributes = {
+ support: 'video channel support text updated',
+ bulkVideosSupportUpdate: true
+ }
+
+ await servers[0].channels.update({ channelName: 'second_video_channel', attributes: videoChannelAttributes })
+
+ await waitJobs(servers)
+
+ for (const server of servers) {
+ const video = await server.videos.get({ id: videoUUID })
+ expect(video.support).to.equal(videoChannelAttributes.support)
+ }
+ })
+
+ it('Should update video channel avatar', async function () {
+ this.timeout(15000)
+
+ const fixture = 'avatar.png'
+
+ await servers[0].channels.updateImage({
+ channelName: 'second_video_channel',
+ fixture,
+ type: 'avatar'
+ })
+
+ await waitJobs(servers)
+
+ for (const server of servers) {
+ const videoChannel = await findChannel(server, secondVideoChannelId)
+
+ avatarPaths[server.port] = videoChannel.avatar.path
+ await testImage(server.url, 'avatar-resized', avatarPaths[server.port], '.png')
+ await testFileExistsOrNot(server, 'avatars', basename(avatarPaths[server.port]), true)
+
+ const row = await server.sql.getActorImage(basename(avatarPaths[server.port]))
+ expect(row.height).to.equal(ACTOR_IMAGES_SIZE.AVATARS.height)
+ expect(row.width).to.equal(ACTOR_IMAGES_SIZE.AVATARS.width)
+ }
+ })
+
+ it('Should update video channel banner', async function () {
+ this.timeout(15000)
+
+ const fixture = 'banner.jpg'
+
+ await servers[0].channels.updateImage({
+ channelName: 'second_video_channel',
+ fixture,
+ type: 'banner'
+ })
+
+ await waitJobs(servers)
+
+ for (const server of servers) {
+ const videoChannel = await server.channels.get({ channelName: 'second_video_channel@' + servers[0].host })
+
+ bannerPaths[server.port] = videoChannel.banner.path
+ await testImage(server.url, 'banner-resized', bannerPaths[server.port])
+ await testFileExistsOrNot(server, 'avatars', basename(bannerPaths[server.port]), true)
+
+ const row = await server.sql.getActorImage(basename(bannerPaths[server.port]))
+ expect(row.height).to.equal(ACTOR_IMAGES_SIZE.BANNERS.height)
+ expect(row.width).to.equal(ACTOR_IMAGES_SIZE.BANNERS.width)
+ }
+ })
+
+ it('Should delete the video channel avatar', async function () {
+ this.timeout(15000)
+
+ await servers[0].channels.deleteImage({ channelName: 'second_video_channel', type: 'avatar' })
+
+ await waitJobs(servers)
+
+ for (const server of servers) {
+ const videoChannel = await findChannel(server, secondVideoChannelId)
+ await testFileExistsOrNot(server, 'avatars', basename(avatarPaths[server.port]), false)
+
+ expect(videoChannel.avatar).to.be.null
+ }
+ })
+
+ it('Should delete the video channel banner', async function () {
+ this.timeout(15000)
+
+ await servers[0].channels.deleteImage({ channelName: 'second_video_channel', type: 'banner' })
+
+ await waitJobs(servers)
+
+ for (const server of servers) {
+ const videoChannel = await findChannel(server, secondVideoChannelId)
+ await testFileExistsOrNot(server, 'avatars', basename(bannerPaths[server.port]), false)
+
+ expect(videoChannel.banner).to.be.null
+ }
+ })
+
+ it('Should list the second video channel videos', async function () {
+ this.timeout(10000)
+
+ for (const server of servers) {
+ const channelURI = 'second_video_channel@localhost:' + servers[0].port
+ const { total, data } = await server.videos.listByChannel({ handle: channelURI })
+
+ expect(total).to.equal(1)
+ expect(data).to.be.an('array')
+ expect(data).to.have.lengthOf(1)
+ expect(data[0].name).to.equal('my video name')
+ }
+ })
+
+ it('Should change the video channel of a video', async function () {
+ this.timeout(10000)
+
+ await servers[0].videos.update({ id: videoUUID, attributes: { channelId: servers[0].store.channel.id } })
+
+ await waitJobs(servers)
+ })
+
+ it('Should list the first video channel videos', async function () {
+ this.timeout(10000)
+
+ for (const server of servers) {
+ {
+ const secondChannelURI = 'second_video_channel@localhost:' + servers[0].port
+ const { total } = await server.videos.listByChannel({ handle: secondChannelURI })
+ expect(total).to.equal(0)
+ }
+
+ {
+ const channelURI = 'root_channel@localhost:' + servers[0].port
+ const { total, data } = await server.videos.listByChannel({ handle: channelURI })
+ expect(total).to.equal(1)
+
+ expect(data).to.be.an('array')
+ expect(data).to.have.lengthOf(1)
+ expect(data[0].name).to.equal('my video name')
+ }
+ }