]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/plugins/filter-hooks.ts
Add ability to enabled HLS in the admin panel
[github/Chocobozzz/PeerTube.git] / server / tests / plugins / filter-hooks.ts
index ec0679b04f3d1d8f607ea89610d4fa7f85e6e659..b2436fb9e47c5cc321aaed62379e16942dd31dc4 100644 (file)
@@ -28,11 +28,12 @@ import {
   getVideoWithToken,
   setDefaultVideoChannel,
   waitJobs,
-  doubleFollow
+  doubleFollow, getConfig, registerUser
 } from '../../../shared/extra-utils'
 import { VideoCommentThreadTree } from '../../../shared/models/videos/video-comment.model'
 import { VideoDetails } from '../../../shared/models/videos'
 import { getYoutubeVideoUrl, importVideo } from '../../../shared/extra-utils/videos/video-imports'
+import { ServerConfig } from '@shared/models'
 
 const expect = chai.expect
 
@@ -187,6 +188,24 @@ describe('Test plugin filter hooks', function () {
     })
   })
 
+  describe('Should run filter:api.user.signup.allowed.result', function () {
+
+    it('Should run on config endpoint', async function () {
+      const res = await getConfig(servers[0].url)
+      expect((res.body as ServerConfig).signup.allowed).to.be.true
+    })
+
+    it('Should allow a signup', async function () {
+      await registerUser(servers[0].url, 'john', 'password')
+    })
+
+    it('Should not allow a signup', async function () {
+      const res = await registerUser(servers[0].url, 'jma', 'password', 403)
+
+      expect(res.body.error).to.equal('No jma')
+    })
+  })
+
   after(async function () {
     await cleanupTests(servers)
   })