X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftests%2Fplugins%2Fexternal-auth.ts;h=3125615388f099e68a8d5d0940d774d3198775f8;hb=97b65ce58aaacbbfec2291f18fb95a9da9eb5263;hp=a72b2829b5e535d167c268c9af116234842747f9;hpb=9107d791e2eef9a1b24b0499dac8b9dbba8a792f;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tests/plugins/external-auth.ts b/server/tests/plugins/external-auth.ts index a72b2829b..312561538 100644 --- a/server/tests/plugins/external-auth.ts +++ b/server/tests/plugins/external-auth.ts @@ -16,7 +16,9 @@ import { setAccessTokensToServers, uninstallPlugin, updateMyUser, - wait + wait, + userLogin, + updatePluginSettings } from '../../../shared/extra-utils' import { cleanupTests, flushAndRunServer, ServerInfo, waitUntilLog } from '../../../shared/extra-utils/server/servers' @@ -258,6 +260,40 @@ describe('Test external auth plugins', function () { await getMyUserInformation(server.url, kefkaAccessToken, 401) }) + it('Should unregister external-auth-2 and do not login existing Kefka', async function () { + await updatePluginSettings({ + url: server.url, + accessToken: server.accessToken, + npmName: 'peertube-plugin-test-external-auth-one', + settings: { disableKefka: true } + }) + + await userLogin(server, { username: 'kefka', password: 'fake' }, 400) + + await loginExternal({ + server, + npmName: 'test-external-auth-one', + authName: 'external-auth-2', + query: { + username: 'kefka' + }, + username: 'kefka', + statusCodeExpected: 404 + }) + }) + + it('Should have disabled this auth', async function () { + const res = await getConfig(server.url) + + const config: ServerConfig = res.body + + const auths = config.plugin.registeredExternalAuths + expect(auths).to.have.lengthOf(2) + + const auth1 = auths.find(a => a.authName === 'external-auth-2') + expect(auth1).to.not.exist + }) + it('Should uninstall the plugin one and do not login Cyan', async function () { await uninstallPlugin({ url: server.url,