+ const videoChannelAttributes = {
+ support: 'video channel support text updated',
+ bulkVideosSupportUpdate: true
+ }
+
+ await servers[0].channelsCommand.update({ channelName: 'second_video_channel', attributes: videoChannelAttributes })
+
+ await waitJobs(servers)
+
+ for (const server of servers) {
+ const res = await getVideo(server.url, videoUUID)
+ const video: VideoDetails = res.body
+
+ 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].channelsCommand.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 getActorImage(server.internalServerNumber, 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].channelsCommand.updateImage({
+ channelName: 'second_video_channel',
+ fixture,
+ type: 'banner'
+ })
+
+ await waitJobs(servers)
+
+ for (const server of servers) {
+ const videoChannel = await server.channelsCommand.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 getActorImage(server.internalServerNumber, 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].channelsCommand.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].channelsCommand.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 res1 = await getVideoChannelVideos(server.url, server.accessToken, channelURI, 0, 5)
+ expect(res1.body.total).to.equal(1)
+ expect(res1.body.data).to.be.an('array')
+ expect(res1.body.data).to.have.lengthOf(1)
+ expect(res1.body.data[0].name).to.equal('my video name')
+ }
+ })
+
+ it('Should change the video channel of a video', async function () {
+ this.timeout(10000)
+
+ await updateVideo(servers[0].url, servers[0].accessToken, videoUUID, { channelId: servers[0].videoChannel.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 res1 = await getVideoChannelVideos(server.url, server.accessToken, secondChannelURI, 0, 5)
+ expect(res1.body.total).to.equal(0)
+
+ const channelURI = 'root_channel@localhost:' + servers[0].port
+ const res2 = await getVideoChannelVideos(server.url, server.accessToken, channelURI, 0, 5)
+ expect(res2.body.total).to.equal(1)
+
+ const videos: Video[] = res2.body.data
+ expect(videos).to.be.an('array')
+ expect(videos).to.have.lengthOf(1)
+ expect(videos[0].name).to.equal('my video name')
+ }