From 9107d791e2eef9a1b24b0499dac8b9dbba8a792f Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 29 Apr 2020 09:04:42 +0200 Subject: Add external login tests --- server/tests/plugins/id-and-pass-auth.ts | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) (limited to 'server/tests/plugins/id-and-pass-auth.ts') 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 { updateMyUser, userLogin, wait, - login, refreshToken + login, refreshToken, getConfig } from '../../../shared/extra-utils' -import { User, UserRole } from '@shared/models' +import { User, UserRole, ServerConfig } from '@shared/models' import { expect } from 'chai' describe('Test id and pass auth plugins', function () { @@ -41,6 +41,20 @@ describe('Test id and pass auth plugins', function () { } }) + it('Should display the correct configuration', async function () { + const res = await getConfig(server.url) + + const config: ServerConfig = res.body + + const auths = config.plugin.registeredIdAndPassAuths + expect(auths).to.have.lengthOf(8) + + const crashAuth = auths.find(a => a.authName === 'crash-auth') + expect(crashAuth).to.exist + expect(crashAuth.npmName).to.equal('peertube-plugin-test-id-pass-auth-one') + expect(crashAuth.weight).to.equal(50) + }) + it('Should not login', async function () { await userLogin(server, { username: 'toto', password: 'password' }, 400) }) @@ -175,6 +189,18 @@ describe('Test id and pass auth plugins', function () { await userLogin(server, { username: 'crash', password: 'crash password' }, 400) }) + it('Should display the correct configuration', async function () { + const res = await getConfig(server.url) + + const config: ServerConfig = res.body + + const auths = config.plugin.registeredIdAndPassAuths + expect(auths).to.have.lengthOf(6) + + const crashAuth = auths.find(a => a.authName === 'crash-auth') + expect(crashAuth).to.not.exist + }) + after(async function () { await cleanupTests([ server ]) }) -- cgit v1.2.3