]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Fix feed with live stream
authorChocobozzz <me@florianbigard.com>
Mon, 27 Jun 2022 08:20:49 +0000 (10:20 +0200)
committerChocobozzz <me@florianbigard.com>
Mon, 27 Jun 2022 08:20:49 +0000 (10:20 +0200)
server/tests/feeds/feeds.ts

index 320dc33335c3713b06b96175548cd4a7f4e28f7b..ba3292a94f1ffab6e4a309a4c4145b3e43aa803f 100644 (file)
@@ -13,6 +13,7 @@ import {
   PeerTubeServer,
   setAccessTokensToServers,
   setDefaultChannelAvatar,
+  stopFfmpeg,
   waitJobs
 } from '@shared/server-commands'
 
@@ -30,6 +31,7 @@ describe('Test syndication feeds', () => {
   let userAccountId: number
   let userChannelId: number
   let userFeedToken: string
+  let liveId: string
 
   before(async function () {
     this.timeout(120000)
@@ -48,6 +50,8 @@ describe('Test syndication feeds', () => {
     await setDefaultChannelAvatar(servers[0])
     await doubleFollow(servers[0], servers[1])
 
+    await servers[0].config.enableLive({ allowReplay: false, transcoding: false })
+
     {
       const user = await servers[0].users.getMyInfo()
       rootAccountId = user.account.id
@@ -267,6 +271,41 @@ describe('Test syndication feeds', () => {
         expect(jsonObj.items[0].attachments[i].url).to.exist
       }
     })
+
+    it('Should not display waiting live videos', async function () {
+      const { uuid } = await servers[0].live.create({
+        fields: {
+          name: 'live',
+          privacy: VideoPrivacy.PUBLIC,
+          channelId: rootChannelId
+        }
+      })
+      liveId = uuid
+
+      const json = await servers[0].feed.getJSON({ feed: 'videos' })
+
+      const jsonObj = JSON.parse(json)
+      expect(jsonObj.items.length).to.be.equal(2)
+      expect(jsonObj.items[0].title).to.equal('my super name for server 1')
+      expect(jsonObj.items[1].title).to.equal('user video')
+    })
+
+    it('Should not display published live videos', async function () {
+      this.timeout(120000)
+
+      const ffmpeg = await servers[0].live.sendRTMPStreamInVideo({ videoId: liveId, copyCodecs: true, fixtureName: 'video_short.mp4' })
+      await servers[0].live.waitUntilPublished({ videoId: liveId })
+
+      const json = await servers[0].feed.getJSON({ feed: 'videos' })
+
+      const jsonObj = JSON.parse(json)
+      expect(jsonObj.items.length).to.be.equal(3)
+      expect(jsonObj.items[0].title).to.equal('my super name for server 1')
+      expect(jsonObj.items[1].title).to.equal('user video')
+      expect(jsonObj.items[2].title).to.equal('live video')
+
+      await stopFfmpeg(ffmpeg)
+    })
   })
 
   describe('Video comments feed', function () {