aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/videos
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api/videos')
-rw-r--r--server/tests/api/videos/video-hls.ts6
-rw-r--r--server/tests/api/videos/video-playlists.ts42
2 files changed, 44 insertions, 4 deletions
diff --git a/server/tests/api/videos/video-hls.ts b/server/tests/api/videos/video-hls.ts
index a1214bad1..3d04758b1 100644
--- a/server/tests/api/videos/video-hls.ts
+++ b/server/tests/api/videos/video-hls.ts
@@ -51,7 +51,7 @@ async function checkHlsPlaylist (servers: ServerInfo[], videoUUID: string) {
51 51
52 { 52 {
53 for (const resolution of resolutions) { 53 for (const resolution of resolutions) {
54 const res2 = await getPlaylist(`http://localhost:9001/static/playlists/hls/${videoUUID}/${resolution}.m3u8`) 54 const res2 = await getPlaylist(`http://localhost:9001/static/streaming-playlists/hls/${videoUUID}/${resolution}.m3u8`)
55 55
56 const subPlaylist = res2.text 56 const subPlaylist = res2.text
57 expect(subPlaylist).to.contain(`${videoUUID}-${resolution}-fragmented.mp4`) 57 expect(subPlaylist).to.contain(`${videoUUID}-${resolution}-fragmented.mp4`)
@@ -59,7 +59,7 @@ async function checkHlsPlaylist (servers: ServerInfo[], videoUUID: string) {
59 } 59 }
60 60
61 { 61 {
62 const baseUrl = 'http://localhost:9001/static/playlists/hls' 62 const baseUrl = 'http://localhost:9001/static/streaming-playlists/hls'
63 63
64 for (const resolution of resolutions) { 64 for (const resolution of resolutions) {
65 await checkSegmentHash(baseUrl, baseUrl, videoUUID, resolution, hlsPlaylist) 65 await checkSegmentHash(baseUrl, baseUrl, videoUUID, resolution, hlsPlaylist)
@@ -118,7 +118,7 @@ describe('Test HLS videos', function () {
118 it('Should have the playlists/segment deleted from the disk', async function () { 118 it('Should have the playlists/segment deleted from the disk', async function () {
119 for (const server of servers) { 119 for (const server of servers) {
120 await checkDirectoryIsEmpty(server, 'videos') 120 await checkDirectoryIsEmpty(server, 'videos')
121 await checkDirectoryIsEmpty(server, join('playlists', 'hls')) 121 await checkDirectoryIsEmpty(server, join('streaming-playlists', 'hls'))
122 } 122 }
123 }) 123 })
124 124
diff --git a/server/tests/api/videos/video-playlists.ts b/server/tests/api/videos/video-playlists.ts
index baa2b3b8c..931491406 100644
--- a/server/tests/api/videos/video-playlists.ts
+++ b/server/tests/api/videos/video-playlists.ts
@@ -10,7 +10,7 @@ import {
10 createVideoPlaylist, 10 createVideoPlaylist,
11 deleteVideoChannel, 11 deleteVideoChannel,
12 deleteVideoPlaylist, 12 deleteVideoPlaylist,
13 doubleFollow, 13 doubleFollow, doVideosExistInMyPlaylist,
14 flushAndRunMultipleServers, 14 flushAndRunMultipleServers,
15 flushTests, 15 flushTests,
16 getAccountPlaylistsList, 16 getAccountPlaylistsList,
@@ -41,6 +41,7 @@ import { VideoPlaylistPrivacy } from '../../../../shared/models/videos/playlist/
41import { VideoPlaylist } from '../../../../shared/models/videos/playlist/video-playlist.model' 41import { VideoPlaylist } from '../../../../shared/models/videos/playlist/video-playlist.model'
42import { Video } from '../../../../shared/models/videos' 42import { Video } from '../../../../shared/models/videos'
43import { VideoPlaylistType } from '../../../../shared/models/videos/playlist/video-playlist-type.model' 43import { VideoPlaylistType } from '../../../../shared/models/videos/playlist/video-playlist-type.model'
44import { VideoExistInPlaylist } from '../../../../shared/models/videos/playlist/video-exist-in-playlist.model'
44 45
45const expect = chai.expect 46const expect = chai.expect
46 47
@@ -624,6 +625,45 @@ describe('Test video playlists', function () {
624 } 625 }
625 }) 626 })
626 627
628 it('Should check videos existence in my playlist', async function () {
629 const videoIds = [
630 servers[0].videos[0].id,
631 42000,
632 servers[0].videos[3].id,
633 43000,
634 servers[0].videos[4].id
635 ]
636 const res = await doVideosExistInMyPlaylist(servers[ 0 ].url, servers[ 0 ].accessToken, videoIds)
637 const obj = res.body as VideoExistInPlaylist
638
639 {
640 const elem = obj[servers[0].videos[0].id]
641 expect(elem).to.have.lengthOf(1)
642 expect(elem[ 0 ].playlistId).to.equal(playlistServer1Id)
643 expect(elem[ 0 ].startTimestamp).to.equal(15)
644 expect(elem[ 0 ].stopTimestamp).to.equal(28)
645 }
646
647 {
648 const elem = obj[servers[0].videos[3].id]
649 expect(elem).to.have.lengthOf(1)
650 expect(elem[ 0 ].playlistId).to.equal(playlistServer1Id)
651 expect(elem[ 0 ].startTimestamp).to.equal(1)
652 expect(elem[ 0 ].stopTimestamp).to.equal(35)
653 }
654
655 {
656 const elem = obj[servers[0].videos[4].id]
657 expect(elem).to.have.lengthOf(1)
658 expect(elem[ 0 ].playlistId).to.equal(playlistServer1Id)
659 expect(elem[ 0 ].startTimestamp).to.equal(45)
660 expect(elem[ 0 ].stopTimestamp).to.equal(null)
661 }
662
663 expect(obj[42000]).to.have.lengthOf(0)
664 expect(obj[43000]).to.have.lengthOf(0)
665 })
666
627 it('Should delete some elements', async function () { 667 it('Should delete some elements', async function () {
628 this.timeout(30000) 668 this.timeout(30000)
629 669