]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/api/check-params/live.ts
Add ability to disable http duration OTEL metrics
[github/Chocobozzz/PeerTube.git] / server / tests / api / check-params / live.ts
index 29f847e51e1a0113b8f4f844aaac33401b1ddc7f..2eff9414b362ebade7733d1f5fcf55cccb3ff764 100644 (file)
@@ -1,9 +1,7 @@
 /* eslint-disable @typescript-eslint/no-unused-expressions,@typescript-eslint/require-await */
 
-import 'mocha'
 import { expect } from 'chai'
-import { omit } from 'lodash'
-import { buildAbsoluteFixturePath } from '@shared/core-utils'
+import { buildAbsoluteFixturePath, omit } from '@shared/core-utils'
 import { HttpStatusCode, LiveVideoLatencyMode, VideoCreateResult, VideoPrivacy } from '@shared/models'
 import {
   cleanupTests,
@@ -51,7 +49,7 @@ describe('Test video lives API validator', function () {
 
     const username = 'user1'
     const password = 'my super password'
-    await server.users.create({ username: username, password: password })
+    await server.users.create({ username, password })
     userAccessToken = await server.login.getAccessToken({ username, password })
 
     {
@@ -132,7 +130,7 @@ describe('Test video lives API validator', function () {
     })
 
     it('Should fail without a channel', async function () {
-      const fields = omit(baseCorrectParams, 'channelId')
+      const fields = omit(baseCorrectParams, [ 'channelId' ])
 
       await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields })
     })
@@ -504,6 +502,23 @@ describe('Test video lives API validator', function () {
       await stopFfmpeg(ffmpegCommand)
     })
 
+    it('Should fail to change live privacy if it has already started', async function () {
+      this.timeout(40000)
+
+      const live = await command.get({ videoId: video.id })
+
+      const ffmpegCommand = sendRTMPStream({ rtmpBaseUrl: live.rtmpUrl, streamKey: live.streamKey })
+
+      await command.waitUntilPublished({ videoId: video.id })
+      await server.videos.update({
+        id: video.id,
+        attributes: { privacy: VideoPrivacy.PUBLIC },
+        expectedStatus: HttpStatusCode.BAD_REQUEST_400
+      })
+
+      await stopFfmpeg(ffmpegCommand)
+    })
+
     it('Should fail to stream twice in the save live', async function () {
       this.timeout(40000)