X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Ftests%2Fexternal-plugins%2Fauth-ldap.ts;h=e4eae7e8c047b858154fcb598ada2838913609ed;hb=33c7131be5883d1b25c49adbcf5750b63905a368;hp=4ce8e82cb572a7e214955e18c09ee771bd6e882a;hpb=e01146559acd32e009ad7d399a4af151fa0d4c52;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/tests/external-plugins/auth-ldap.ts b/server/tests/external-plugins/auth-ldap.ts index 4ce8e82cb..e4eae7e8c 100644 --- a/server/tests/external-plugins/auth-ldap.ts +++ b/server/tests/external-plugins/auth-ldap.ts @@ -4,9 +4,11 @@ import 'mocha' import { expect } from 'chai' import { User } from '@shared/models/users/user.model' import { + blockUser, getMyUserInformation, installPlugin, setAccessTokensToServers, + unblockUser, uninstallPlugin, updatePluginSettings, uploadVideo, @@ -17,6 +19,7 @@ import { cleanupTests, flushAndRunServer, ServerInfo } from '../../../shared/ext describe('Official plugin auth-ldap', function () { let server: ServerInfo let accessToken: string + let userId: number before(async function () { this.timeout(30000) @@ -90,12 +93,26 @@ describe('Official plugin auth-ldap', function () { expect(body.username).to.equal('fry') expect(body.email).to.equal('fry@planetexpress.com') + + userId = body.id }) it('Should upload a video', async function () { await uploadVideo(server.url, accessToken, { name: 'my super video' }) }) + it('Should not be able to login if the user is banned', async function () { + await blockUser(server.url, userId, server.accessToken) + + await userLogin(server, { username: 'fry@planetexpress.com', password: 'fry' }, 400) + }) + + it('Should be able to login if the user is unbanned', async function () { + await unblockUser(server.url, userId, server.accessToken) + + await userLogin(server, { username: 'fry@planetexpress.com', password: 'fry' }) + }) + it('Should not login if the plugin is uninstalled', async function () { await uninstallPlugin({ url: server.url, accessToken: server.accessToken, npmName: 'peertube-plugin-auth-ldap' })