aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/plugins/id-and-pass-auth.ts
diff options
context:
space:
mode:
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 })