1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-04 10:19:35 +02:00

Add ability to unregister plugin auths

This commit is contained in:
Chocobozzz 2020-04-30 10:03:09 +02:00 committed by Chocobozzz
parent e9b0fa5c16
commit a4995eb7ac
7 changed files with 102 additions and 9 deletions

View file

@ -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,