aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/plugins/id-and-pass-auth.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-04-29 09:04:42 +0200
committerChocobozzz <chocobozzz@cpy.re>2020-05-04 16:21:39 +0200
commit9107d791e2eef9a1b24b0499dac8b9dbba8a792f (patch)
treef09b20f06008b094f3266b39063bc9785dfebf5f /server/tests/plugins/id-and-pass-auth.ts
parent4a8d113b9b57d97ff13ad1608798eabca99643e4 (diff)
downloadPeerTube-9107d791e2eef9a1b24b0499dac8b9dbba8a792f.tar.gz
PeerTube-9107d791e2eef9a1b24b0499dac8b9dbba8a792f.tar.zst
PeerTube-9107d791e2eef9a1b24b0499dac8b9dbba8a792f.zip
Add external login tests
Diffstat (limited to 'server/tests/plugins/id-and-pass-auth.ts')
-rw-r--r--server/tests/plugins/id-and-pass-auth.ts30
1 files changed, 28 insertions, 2 deletions
diff --git a/server/tests/plugins/id-and-pass-auth.ts b/server/tests/plugins/id-and-pass-auth.ts
index c6382435d..6c10730aa 100644
--- a/server/tests/plugins/id-and-pass-auth.ts
+++ b/server/tests/plugins/id-and-pass-auth.ts
@@ -12,9 +12,9 @@ import {
12 updateMyUser, 12 updateMyUser,
13 userLogin, 13 userLogin,
14 wait, 14 wait,
15 login, refreshToken 15 login, refreshToken, getConfig
16} from '../../../shared/extra-utils' 16} from '../../../shared/extra-utils'
17import { User, UserRole } from '@shared/models' 17import { User, UserRole, ServerConfig } from '@shared/models'
18import { expect } from 'chai' 18import { expect } from 'chai'
19 19
20describe('Test id and pass auth plugins', function () { 20describe('Test id and pass auth plugins', function () {
@@ -41,6 +41,20 @@ describe('Test id and pass auth plugins', function () {
41 } 41 }
42 }) 42 })
43 43
44 it('Should display the correct configuration', async function () {
45 const res = await getConfig(server.url)
46
47 const config: ServerConfig = res.body
48
49 const auths = config.plugin.registeredIdAndPassAuths
50 expect(auths).to.have.lengthOf(8)
51
52 const crashAuth = auths.find(a => a.authName === 'crash-auth')
53 expect(crashAuth).to.exist
54 expect(crashAuth.npmName).to.equal('peertube-plugin-test-id-pass-auth-one')
55 expect(crashAuth.weight).to.equal(50)
56 })
57
44 it('Should not login', async function () { 58 it('Should not login', async function () {
45 await userLogin(server, { username: 'toto', password: 'password' }, 400) 59 await userLogin(server, { username: 'toto', password: 'password' }, 400)
46 }) 60 })
@@ -175,6 +189,18 @@ describe('Test id and pass auth plugins', function () {
175 await userLogin(server, { username: 'crash', password: 'crash password' }, 400) 189 await userLogin(server, { username: 'crash', password: 'crash password' }, 400)
176 }) 190 })
177 191
192 it('Should display the correct configuration', async function () {
193 const res = await getConfig(server.url)
194
195 const config: ServerConfig = res.body
196
197 const auths = config.plugin.registeredIdAndPassAuths
198 expect(auths).to.have.lengthOf(6)
199
200 const crashAuth = auths.find(a => a.authName === 'crash-auth')
201 expect(crashAuth).to.not.exist
202 })
203
178 after(async function () { 204 after(async function () {
179 await cleanupTests([ server ]) 205 await cleanupTests([ server ])
180 }) 206 })