aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/feeds/feeds.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-08-24 16:11:37 +0200
committerChocobozzz <me@florianbigard.com>2020-08-24 16:11:37 +0200
commit97816649b793bdd0f3df64631ae0ef7cf3d7461c (patch)
treeabd56aac43d2d79dc4840d2ed6385449e1563286 /server/tests/feeds/feeds.ts
parent74055dc882e484b217f398917a3cc24bf2ea8cbe (diff)
downloadPeerTube-97816649b793bdd0f3df64631ae0ef7cf3d7461c.tar.gz
PeerTube-97816649b793bdd0f3df64631ae0ef7cf3d7461c.tar.zst
PeerTube-97816649b793bdd0f3df64631ae0ef7cf3d7461c.zip
Fix RSS feed when HLS only is enabled
Diffstat (limited to 'server/tests/feeds/feeds.ts')
-rw-r--r--server/tests/feeds/feeds.ts36
1 files changed, 33 insertions, 3 deletions
diff --git a/server/tests/feeds/feeds.ts b/server/tests/feeds/feeds.ts
index ba961cdba..0ff690f34 100644
--- a/server/tests/feeds/feeds.ts
+++ b/server/tests/feeds/feeds.ts
@@ -21,7 +21,8 @@ import {
21 setAccessTokensToServers, 21 setAccessTokensToServers,
22 uploadVideo, 22 uploadVideo,
23 uploadVideoAndGetId, 23 uploadVideoAndGetId,
24 userLogin 24 userLogin,
25 flushAndRunServer
25} from '../../../shared/extra-utils' 26} from '../../../shared/extra-utils'
26import { waitJobs } from '../../../shared/extra-utils/server/jobs' 27import { waitJobs } from '../../../shared/extra-utils/server/jobs'
27import { addVideoCommentThread } from '../../../shared/extra-utils/videos/video-comments' 28import { addVideoCommentThread } from '../../../shared/extra-utils/videos/video-comments'
@@ -34,6 +35,7 @@ const expect = chai.expect
34 35
35describe('Test syndication feeds', () => { 36describe('Test syndication feeds', () => {
36 let servers: ServerInfo[] = [] 37 let servers: ServerInfo[] = []
38 let serverHLSOnly: ServerInfo
37 let userAccessToken: string 39 let userAccessToken: string
38 let rootAccountId: number 40 let rootAccountId: number
39 let rootChannelId: number 41 let rootChannelId: number
@@ -45,8 +47,15 @@ describe('Test syndication feeds', () => {
45 47
46 // Run servers 48 // Run servers
47 servers = await flushAndRunMultipleServers(2) 49 servers = await flushAndRunMultipleServers(2)
50 serverHLSOnly = await flushAndRunServer(3, {
51 transcoding: {
52 enabled: true,
53 webtorrent: { enabled: false },
54 hls: { enabled: true }
55 }
56 })
48 57
49 await setAccessTokensToServers(servers) 58 await setAccessTokensToServers([ ...servers, serverHLSOnly ])
50 await doubleFollow(servers[0], servers[1]) 59 await doubleFollow(servers[0], servers[1])
51 60
52 { 61 {
@@ -116,6 +125,7 @@ describe('Test syndication feeds', () => {
116 }) 125 })
117 126
118 describe('Videos feed', function () { 127 describe('Videos feed', function () {
128
119 it('Should contain a valid enclosure (covers RSS 2.0 endpoint)', async function () { 129 it('Should contain a valid enclosure (covers RSS 2.0 endpoint)', async function () {
120 for (const server of servers) { 130 for (const server of servers) {
121 const rss = await getXMLfeed(server.url, 'videos') 131 const rss = await getXMLfeed(server.url, 'videos')
@@ -208,6 +218,26 @@ describe('Test syndication feeds', () => {
208 } 218 }
209 } 219 }
210 }) 220 })
221
222 it('Should correctly have videos feed with HLS only', async function () {
223 this.timeout(120000)
224
225 await uploadVideo(serverHLSOnly.url, serverHLSOnly.accessToken, { name: 'hls only video' })
226
227 await waitJobs([ serverHLSOnly ])
228
229 const json = await getJSONfeed(serverHLSOnly.url, 'videos')
230 const jsonObj = JSON.parse(json.text)
231 expect(jsonObj.items.length).to.be.equal(1)
232 expect(jsonObj.items[0].attachments).to.exist
233 expect(jsonObj.items[0].attachments.length).to.be.eq(4)
234
235 for (let i = 0; i < 4; i++) {
236 expect(jsonObj.items[0].attachments[i].mime_type).to.be.eq('application/x-bittorrent')
237 expect(jsonObj.items[0].attachments[i].size_in_bytes).to.be.greaterThan(0)
238 expect(jsonObj.items[0].attachments[i].url).to.exist
239 }
240 })
211 }) 241 })
212 242
213 describe('Video comments feed', function () { 243 describe('Video comments feed', function () {
@@ -260,6 +290,6 @@ describe('Test syndication feeds', () => {
260 }) 290 })
261 291
262 after(async function () { 292 after(async function () {
263 await cleanupTests(servers) 293 await cleanupTests([ ...servers, serverHLSOnly ])
264 }) 294 })
265}) 295})