aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/plugins/external-auth.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-12-30 10:12:20 +0100
committerChocobozzz <me@florianbigard.com>2023-01-04 11:41:29 +0100
commit60b880acdfa85eab5c9ec09ba1283f82ae58ec85 (patch)
tree3c89db53ea9a00e61121d76672bd931eb6d1a84a /server/tests/plugins/external-auth.ts
parent7e0c26066a5c59af742ae56bddaff9635debe034 (diff)
downloadPeerTube-60b880acdfa85eab5c9ec09ba1283f82ae58ec85.tar.gz
PeerTube-60b880acdfa85eab5c9ec09ba1283f82ae58ec85.tar.zst
PeerTube-60b880acdfa85eab5c9ec09ba1283f82ae58ec85.zip
External auth can update user on login
Diffstat (limited to 'server/tests/plugins/external-auth.ts')
-rw-r--r--server/tests/plugins/external-auth.ts34
1 files changed, 34 insertions, 0 deletions
diff --git a/server/tests/plugins/external-auth.ts b/server/tests/plugins/external-auth.ts
index ee78ae5aa..e600f958f 100644
--- a/server/tests/plugins/external-auth.ts
+++ b/server/tests/plugins/external-auth.ts
@@ -51,6 +51,7 @@ describe('Test external auth plugins', function () {
51 51
52 let kefkaAccessToken: string 52 let kefkaAccessToken: string
53 let kefkaRefreshToken: string 53 let kefkaRefreshToken: string
54 let kefkaId: number
54 55
55 let externalAuthToken: string 56 let externalAuthToken: string
56 57
@@ -184,6 +185,8 @@ describe('Test external auth plugins', function () {
184 expect(body.adminFlags).to.equal(UserAdminFlag.BYPASS_VIDEO_AUTO_BLACKLIST) 185 expect(body.adminFlags).to.equal(UserAdminFlag.BYPASS_VIDEO_AUTO_BLACKLIST)
185 expect(body.videoQuota).to.equal(42000) 186 expect(body.videoQuota).to.equal(42000)
186 expect(body.videoQuotaDaily).to.equal(42100) 187 expect(body.videoQuotaDaily).to.equal(42100)
188
189 kefkaId = body.id
187 } 190 }
188 }) 191 })
189 192
@@ -246,6 +249,37 @@ describe('Test external auth plugins', function () {
246 expect(body.role.id).to.equal(UserRole.USER) 249 expect(body.role.id).to.equal(UserRole.USER)
247 }) 250 })
248 251
252 it('Should login Kefka and update the profile', async function () {
253 {
254 await server.users.update({ userId: kefkaId, videoQuota: 43000, videoQuotaDaily: 43100 })
255 await server.users.updateMe({ token: kefkaAccessToken, displayName: 'kefka updated' })
256
257 const body = await server.users.getMyInfo({ token: kefkaAccessToken })
258 expect(body.username).to.equal('kefka')
259 expect(body.account.displayName).to.equal('kefka updated')
260 expect(body.videoQuota).to.equal(43000)
261 expect(body.videoQuotaDaily).to.equal(43100)
262 }
263
264 {
265 const res = await loginExternal({
266 server,
267 npmName: 'test-external-auth-one',
268 authName: 'external-auth-2',
269 username: 'kefka'
270 })
271
272 kefkaAccessToken = res.access_token
273 kefkaRefreshToken = res.refresh_token
274
275 const body = await server.users.getMyInfo({ token: kefkaAccessToken })
276 expect(body.username).to.equal('kefka')
277 expect(body.account.displayName).to.equal('Kefka Palazzo')
278 expect(body.videoQuota).to.equal(42000)
279 expect(body.videoQuotaDaily).to.equal(43100)
280 }
281 })
282
249 it('Should not update an external auth email', async function () { 283 it('Should not update an external auth email', async function () {
250 await server.users.updateMe({ 284 await server.users.updateMe({
251 token: cyanAccessToken, 285 token: cyanAccessToken,