aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/search
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api/search')
-rw-r--r--server/tests/api/search/search-videos.ts49
1 files changed, 47 insertions, 2 deletions
diff --git a/server/tests/api/search/search-videos.ts b/server/tests/api/search/search-videos.ts
index e05c3a269..5b8907961 100644
--- a/server/tests/api/search/search-videos.ts
+++ b/server/tests/api/search/search-videos.ts
@@ -1,17 +1,24 @@
1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */ 1/* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
2 2
3import * as chai from 'chai'
4import 'mocha' 3import 'mocha'
4import * as chai from 'chai'
5import { VideoPrivacy } from '@shared/models'
5import { 6import {
6 advancedVideosSearch, 7 advancedVideosSearch,
7 cleanupTests, 8 cleanupTests,
9 createLive,
8 flushAndRunServer, 10 flushAndRunServer,
9 immutableAssign, 11 immutableAssign,
10 searchVideo, 12 searchVideo,
13 sendRTMPStreamInVideo,
11 ServerInfo, 14 ServerInfo,
12 setAccessTokensToServers, 15 setAccessTokensToServers,
16 setDefaultVideoChannel,
17 stopFfmpeg,
18 updateCustomSubConfig,
13 uploadVideo, 19 uploadVideo,
14 wait 20 wait,
21 waitUntilLivePublished
15} from '../../../../shared/extra-utils' 22} from '../../../../shared/extra-utils'
16import { createVideoCaption } from '../../../../shared/extra-utils/videos/video-captions' 23import { createVideoCaption } from '../../../../shared/extra-utils/videos/video-captions'
17 24
@@ -28,6 +35,7 @@ describe('Test videos search', function () {
28 server = await flushAndRunServer(1) 35 server = await flushAndRunServer(1)
29 36
30 await setAccessTokensToServers([ server ]) 37 await setAccessTokensToServers([ server ])
38 await setDefaultVideoChannel([ server ])
31 39
32 { 40 {
33 const attributes1 = { 41 const attributes1 = {
@@ -449,6 +457,43 @@ describe('Test videos search', function () {
449 expect(res.body.data[0].name).to.equal('1111 2222 3333 - 3') 457 expect(res.body.data[0].name).to.equal('1111 2222 3333 - 3')
450 }) 458 })
451 459
460 it('Should search by live', async function () {
461 this.timeout(30000)
462
463 {
464 const options = {
465 search: {
466 searchIndex: { enabled: false }
467 },
468 live: { enabled: true }
469 }
470 await updateCustomSubConfig(server.url, server.accessToken, options)
471 }
472
473 {
474 const res = await advancedVideosSearch(server.url, { isLive: true })
475
476 expect(res.body.total).to.equal(0)
477 expect(res.body.data).to.have.lengthOf(0)
478 }
479
480 {
481 const liveOptions = { name: 'live', privacy: VideoPrivacy.PUBLIC, channelId: server.videoChannel.id }
482 const resLive = await createLive(server.url, server.accessToken, liveOptions)
483 const liveVideoId = resLive.body.video.uuid
484
485 const command = await sendRTMPStreamInVideo(server.url, server.accessToken, liveVideoId)
486 await waitUntilLivePublished(server.url, server.accessToken, liveVideoId)
487
488 const res = await advancedVideosSearch(server.url, { isLive: true })
489
490 expect(res.body.total).to.equal(1)
491 expect(res.body.data[0].name).to.equal('live')
492
493 await stopFfmpeg(command)
494 }
495 })
496
452 after(async function () { 497 after(async function () {
453 await cleanupTests([ server ]) 498 await cleanupTests([ server ])
454 }) 499 })