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/search | |
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/search')
-rw-r--r-- | server/tests/api/search/search-videos.ts | 49 |
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 | ||
3 | import * as chai from 'chai' | ||
4 | import 'mocha' | 3 | import 'mocha' |
4 | import * as chai from 'chai' | ||
5 | import { VideoPrivacy } from '@shared/models' | ||
5 | import { | 6 | import { |
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' |
16 | import { createVideoCaption } from '../../../../shared/extra-utils/videos/video-captions' | 23 | import { 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 | }) |