]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/api/search/search-videos.ts
Introduce live command
[github/Chocobozzz/PeerTube.git] / server / tests / api / search / search-videos.ts
index 7dc89c447046eeb9209b73b32f3976087e101968..af74b26a7ebd1d57738c83c7a083a815ad5abfa3 100644 (file)
@@ -2,23 +2,20 @@
 
 import 'mocha'
 import * as chai from 'chai'
-import { VideoPrivacy } from '@shared/models'
 import {
   cleanupTests,
-  createLive,
+  createVideoCaption,
   flushAndRunServer,
   immutableAssign,
   SearchCommand,
-  sendRTMPStreamInVideo,
   ServerInfo,
   setAccessTokensToServers,
   setDefaultVideoChannel,
   stopFfmpeg,
   uploadVideo,
-  wait,
-  waitUntilLivePublished
-} from '../../../../shared/extra-utils'
-import { createVideoCaption } from '../../../../shared/extra-utils/videos/video-captions'
+  wait
+} from '@shared/extra-utils'
+import { VideoPrivacy } from '@shared/models'
 
 const expect = chai.expect
 
@@ -502,12 +499,13 @@ describe('Test videos search', function () {
     }
 
     {
-      const liveOptions = { name: 'live', privacy: VideoPrivacy.PUBLIC, channelId: server.videoChannel.id }
-      const resLive = await createLive(server.url, server.accessToken, liveOptions)
-      const liveVideoId = resLive.body.video.uuid
+      const liveCommand = server.liveCommand
+
+      const liveAttributes = { name: 'live', privacy: VideoPrivacy.PUBLIC, channelId: server.videoChannel.id }
+      const live = await liveCommand.createLive({ fields: liveAttributes })
 
-      const ffmpegCommand = await sendRTMPStreamInVideo(server.url, server.accessToken, liveVideoId)
-      await waitUntilLivePublished(server.url, server.accessToken, liveVideoId)
+      const ffmpegCommand = await liveCommand.sendRTMPStreamInVideo({ videoId: live.id })
+      await liveCommand.waitUntilLivePublished({ videoId: live.id })
 
       const body = await command.advancedVideoSearch({ search: { isLive: true } })