]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/api/videos/multiple-servers.ts
Fix getting avatars in videos list
[github/Chocobozzz/PeerTube.git] / server / tests / api / videos / multiple-servers.ts
index 9fa03f1a9c95fd6abb3cb08d8c28ae5753a1c4d1..2a49fd360c31b09e51e63d87d8409a007fdd657f 100644 (file)
@@ -2,6 +2,7 @@
 
 import 'mocha'
 import * as chai from 'chai'
+import { and } from 'sequelize/dist'
 import request from 'supertest'
 import {
   checkTmpIsEmpty,
@@ -17,8 +18,11 @@ import {
   cleanupTests,
   createMultipleServers,
   doubleFollow,
+  makeGetRequest,
   PeerTubeServer,
   setAccessTokensToServers,
+  setDefaultAccountAvatar,
+  setDefaultChannelAvatar,
   waitJobs,
   webtorrentAdd
 } from '@shared/server-commands'
@@ -46,6 +50,9 @@ describe('Test multiple servers', function () {
         description: 'super channel'
       }
       await servers[0].channels.create({ attributes: videoChannel })
+      await setDefaultChannelAvatar(servers[0], videoChannel.name)
+      await setDefaultAccountAvatar(servers)
+
       const { data } = await servers[0].channels.list({ start: 0, count: 1 })
       videoChannelId = data[0].id
     }
@@ -133,6 +140,22 @@ describe('Test multiple servers', function () {
 
         await completeVideoCheck(server, video, checkAttributes)
         publishedAt = video.publishedAt as string
+
+        expect(video.channel.avatars).to.have.lengthOf(2)
+        expect(video.account.avatars).to.have.lengthOf(2)
+
+        for (const image of [ ...video.channel.avatars, ...video.account.avatars ]) {
+          expect(image.createdAt).to.exist
+          expect(image.updatedAt).to.exist
+          expect(image.width).to.be.above(20).and.below(1000)
+          expect(image.path).to.exist
+
+          await makeGetRequest({
+            url: server.url,
+            path: image.path,
+            expectedStatus: HttpStatusCode.OK_200
+          })
+        }
       }
     })
 
@@ -207,7 +230,7 @@ describe('Test multiple servers', function () {
             },
             {
               resolution: 720,
-              size: 788000
+              size: 750000
             }
           ],
           thumbnailfile: 'thumbnail',
@@ -380,7 +403,7 @@ describe('Test multiple servers', function () {
 
   describe('Should seed the uploaded video', function () {
     it('Should add the file 1 by asking server 3', async function () {
-      this.timeout(10000)
+      this.timeout(30000)
 
       const { data } = await servers[2].videos.list()
 
@@ -396,7 +419,7 @@ describe('Test multiple servers', function () {
     })
 
     it('Should add the file 2 by asking server 1', async function () {
-      this.timeout(10000)
+      this.timeout(30000)
 
       const { data } = await servers[0].videos.list()
 
@@ -410,7 +433,7 @@ describe('Test multiple servers', function () {
     })
 
     it('Should add the file 3 by asking server 2', async function () {
-      this.timeout(10000)
+      this.timeout(30000)
 
       const { data } = await servers[1].videos.list()
 
@@ -424,7 +447,7 @@ describe('Test multiple servers', function () {
     })
 
     it('Should add the file 3-2 by asking server 1', async function () {
-      this.timeout(10000)
+      this.timeout(30000)
 
       const { data } = await servers[0].videos.list()
 
@@ -438,7 +461,7 @@ describe('Test multiple servers', function () {
     })
 
     it('Should add the file 2 in 360p by asking server 1', async function () {
-      this.timeout(10000)
+      this.timeout(30000)
 
       const { data } = await servers[0].videos.list()
 
@@ -595,7 +618,7 @@ describe('Test multiple servers', function () {
     let updatedAtMin: Date
 
     it('Should update video 3', async function () {
-      this.timeout(10000)
+      this.timeout(30000)
 
       const attributes = {
         name: 'my super video updated',
@@ -618,7 +641,7 @@ describe('Test multiple servers', function () {
     })
 
     it('Should have the video 3 updated on each server', async function () {
-      this.timeout(10000)
+      this.timeout(30000)
 
       for (const server of servers) {
         const { data } = await server.videos.list()
@@ -669,7 +692,7 @@ describe('Test multiple servers', function () {
     })
 
     it('Should only update thumbnail and update updatedAt attribute', async function () {
-      this.timeout(10000)
+      this.timeout(30000)
 
       const attributes = {
         thumbnailfile: 'thumbnail.jpg'
@@ -861,7 +884,7 @@ describe('Test multiple servers', function () {
     })
 
     it('Should delete a reply', async function () {
-      this.timeout(10000)
+      this.timeout(30000)
 
       await servers[2].comments.delete({ videoId: videoUUID, commentId: childOfFirstChild.comment.id })
 
@@ -892,7 +915,7 @@ describe('Test multiple servers', function () {
     })
 
     it('Should delete the thread comments', async function () {
-      this.timeout(10000)
+      this.timeout(30000)
 
       const { data } = await servers[0].comments.listThreads({ videoId: videoUUID })
       const commentId = data.find(c => c.text === 'my super first comment').id