]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/feeds/feeds.ts
Merge branch 'release/5.1.0' into develop
[github/Chocobozzz/PeerTube.git] / server / tests / feeds / feeds.ts
index 3a4b063bc3827c54ddb7c5201fe45c0b69a64bb1..ecd1badc160b4d20dd1bd57f7172591ef611432c 100644 (file)
@@ -9,6 +9,7 @@ import {
   createSingleServer,
   doubleFollow,
   makeGetRequest,
+  makeRawRequest,
   PeerTubeServer,
   setAccessTokensToServers,
   setDefaultChannelAvatar,
@@ -19,6 +20,7 @@ import {
 chai.use(require('chai-xml'))
 chai.use(require('chai-json-schema'))
 chai.config.includeStack = true
+
 const expect = chai.expect
 
 describe('Test syndication feeds', () => {
@@ -187,7 +189,7 @@ describe('Test syndication feeds', () => {
         const jsonObj = JSON.parse(json)
         expect(jsonObj.items.length).to.be.equal(1)
         expect(jsonObj.items[0].title).to.equal('my super name for server 1')
-        expect(jsonObj.items[0].author.name).to.equal('root')
+        expect(jsonObj.items[0].author.name).to.equal('Main root channel')
       }
 
       {
@@ -195,7 +197,7 @@ describe('Test syndication feeds', () => {
         const jsonObj = JSON.parse(json)
         expect(jsonObj.items.length).to.be.equal(1)
         expect(jsonObj.items[0].title).to.equal('user video')
-        expect(jsonObj.items[0].author.name).to.equal('john')
+        expect(jsonObj.items[0].author.name).to.equal('Main john channel')
       }
 
       for (const server of servers) {
@@ -221,7 +223,7 @@ describe('Test syndication feeds', () => {
         const jsonObj = JSON.parse(json)
         expect(jsonObj.items.length).to.be.equal(1)
         expect(jsonObj.items[0].title).to.equal('my super name for server 1')
-        expect(jsonObj.items[0].author.name).to.equal('root')
+        expect(jsonObj.items[0].author.name).to.equal('Main root channel')
       }
 
       {
@@ -229,7 +231,7 @@ describe('Test syndication feeds', () => {
         const jsonObj = JSON.parse(json)
         expect(jsonObj.items.length).to.be.equal(1)
         expect(jsonObj.items[0].title).to.equal('user video')
-        expect(jsonObj.items[0].author.name).to.equal('john')
+        expect(jsonObj.items[0].author.name).to.equal('Main john channel')
       }
 
       for (const server of servers) {
@@ -305,6 +307,15 @@ describe('Test syndication feeds', () => {
 
       await stopFfmpeg(ffmpeg)
     })
+
+    it('Should have the channel avatar as feed icon', async function () {
+      const json = await servers[0].feed.getJSON({ feed: 'videos', query: { videoChannelId: rootChannelId }, ignoreCache: true })
+
+      const jsonObj = JSON.parse(json)
+      const imageUrl = jsonObj.icon
+      expect(imageUrl).to.include('/lazy-static/avatars/')
+      await makeRawRequest({ url: imageUrl, expectedStatus: HttpStatusCode.OK_200 })
+    })
   })
 
   describe('Video comments feed', function () {
@@ -376,7 +387,7 @@ describe('Test syndication feeds', () => {
       }
 
       {
-        const body = await servers[0].subscriptions.listVideos({ token: feeduserAccessToken })
+        const body = await servers[0].videos.listMySubscriptionVideos({ token: feeduserAccessToken })
         expect(body.total).to.equal(0)
 
         const query = { accountId: feeduserAccountId, token: feeduserFeedToken }
@@ -397,7 +408,7 @@ describe('Test syndication feeds', () => {
     })
 
     it('Should list no videos for a user with videos but no subscriptions', async function () {
-      const body = await servers[0].subscriptions.listVideos({ token: userAccessToken })
+      const body = await servers[0].videos.listMySubscriptionVideos({ token: userAccessToken })
       expect(body.total).to.equal(0)
 
       const query = { accountId: userAccountId, token: userFeedToken }
@@ -413,7 +424,7 @@ describe('Test syndication feeds', () => {
       await waitJobs(servers)
 
       {
-        const body = await servers[0].subscriptions.listVideos({ token: userAccessToken })
+        const body = await servers[0].videos.listMySubscriptionVideos({ token: userAccessToken })
         expect(body.total).to.equal(1)
         expect(body.data[0].name).to.equal('user video')
 
@@ -431,7 +442,7 @@ describe('Test syndication feeds', () => {
       await waitJobs(servers)
 
       {
-        const body = await servers[0].subscriptions.listVideos({ token: userAccessToken })
+        const body = await servers[0].videos.listMySubscriptionVideos({ token: userAccessToken })
         expect(body.total).to.equal(2, 'there should be 2 videos part of the subscription')
 
         const query = { accountId: userAccountId, token: userFeedToken }