diff options
author | Chocobozzz <me@florianbigard.com> | 2021-05-03 11:06:19 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-05-03 16:42:15 +0200 |
commit | 1fd61899eaea245a5844e33e21f04b2562f16e5e (patch) | |
tree | 2a1d51b37b12219cade35e189d62686cd0fec105 /server/tests/api/live | |
parent | dfcb6f50a607b6b402b4f8fa3d43792d61c912a5 (diff) | |
download | PeerTube-1fd61899eaea245a5844e33e21f04b2562f16e5e.tar.gz PeerTube-1fd61899eaea245a5844e33e21f04b2562f16e5e.tar.zst PeerTube-1fd61899eaea245a5844e33e21f04b2562f16e5e.zip |
Add ability to filter my videos by live
Diffstat (limited to 'server/tests/api/live')
-rw-r--r-- | server/tests/api/live/live.ts | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/server/tests/api/live/live.ts b/server/tests/api/live/live.ts index d48e2a8ee..57fb58150 100644 --- a/server/tests/api/live/live.ts +++ b/server/tests/api/live/live.ts | |||
@@ -19,10 +19,12 @@ import { | |||
19 | doubleFollow, | 19 | doubleFollow, |
20 | flushAndRunMultipleServers, | 20 | flushAndRunMultipleServers, |
21 | getLive, | 21 | getLive, |
22 | getMyVideosWithFilter, | ||
22 | getPlaylist, | 23 | getPlaylist, |
23 | getVideo, | 24 | getVideo, |
24 | getVideoIdFromUUID, | 25 | getVideoIdFromUUID, |
25 | getVideosList, | 26 | getVideosList, |
27 | getVideosWithFilters, | ||
26 | killallServers, | 28 | killallServers, |
27 | makeRawRequest, | 29 | makeRawRequest, |
28 | removeVideo, | 30 | removeVideo, |
@@ -37,6 +39,7 @@ import { | |||
37 | testImage, | 39 | testImage, |
38 | updateCustomSubConfig, | 40 | updateCustomSubConfig, |
39 | updateLive, | 41 | updateLive, |
42 | uploadVideoAndGetId, | ||
40 | viewVideo, | 43 | viewVideo, |
41 | wait, | 44 | wait, |
42 | waitJobs, | 45 | waitJobs, |
@@ -229,6 +232,68 @@ describe('Test live', function () { | |||
229 | }) | 232 | }) |
230 | }) | 233 | }) |
231 | 234 | ||
235 | describe('Live filters', function () { | ||
236 | let command: any | ||
237 | let liveVideoId: string | ||
238 | let vodVideoId: string | ||
239 | |||
240 | before(async function () { | ||
241 | this.timeout(120000) | ||
242 | |||
243 | vodVideoId = (await uploadVideoAndGetId({ server: servers[0], videoName: 'vod video' })).uuid | ||
244 | |||
245 | const liveOptions = { name: 'live', privacy: VideoPrivacy.PUBLIC, channelId: servers[0].videoChannel.id } | ||
246 | const resLive = await createLive(servers[0].url, servers[0].accessToken, liveOptions) | ||
247 | liveVideoId = resLive.body.video.uuid | ||
248 | |||
249 | command = await sendRTMPStreamInVideo(servers[0].url, servers[0].accessToken, liveVideoId) | ||
250 | await waitUntilLivePublishedOnAllServers(liveVideoId) | ||
251 | await waitJobs(servers) | ||
252 | }) | ||
253 | |||
254 | it('Should only display lives', async function () { | ||
255 | const res = await getVideosWithFilters(servers[0].url, { isLive: true }) | ||
256 | |||
257 | expect(res.body.total).to.equal(1) | ||
258 | expect(res.body.data).to.have.lengthOf(1) | ||
259 | expect(res.body.data[0].name).to.equal('live') | ||
260 | }) | ||
261 | |||
262 | it('Should not display lives', async function () { | ||
263 | const res = await getVideosWithFilters(servers[0].url, { isLive: false }) | ||
264 | |||
265 | expect(res.body.total).to.equal(1) | ||
266 | expect(res.body.data).to.have.lengthOf(1) | ||
267 | expect(res.body.data[0].name).to.equal('vod video') | ||
268 | }) | ||
269 | |||
270 | it('Should display my lives', async function () { | ||
271 | this.timeout(60000) | ||
272 | |||
273 | await stopFfmpeg(command) | ||
274 | await waitJobs(servers) | ||
275 | |||
276 | const res = await getMyVideosWithFilter(servers[0].url, servers[0].accessToken, { isLive: true }) | ||
277 | const videos = res.body.data as Video[] | ||
278 | |||
279 | const result = videos.every(v => v.isLive) | ||
280 | expect(result).to.be.true | ||
281 | }) | ||
282 | |||
283 | it('Should not display my lives', async function () { | ||
284 | const res = await getMyVideosWithFilter(servers[0].url, servers[0].accessToken, { isLive: false }) | ||
285 | const videos = res.body.data as Video[] | ||
286 | |||
287 | const result = videos.every(v => !v.isLive) | ||
288 | expect(result).to.be.true | ||
289 | }) | ||
290 | |||
291 | after(async function () { | ||
292 | await removeVideo(servers[0].url, servers[0].accessToken, vodVideoId) | ||
293 | await removeVideo(servers[0].url, servers[0].accessToken, liveVideoId) | ||
294 | }) | ||
295 | }) | ||
296 | |||
232 | describe('Stream checks', function () { | 297 | describe('Stream checks', function () { |
233 | let liveVideo: LiveVideo & VideoDetails | 298 | let liveVideo: LiveVideo & VideoDetails |
234 | let rtmpUrl: string | 299 | let rtmpUrl: string |