aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/external-plugins/auth-ldap.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-07-13 14:23:01 +0200
committerChocobozzz <me@florianbigard.com>2021-07-20 15:27:18 +0200
commit7926c5f9b3ffcabb1ffb0dcfa5e48b8e0b88fbc0 (patch)
tree7a166515e4d57a06eb3c08be569f106ed049988b /server/tests/external-plugins/auth-ldap.ts
parentd0a0fa429d4651710ed951a3c11af0219e408964 (diff)
downloadPeerTube-7926c5f9b3ffcabb1ffb0dcfa5e48b8e0b88fbc0.tar.gz
PeerTube-7926c5f9b3ffcabb1ffb0dcfa5e48b8e0b88fbc0.tar.zst
PeerTube-7926c5f9b3ffcabb1ffb0dcfa5e48b8e0b88fbc0.zip
Introduce user command
Diffstat (limited to 'server/tests/external-plugins/auth-ldap.ts')
-rw-r--r--server/tests/external-plugins/auth-ldap.ts12
1 files changed, 4 insertions, 8 deletions
diff --git a/server/tests/external-plugins/auth-ldap.ts b/server/tests/external-plugins/auth-ldap.ts
index 8153e2b81..d99b3badc 100644
--- a/server/tests/external-plugins/auth-ldap.ts
+++ b/server/tests/external-plugins/auth-ldap.ts
@@ -3,9 +3,7 @@
3import 'mocha' 3import 'mocha'
4import { expect } from 'chai' 4import { expect } from 'chai'
5import { HttpStatusCode } from '@shared/core-utils' 5import { HttpStatusCode } from '@shared/core-utils'
6import { User } from '@shared/models/users/user.model' 6import { cleanupTests, flushAndRunServer, ServerInfo, setAccessTokensToServers, uploadVideo } from '@shared/extra-utils'
7import { blockUser, getMyUserInformation, setAccessTokensToServers, unblockUser, uploadVideo } from '../../../shared/extra-utils'
8import { cleanupTests, flushAndRunServer, ServerInfo } from '../../../shared/extra-utils/server/servers'
9 7
10describe('Official plugin auth-ldap', function () { 8describe('Official plugin auth-ldap', function () {
11 let server: ServerInfo 9 let server: ServerInfo
@@ -71,9 +69,7 @@ describe('Official plugin auth-ldap', function () {
71 }) 69 })
72 70
73 it('Should login get my profile', async function () { 71 it('Should login get my profile', async function () {
74 const res = await getMyUserInformation(server.url, accessToken) 72 const body = await server.usersCommand.getMyInfo({ token: accessToken })
75 const body: User = res.body
76
77 expect(body.username).to.equal('fry') 73 expect(body.username).to.equal('fry')
78 expect(body.email).to.equal('fry@planetexpress.com') 74 expect(body.email).to.equal('fry@planetexpress.com')
79 75
@@ -85,7 +81,7 @@ describe('Official plugin auth-ldap', function () {
85 }) 81 })
86 82
87 it('Should not be able to login if the user is banned', async function () { 83 it('Should not be able to login if the user is banned', async function () {
88 await blockUser(server.url, userId, server.accessToken) 84 await server.usersCommand.banUser({ userId })
89 85
90 await server.loginCommand.login({ 86 await server.loginCommand.login({
91 user: { username: 'fry@planetexpress.com', password: 'fry' }, 87 user: { username: 'fry@planetexpress.com', password: 'fry' },
@@ -94,7 +90,7 @@ describe('Official plugin auth-ldap', function () {
94 }) 90 })
95 91
96 it('Should be able to login if the user is unbanned', async function () { 92 it('Should be able to login if the user is unbanned', async function () {
97 await unblockUser(server.url, userId, server.accessToken) 93 await server.usersCommand.unbanUser({ userId })
98 94
99 await server.loginCommand.login({ user: { username: 'fry@planetexpress.com', password: 'fry' } }) 95 await server.loginCommand.login({ user: { username: 'fry@planetexpress.com', password: 'fry' } })
100 }) 96 })