diff options
author | Chocobozzz <me@florianbigard.com> | 2019-10-25 13:54:32 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2019-10-25 13:54:32 +0200 |
commit | 4ce7eb71ba28a563336c07d10c182ff89461c72b (patch) | |
tree | 9350704adae97d145548d0b2cfdde3bd95b56dd5 /server/tests/plugins | |
parent | 45863288582a788def282ec25d437b1795510315 (diff) | |
download | PeerTube-4ce7eb71ba28a563336c07d10c182ff89461c72b.tar.gz PeerTube-4ce7eb71ba28a563336c07d10c182ff89461c72b.tar.zst PeerTube-4ce7eb71ba28a563336c07d10c182ff89461c72b.zip |
Add plugin hook on registration
Diffstat (limited to 'server/tests/plugins')
-rw-r--r-- | server/tests/plugins/filter-hooks.ts | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/server/tests/plugins/filter-hooks.ts b/server/tests/plugins/filter-hooks.ts index ec0679b04..b2436fb9e 100644 --- a/server/tests/plugins/filter-hooks.ts +++ b/server/tests/plugins/filter-hooks.ts | |||
@@ -28,11 +28,12 @@ import { | |||
28 | getVideoWithToken, | 28 | getVideoWithToken, |
29 | setDefaultVideoChannel, | 29 | setDefaultVideoChannel, |
30 | waitJobs, | 30 | waitJobs, |
31 | doubleFollow | 31 | doubleFollow, getConfig, registerUser |
32 | } from '../../../shared/extra-utils' | 32 | } from '../../../shared/extra-utils' |
33 | import { VideoCommentThreadTree } from '../../../shared/models/videos/video-comment.model' | 33 | import { VideoCommentThreadTree } from '../../../shared/models/videos/video-comment.model' |
34 | import { VideoDetails } from '../../../shared/models/videos' | 34 | import { VideoDetails } from '../../../shared/models/videos' |
35 | import { getYoutubeVideoUrl, importVideo } from '../../../shared/extra-utils/videos/video-imports' | 35 | import { getYoutubeVideoUrl, importVideo } from '../../../shared/extra-utils/videos/video-imports' |
36 | import { ServerConfig } from '@shared/models' | ||
36 | 37 | ||
37 | const expect = chai.expect | 38 | const expect = chai.expect |
38 | 39 | ||
@@ -187,6 +188,24 @@ describe('Test plugin filter hooks', function () { | |||
187 | }) | 188 | }) |
188 | }) | 189 | }) |
189 | 190 | ||
191 | describe('Should run filter:api.user.signup.allowed.result', function () { | ||
192 | |||
193 | it('Should run on config endpoint', async function () { | ||
194 | const res = await getConfig(servers[0].url) | ||
195 | expect((res.body as ServerConfig).signup.allowed).to.be.true | ||
196 | }) | ||
197 | |||
198 | it('Should allow a signup', async function () { | ||
199 | await registerUser(servers[0].url, 'john', 'password') | ||
200 | }) | ||
201 | |||
202 | it('Should not allow a signup', async function () { | ||
203 | const res = await registerUser(servers[0].url, 'jma', 'password', 403) | ||
204 | |||
205 | expect(res.body.error).to.equal('No jma') | ||
206 | }) | ||
207 | }) | ||
208 | |||
190 | after(async function () { | 209 | after(async function () { |
191 | await cleanupTests(servers) | 210 | await cleanupTests(servers) |
192 | }) | 211 | }) |