aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/plugins/external-auth.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/plugins/external-auth.ts')
-rw-r--r--server/tests/plugins/external-auth.ts38
1 files changed, 37 insertions, 1 deletions
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 {
16 setAccessTokensToServers, 16 setAccessTokensToServers,
17 uninstallPlugin, 17 uninstallPlugin,
18 updateMyUser, 18 updateMyUser,
19 wait 19 wait,
20 userLogin,
21 updatePluginSettings
20} from '../../../shared/extra-utils' 22} from '../../../shared/extra-utils'
21import { cleanupTests, flushAndRunServer, ServerInfo, waitUntilLog } from '../../../shared/extra-utils/server/servers' 23import { cleanupTests, flushAndRunServer, ServerInfo, waitUntilLog } from '../../../shared/extra-utils/server/servers'
22 24
@@ -258,6 +260,40 @@ describe('Test external auth plugins', function () {
258 await getMyUserInformation(server.url, kefkaAccessToken, 401) 260 await getMyUserInformation(server.url, kefkaAccessToken, 401)
259 }) 261 })
260 262
263 it('Should unregister external-auth-2 and do not login existing Kefka', async function () {
264 await updatePluginSettings({
265 url: server.url,
266 accessToken: server.accessToken,
267 npmName: 'peertube-plugin-test-external-auth-one',
268 settings: { disableKefka: true }
269 })
270
271 await userLogin(server, { username: 'kefka', password: 'fake' }, 400)
272
273 await loginExternal({
274 server,
275 npmName: 'test-external-auth-one',
276 authName: 'external-auth-2',
277 query: {
278 username: 'kefka'
279 },
280 username: 'kefka',
281 statusCodeExpected: 404
282 })
283 })
284
285 it('Should have disabled this auth', async function () {
286 const res = await getConfig(server.url)
287
288 const config: ServerConfig = res.body
289
290 const auths = config.plugin.registeredExternalAuths
291 expect(auths).to.have.lengthOf(2)
292
293 const auth1 = auths.find(a => a.authName === 'external-auth-2')
294 expect(auth1).to.not.exist
295 })
296
261 it('Should uninstall the plugin one and do not login Cyan', async function () { 297 it('Should uninstall the plugin one and do not login Cyan', async function () {
262 await uninstallPlugin({ 298 await uninstallPlugin({
263 url: server.url, 299 url: server.url,