1 /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
3 import * as chai from 'chai'
4 import { XMLParser, XMLValidator } from 'fast-xml-parser'
5 import { HttpStatusCode, VideoPrivacy } from '@shared/models'
15 setAccessTokensToServers,
16 setDefaultChannelAvatar,
17 setDefaultVideoChannel,
20 } from '@shared/server-commands'
22 chai.use(require('chai-xml'))
23 chai.use(require('chai-json-schema'))
24 chai.config.includeStack = true
26 const expect = chai.expect
28 describe('Test syndication feeds', () => {
29 let servers: PeerTubeServer[] = []
30 let serverHLSOnly: PeerTubeServer
32 let userAccessToken: string
33 let rootAccountId: number
34 let rootChannelId: number
36 let userAccountId: number
37 let userChannelId: number
38 let userFeedToken: string
42 before(async function () {
46 servers = await createMultipleServers(2)
47 serverHLSOnly = await createSingleServer(3, {
50 webtorrent: { enabled: false },
51 hls: { enabled: true }
55 await setAccessTokensToServers([ ...servers, serverHLSOnly ])
56 await setDefaultChannelAvatar(servers[0])
57 await setDefaultVideoChannel(servers)
58 await doubleFollow(servers[0], servers[1])
60 await servers[0].config.enableLive({ allowReplay: false, transcoding: false })
63 const user = await servers[0].users.getMyInfo()
64 rootAccountId = user.account.id
65 rootChannelId = user.videoChannels[0].id
69 userAccessToken = await servers[0].users.generateUserAndToken('john')
71 const user = await servers[0].users.getMyInfo({ token: userAccessToken })
72 userAccountId = user.account.id
73 userChannelId = user.videoChannels[0].id
75 const token = await servers[0].users.getMyScopedTokens({ token: userAccessToken })
76 userFeedToken = token.feedToken
80 await servers[0].videos.upload({ token: userAccessToken, attributes: { name: 'user video' } })
85 name: 'my super name for server 1',
86 description: 'my super description for server 1',
87 fixture: 'video_short.webm'
89 const { id } = await servers[0].videos.upload({ attributes })
91 await servers[0].comments.createThread({ videoId: id, text: 'super comment 1' })
92 await servers[0].comments.createThread({ videoId: id, text: 'super comment 2' })
96 const attributes = { name: 'unlisted video', privacy: VideoPrivacy.UNLISTED }
97 const { id } = await servers[0].videos.upload({ attributes })
99 await servers[0].comments.createThread({ videoId: id, text: 'comment on unlisted video' })
102 await serverHLSOnly.videos.upload({ attributes: { name: 'hls only video' } })
104 await waitJobs([ ...servers, serverHLSOnly ])
106 await servers[0].plugins.install({ path: PluginsCommand.getPluginTestPath('-podcast-custom-tags') })
109 describe('All feed', function () {
111 it('Should be well formed XML (covers RSS 2.0 and ATOM 1.0 endpoints)', async function () {
112 for (const feed of [ 'video-comments' as 'video-comments', 'videos' as 'videos' ]) {
113 const rss = await servers[0].feed.getXML({ feed, ignoreCache: true })
114 expect(rss).xml.to.be.valid()
116 const atom = await servers[0].feed.getXML({ feed, format: 'atom', ignoreCache: true })
117 expect(atom).xml.to.be.valid()
121 it('Should be well formed XML (covers Podcast endpoint)', async function () {
122 const podcast = await servers[0].feed.getPodcastXML({ ignoreCache: true, channelId: rootChannelId })
123 expect(podcast).xml.to.be.valid()
126 it('Should be well formed JSON (covers JSON feed 1.0 endpoint)', async function () {
127 for (const feed of [ 'video-comments' as 'video-comments', 'videos' as 'videos' ]) {
128 const jsonText = await servers[0].feed.getJSON({ feed, ignoreCache: true })
129 expect(JSON.parse(jsonText)).to.be.jsonSchema({ type: 'object' })
133 it('Should serve the endpoint with a classic request', async function () {
134 await makeGetRequest({
136 path: '/feeds/videos.xml',
137 accept: 'application/xml',
138 expectedStatus: HttpStatusCode.OK_200
142 it('Should refuse to serve the endpoint without accept header', async function () {
143 await makeGetRequest({ url: servers[0].url, path: '/feeds/videos.xml', expectedStatus: HttpStatusCode.NOT_ACCEPTABLE_406 })
147 describe('Videos feed', function () {
149 describe('Podcast feed', function () {
151 it('Should contain a valid podcast:alternateEnclosure', async function () {
152 // Since podcast feeds should only work on the server they originate on,
153 // only test the first server where the videos reside
154 const rss = await servers[0].feed.getPodcastXML({ ignoreCache: false, channelId: rootChannelId })
155 expect(XMLValidator.validate(rss)).to.be.true
157 const parser = new XMLParser({ parseAttributeValue: true, ignoreAttributes: false })
158 const xmlDoc = parser.parse(rss)
160 const itemGuid = xmlDoc.rss.channel.item.guid
161 expect(itemGuid).to.exist
162 expect(itemGuid['@_isPermaLink']).to.equal(true)
164 const enclosure = xmlDoc.rss.channel.item.enclosure
165 expect(enclosure).to.exist
166 const alternateEnclosure = xmlDoc.rss.channel.item['podcast:alternateEnclosure']
167 expect(alternateEnclosure).to.exist
169 expect(alternateEnclosure['@_type']).to.equal('video/webm')
170 expect(alternateEnclosure['@_length']).to.equal(218910)
171 expect(alternateEnclosure['@_lang']).to.equal('zh')
172 expect(alternateEnclosure['@_title']).to.equal('720p')
173 expect(alternateEnclosure['@_default']).to.equal(true)
175 expect(alternateEnclosure['podcast:source'][0]['@_uri']).to.contain('-720.webm')
176 expect(alternateEnclosure['podcast:source'][0]['@_uri']).to.equal(enclosure['@_url'])
177 expect(alternateEnclosure['podcast:source'][1]['@_uri']).to.contain('-720.torrent')
178 expect(alternateEnclosure['podcast:source'][1]['@_contentType']).to.equal('application/x-bittorrent')
179 expect(alternateEnclosure['podcast:source'][2]['@_uri']).to.contain('magnet:?')
182 it('Should contain a valid podcast:alternateEnclosure with HLS only', async function () {
183 const rss = await serverHLSOnly.feed.getPodcastXML({ ignoreCache: false, channelId: rootChannelId })
184 expect(XMLValidator.validate(rss)).to.be.true
186 const parser = new XMLParser({ parseAttributeValue: true, ignoreAttributes: false })
187 const xmlDoc = parser.parse(rss)
189 const itemGuid = xmlDoc.rss.channel.item.guid
190 expect(itemGuid).to.exist
191 expect(itemGuid['@_isPermaLink']).to.equal(true)
193 const enclosure = xmlDoc.rss.channel.item.enclosure
194 const alternateEnclosure = xmlDoc.rss.channel.item['podcast:alternateEnclosure']
195 expect(alternateEnclosure).to.exist
197 expect(alternateEnclosure['@_type']).to.equal('application/x-mpegURL')
198 expect(alternateEnclosure['@_lang']).to.equal('zh')
199 expect(alternateEnclosure['@_title']).to.equal('HLS')
200 expect(alternateEnclosure['@_default']).to.equal(true)
202 expect(alternateEnclosure['podcast:source']['@_uri']).to.contain('-master.m3u8')
203 expect(alternateEnclosure['podcast:source']['@_uri']).to.equal(enclosure['@_url'])
206 it('Should contain a valid podcast:socialInteract', async function () {
207 const rss = await servers[0].feed.getPodcastXML({ ignoreCache: false, channelId: rootChannelId })
208 expect(XMLValidator.validate(rss)).to.be.true
210 const parser = new XMLParser({ parseAttributeValue: true, ignoreAttributes: false })
211 const xmlDoc = parser.parse(rss)
213 const item = xmlDoc.rss.channel.item
214 const socialInteract = item['podcast:socialInteract']
215 expect(socialInteract).to.exist
216 expect(socialInteract['@_protocol']).to.equal('activitypub')
217 expect(socialInteract['@_uri']).to.exist
218 expect(socialInteract['@_accountUrl']).to.exist
221 it('Should contain a valid support custom tags for plugins', async function () {
222 const rss = await servers[0].feed.getPodcastXML({ ignoreCache: false, channelId: userChannelId })
223 expect(XMLValidator.validate(rss)).to.be.true
225 const parser = new XMLParser({ parseAttributeValue: true, ignoreAttributes: false })
226 const xmlDoc = parser.parse(rss)
228 const fooTag = xmlDoc.rss.channel.fooTag
229 expect(fooTag).to.exist
230 expect(fooTag['@_bar']).to.equal('baz')
231 expect(fooTag['#text']).to.equal(42)
233 const bizzBuzzItem = xmlDoc.rss.channel['biz:buzzItem']
234 expect(bizzBuzzItem).to.exist
236 let nestedTag = bizzBuzzItem.nestedTag
237 expect(nestedTag).to.exist
238 expect(nestedTag).to.equal('example nested tag')
240 const item = xmlDoc.rss.channel.item
241 const fizzTag = item.fizzTag
242 expect(fizzTag).to.exist
243 expect(fizzTag['@_bar']).to.equal('baz')
244 expect(fizzTag['#text']).to.equal(21)
246 const bizzBuzz = item['biz:buzz']
247 expect(bizzBuzz).to.exist
249 nestedTag = bizzBuzz.nestedTag
250 expect(nestedTag).to.exist
251 expect(nestedTag).to.equal('example nested tag')
254 it('Should contain a valid podcast:liveItem for live streams', async function () {
257 const { uuid } = await servers[0].live.create({
260 privacy: VideoPrivacy.PUBLIC,
261 channelId: rootChannelId,
267 const ffmpeg = await servers[0].live.sendRTMPStreamInVideo({ videoId: liveId, copyCodecs: true, fixtureName: 'video_short.mp4' })
268 await servers[0].live.waitUntilPublished({ videoId: liveId })
270 const rss = await servers[0].feed.getPodcastXML({ ignoreCache: false, channelId: rootChannelId })
271 expect(XMLValidator.validate(rss)).to.be.true
273 const parser = new XMLParser({ parseAttributeValue: true, ignoreAttributes: false })
274 const xmlDoc = parser.parse(rss)
275 const liveItem = xmlDoc.rss.channel['podcast:liveItem']
276 expect(liveItem.title).to.equal('live-0')
277 expect(liveItem.guid['@_isPermaLink']).to.equal(false)
278 expect(liveItem.guid['#text']).to.contain(`${uuid}_`)
279 expect(liveItem['@_status']).to.equal('live')
281 const enclosure = liveItem.enclosure
282 const alternateEnclosure = liveItem['podcast:alternateEnclosure']
283 expect(alternateEnclosure).to.exist
284 expect(alternateEnclosure['@_type']).to.equal('application/x-mpegURL')
285 expect(alternateEnclosure['@_title']).to.equal('HLS live stream')
286 expect(alternateEnclosure['@_default']).to.equal(true)
288 expect(alternateEnclosure['podcast:source']['@_uri']).to.contain('/master.m3u8')
289 expect(alternateEnclosure['podcast:source']['@_uri']).to.equal(enclosure['@_url'])
291 await stopFfmpeg(ffmpeg)
293 await servers[0].live.waitUntilEnded({ videoId: liveId })
295 await waitJobs(servers)
299 describe('JSON feed', function () {
301 it('Should contain a valid \'attachments\' object', async function () {
302 for (const server of servers) {
303 const json = await server.feed.getJSON({ feed: 'videos', ignoreCache: true })
304 const jsonObj = JSON.parse(json)
305 expect(jsonObj.items.length).to.be.equal(2)
306 expect(jsonObj.items[0].attachments).to.exist
307 expect(jsonObj.items[0].attachments.length).to.be.eq(1)
308 expect(jsonObj.items[0].attachments[0].mime_type).to.be.eq('application/x-bittorrent')
309 expect(jsonObj.items[0].attachments[0].size_in_bytes).to.be.eq(218910)
310 expect(jsonObj.items[0].attachments[0].url).to.contain('720.torrent')
314 it('Should filter by account', async function () {
316 const json = await servers[0].feed.getJSON({ feed: 'videos', query: { accountId: rootAccountId }, ignoreCache: true })
317 const jsonObj = JSON.parse(json)
318 expect(jsonObj.items.length).to.be.equal(1)
319 expect(jsonObj.items[0].title).to.equal('my super name for server 1')
320 expect(jsonObj.items[0].author.name).to.equal('Main root channel')
324 const json = await servers[0].feed.getJSON({ feed: 'videos', query: { accountId: userAccountId }, ignoreCache: true })
325 const jsonObj = JSON.parse(json)
326 expect(jsonObj.items.length).to.be.equal(1)
327 expect(jsonObj.items[0].title).to.equal('user video')
328 expect(jsonObj.items[0].author.name).to.equal('Main john channel')
331 for (const server of servers) {
333 const json = await server.feed.getJSON({ feed: 'videos', query: { accountName: 'root@' + servers[0].host }, ignoreCache: true })
334 const jsonObj = JSON.parse(json)
335 expect(jsonObj.items.length).to.be.equal(1)
336 expect(jsonObj.items[0].title).to.equal('my super name for server 1')
340 const json = await server.feed.getJSON({ feed: 'videos', query: { accountName: 'john@' + servers[0].host }, ignoreCache: true })
341 const jsonObj = JSON.parse(json)
342 expect(jsonObj.items.length).to.be.equal(1)
343 expect(jsonObj.items[0].title).to.equal('user video')
348 it('Should filter by video channel', async function () {
350 const json = await servers[0].feed.getJSON({ feed: 'videos', query: { videoChannelId: rootChannelId }, ignoreCache: true })
351 const jsonObj = JSON.parse(json)
352 expect(jsonObj.items.length).to.be.equal(1)
353 expect(jsonObj.items[0].title).to.equal('my super name for server 1')
354 expect(jsonObj.items[0].author.name).to.equal('Main root channel')
358 const json = await servers[0].feed.getJSON({ feed: 'videos', query: { videoChannelId: userChannelId }, ignoreCache: true })
359 const jsonObj = JSON.parse(json)
360 expect(jsonObj.items.length).to.be.equal(1)
361 expect(jsonObj.items[0].title).to.equal('user video')
362 expect(jsonObj.items[0].author.name).to.equal('Main john channel')
365 for (const server of servers) {
367 const query = { videoChannelName: 'root_channel@' + servers[0].host }
368 const json = await server.feed.getJSON({ feed: 'videos', query, ignoreCache: true })
369 const jsonObj = JSON.parse(json)
370 expect(jsonObj.items.length).to.be.equal(1)
371 expect(jsonObj.items[0].title).to.equal('my super name for server 1')
375 const query = { videoChannelName: 'john_channel@' + servers[0].host }
376 const json = await server.feed.getJSON({ feed: 'videos', query, ignoreCache: true })
377 const jsonObj = JSON.parse(json)
378 expect(jsonObj.items.length).to.be.equal(1)
379 expect(jsonObj.items[0].title).to.equal('user video')
384 it('Should correctly have videos feed with HLS only', async function () {
387 const json = await serverHLSOnly.feed.getJSON({ feed: 'videos', ignoreCache: true })
388 const jsonObj = JSON.parse(json)
389 expect(jsonObj.items.length).to.be.equal(1)
390 expect(jsonObj.items[0].attachments).to.exist
391 expect(jsonObj.items[0].attachments.length).to.be.eq(4)
393 for (let i = 0; i < 4; i++) {
394 expect(jsonObj.items[0].attachments[i].mime_type).to.be.eq('application/x-bittorrent')
395 expect(jsonObj.items[0].attachments[i].size_in_bytes).to.be.greaterThan(0)
396 expect(jsonObj.items[0].attachments[i].url).to.exist
400 it('Should not display waiting live videos', async function () {
401 const { uuid } = await servers[0].live.create({
404 privacy: VideoPrivacy.PUBLIC,
405 channelId: rootChannelId
410 const json = await servers[0].feed.getJSON({ feed: 'videos', ignoreCache: true })
412 const jsonObj = JSON.parse(json)
413 expect(jsonObj.items.length).to.be.equal(2)
414 expect(jsonObj.items[0].title).to.equal('my super name for server 1')
415 expect(jsonObj.items[1].title).to.equal('user video')
418 it('Should display published live videos', async function () {
421 const ffmpeg = await servers[0].live.sendRTMPStreamInVideo({ videoId: liveId, copyCodecs: true, fixtureName: 'video_short.mp4' })
422 await servers[0].live.waitUntilPublished({ videoId: liveId })
424 const json = await servers[0].feed.getJSON({ feed: 'videos', ignoreCache: true })
426 const jsonObj = JSON.parse(json)
427 expect(jsonObj.items.length).to.be.equal(3)
428 expect(jsonObj.items[0].title).to.equal('live')
429 expect(jsonObj.items[1].title).to.equal('my super name for server 1')
430 expect(jsonObj.items[2].title).to.equal('user video')
432 await stopFfmpeg(ffmpeg)
435 it('Should have the channel avatar as feed icon', async function () {
436 const json = await servers[0].feed.getJSON({ feed: 'videos', query: { videoChannelId: rootChannelId }, ignoreCache: true })
438 const jsonObj = JSON.parse(json)
439 const imageUrl = jsonObj.icon
440 expect(imageUrl).to.include('/lazy-static/avatars/')
441 await makeRawRequest({ url: imageUrl, expectedStatus: HttpStatusCode.OK_200 })
446 describe('Video comments feed', function () {
448 it('Should contain valid comments (covers JSON feed 1.0 endpoint) and not from unlisted videos', async function () {
449 for (const server of servers) {
450 const json = await server.feed.getJSON({ feed: 'video-comments', ignoreCache: true })
452 const jsonObj = JSON.parse(json)
453 expect(jsonObj.items.length).to.be.equal(2)
454 expect(jsonObj.items[0].content_html).to.contain('<p>super comment 2</p>')
455 expect(jsonObj.items[1].content_html).to.contain('<p>super comment 1</p>')
459 it('Should not list comments from muted accounts or instances', async function () {
462 const remoteHandle = 'root@' + servers[0].host
464 await servers[1].blocklist.addToServerBlocklist({ account: remoteHandle })
467 const json = await servers[1].feed.getJSON({ feed: 'video-comments', ignoreCache: true })
468 const jsonObj = JSON.parse(json)
469 expect(jsonObj.items.length).to.be.equal(0)
472 await servers[1].blocklist.removeFromServerBlocklist({ account: remoteHandle })
475 const videoUUID = (await servers[1].videos.quickUpload({ name: 'server 2' })).uuid
476 await waitJobs(servers)
477 await servers[0].comments.createThread({ videoId: videoUUID, text: 'super comment' })
478 await waitJobs(servers)
480 const json = await servers[1].feed.getJSON({ feed: 'video-comments', ignoreCache: true })
481 const jsonObj = JSON.parse(json)
482 expect(jsonObj.items.length).to.be.equal(3)
485 await servers[1].blocklist.addToMyBlocklist({ account: remoteHandle })
488 const json = await servers[1].feed.getJSON({ feed: 'video-comments', ignoreCache: true })
489 const jsonObj = JSON.parse(json)
490 expect(jsonObj.items.length).to.be.equal(2)
495 describe('Video feed from my subscriptions', function () {
496 let feeduserAccountId: number
497 let feeduserFeedToken: string
499 it('Should list no videos for a user with no videos and no subscriptions', async function () {
500 const attr = { username: 'feeduser', password: 'password' }
501 await servers[0].users.create({ username: attr.username, password: attr.password })
502 const feeduserAccessToken = await servers[0].login.getAccessToken(attr)
505 const user = await servers[0].users.getMyInfo({ token: feeduserAccessToken })
506 feeduserAccountId = user.account.id
510 const token = await servers[0].users.getMyScopedTokens({ token: feeduserAccessToken })
511 feeduserFeedToken = token.feedToken
515 const body = await servers[0].videos.listMySubscriptionVideos({ token: feeduserAccessToken })
516 expect(body.total).to.equal(0)
518 const query = { accountId: feeduserAccountId, token: feeduserFeedToken }
519 const json = await servers[0].feed.getJSON({ feed: 'subscriptions', query, ignoreCache: true })
520 const jsonObj = JSON.parse(json)
521 expect(jsonObj.items.length).to.be.equal(0) // no subscription, it should not list the instance's videos but list 0 videos
525 it('Should fail with an invalid token', async function () {
526 const query = { accountId: feeduserAccountId, token: 'toto' }
527 await servers[0].feed.getJSON({ feed: 'subscriptions', query, expectedStatus: HttpStatusCode.FORBIDDEN_403, ignoreCache: true })
530 it('Should fail with a token of another user', async function () {
531 const query = { accountId: feeduserAccountId, token: userFeedToken }
532 await servers[0].feed.getJSON({ feed: 'subscriptions', query, expectedStatus: HttpStatusCode.FORBIDDEN_403, ignoreCache: true })
535 it('Should list no videos for a user with videos but no subscriptions', async function () {
536 const body = await servers[0].videos.listMySubscriptionVideos({ token: userAccessToken })
537 expect(body.total).to.equal(0)
539 const query = { accountId: userAccountId, token: userFeedToken }
540 const json = await servers[0].feed.getJSON({ feed: 'subscriptions', query, ignoreCache: true })
541 const jsonObj = JSON.parse(json)
542 expect(jsonObj.items.length).to.be.equal(0) // no subscription, it should not list the instance's videos but list 0 videos
545 it('Should list self videos for a user with a subscription to themselves', async function () {
548 await servers[0].subscriptions.add({ token: userAccessToken, targetUri: 'john_channel@' + servers[0].host })
549 await waitJobs(servers)
552 const body = await servers[0].videos.listMySubscriptionVideos({ token: userAccessToken })
553 expect(body.total).to.equal(1)
554 expect(body.data[0].name).to.equal('user video')
556 const query = { accountId: userAccountId, token: userFeedToken }
557 const json = await servers[0].feed.getJSON({ feed: 'subscriptions', query, ignoreCache: true })
558 const jsonObj = JSON.parse(json)
559 expect(jsonObj.items.length).to.be.equal(1) // subscribed to self, it should not list the instance's videos but list john's
563 it('Should list videos of a user\'s subscription', async function () {
566 await servers[0].subscriptions.add({ token: userAccessToken, targetUri: 'root_channel@' + servers[0].host })
567 await waitJobs(servers)
570 const body = await servers[0].videos.listMySubscriptionVideos({ token: userAccessToken })
571 expect(body.total).to.equal(2, 'there should be 2 videos part of the subscription')
573 const query = { accountId: userAccountId, token: userFeedToken }
574 const json = await servers[0].feed.getJSON({ feed: 'subscriptions', query, ignoreCache: true })
575 const jsonObj = JSON.parse(json)
576 expect(jsonObj.items.length).to.be.equal(2) // subscribed to root, it should not list the instance's videos but list root/john's
580 it('Should renew the token, and so have an invalid old token', async function () {
581 await servers[0].users.renewMyScopedTokens({ token: userAccessToken })
583 const query = { accountId: userAccountId, token: userFeedToken }
584 await servers[0].feed.getJSON({ feed: 'subscriptions', query, expectedStatus: HttpStatusCode.FORBIDDEN_403, ignoreCache: true })
587 it('Should succeed with the new token', async function () {
588 const token = await servers[0].users.getMyScopedTokens({ token: userAccessToken })
589 userFeedToken = token.feedToken
591 const query = { accountId: userAccountId, token: userFeedToken }
592 await servers[0].feed.getJSON({ feed: 'subscriptions', query, ignoreCache: true })
597 describe('Cache', function () {
598 const uuids: string[] = []
600 function doPodcastRequest () {
601 return makeGetRequest({
603 path: '/feeds/podcast/videos.xml',
604 query: { videoChannelId: servers[0].store.channel.id },
605 accept: 'application/xml',
606 expectedStatus: HttpStatusCode.OK_200
610 function doVideosRequest (query: { [id: string]: string } = {}) {
611 return makeGetRequest({
613 path: '/feeds/videos.xml',
615 accept: 'application/xml',
616 expectedStatus: HttpStatusCode.OK_200
620 before(async function () {
622 const { uuid } = await servers[0].videos.quickUpload({ name: 'cache 1' })
627 const { uuid } = await servers[0].videos.quickUpload({ name: 'cache 2' })
632 it('Should serve the videos endpoint as a cached request', async function () {
633 await doVideosRequest()
635 const res = await doVideosRequest()
637 expect(res.headers['x-api-cache-cached']).to.equal('true')
640 it('Should not serve the videos endpoint as a cached request', async function () {
641 const res = await doVideosRequest({ v: '186' })
643 expect(res.headers['x-api-cache-cached']).to.not.exist
646 it('Should invalidate the podcast feed cache after video deletion', async function () {
647 await doPodcastRequest()
650 const res = await doPodcastRequest()
651 expect(res.headers['x-api-cache-cached']).to.exist
654 await servers[0].videos.remove({ id: uuids[0] })
657 const res = await doPodcastRequest()
658 expect(res.headers['x-api-cache-cached']).to.not.exist
662 it('Should invalidate the podcast feed cache after video deletion, even after server restart', async function () {
665 await doPodcastRequest()
668 const res = await doPodcastRequest()
669 expect(res.headers['x-api-cache-cached']).to.exist
672 await servers[0].kill()
673 await servers[0].run()
675 await servers[0].videos.remove({ id: uuids[1] })
677 const res = await doPodcastRequest()
678 expect(res.headers['x-api-cache-cached']).to.not.exist
683 after(async function () {
684 await servers[0].plugins.uninstall({ npmName: 'peertube-plugin-test-podcast-custom-tags' })
686 await cleanupTests([ ...servers, serverHLSOnly ])