From 7e0c26066a5c59af742ae56bddaff9635debe034 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Thu, 29 Dec 2022 15:31:40 +0100 Subject: External auth can set more user fields videoQuota, videoQuotaDaily, adminFlags --- .../tests/fixtures/peertube-plugin-test-external-auth-one/main.js | 5 ++++- server/tests/plugins/external-auth.ts | 8 +++++++- 2 files changed, 11 insertions(+), 2 deletions(-) (limited to 'server/tests') diff --git a/server/tests/fixtures/peertube-plugin-test-external-auth-one/main.js b/server/tests/fixtures/peertube-plugin-test-external-auth-one/main.js index c65b8d3a8..cdbaf11ac 100644 --- a/server/tests/fixtures/peertube-plugin-test-external-auth-one/main.js +++ b/server/tests/fixtures/peertube-plugin-test-external-auth-one/main.js @@ -33,7 +33,10 @@ async function register ({ username: 'kefka', email: 'kefka@example.com', role: 0, - displayName: 'Kefka Palazzo' + displayName: 'Kefka Palazzo', + adminFlags: 1, + videoQuota: 42000, + videoQuotaDaily: 42100 }) }, hookTokenValidity: (options) => { diff --git a/server/tests/plugins/external-auth.ts b/server/tests/plugins/external-auth.ts index 437777e90..ee78ae5aa 100644 --- a/server/tests/plugins/external-auth.ts +++ b/server/tests/plugins/external-auth.ts @@ -2,7 +2,7 @@ import { expect } from 'chai' import { wait } from '@shared/core-utils' -import { HttpStatusCode, UserRole } from '@shared/models' +import { HttpStatusCode, UserAdminFlag, UserRole } from '@shared/models' import { cleanupTests, createSingleServer, @@ -156,6 +156,9 @@ describe('Test external auth plugins', function () { expect(body.account.displayName).to.equal('cyan') expect(body.email).to.equal('cyan@example.com') expect(body.role.id).to.equal(UserRole.USER) + expect(body.adminFlags).to.equal(UserAdminFlag.NONE) + expect(body.videoQuota).to.equal(5242880) + expect(body.videoQuotaDaily).to.equal(-1) } }) @@ -178,6 +181,9 @@ describe('Test external auth plugins', function () { expect(body.account.displayName).to.equal('Kefka Palazzo') expect(body.email).to.equal('kefka@example.com') expect(body.role.id).to.equal(UserRole.ADMINISTRATOR) + expect(body.adminFlags).to.equal(UserAdminFlag.BYPASS_VIDEO_AUTO_BLACKLIST) + expect(body.videoQuota).to.equal(42000) + expect(body.videoQuotaDaily).to.equal(42100) } }) -- cgit v1.2.3