mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 01:56:46 +00:00
feat(core): Improve ldap/saml toggle and tests (#5771)
* improve ldap/saml toggle and tests * import cleanup * reject regular login users when saml is enabled * lint fix
This commit is contained in:
committed by
GitHub
parent
30aeeb70b4
commit
47ee357059
@@ -16,6 +16,7 @@ import { randomEmail, randomName, uniqueId } from './../shared/random';
|
||||
import * as testDb from './../shared/testDb';
|
||||
import type { AuthAgent } from '../shared/types';
|
||||
import * as utils from '../shared/utils';
|
||||
import { getCurrentAuthenticationMethod, setCurrentAuthenticationMethod } from '@/sso/ssoHelpers';
|
||||
|
||||
jest.mock('@/telemetry');
|
||||
jest.mock('@/UserManagement/email/NodeMailer');
|
||||
@@ -55,6 +56,8 @@ beforeAll(async () => {
|
||||
);
|
||||
|
||||
utils.initConfigFile();
|
||||
|
||||
await setCurrentAuthenticationMethod('email');
|
||||
});
|
||||
|
||||
beforeEach(async () => {
|
||||
@@ -174,6 +177,7 @@ describe('PUT /ldap/config', () => {
|
||||
const emailUser = await Db.collections.User.findOneByOrFail({ id: member.id });
|
||||
const localLdapIdentities = await testDb.getLdapIdentities();
|
||||
|
||||
expect(getCurrentAuthenticationMethod()).toBe('email');
|
||||
expect(emailUser.email).toBe(member.email);
|
||||
expect(emailUser.lastName).toBe(member.lastName);
|
||||
expect(emailUser.firstName).toBe(member.firstName);
|
||||
@@ -190,6 +194,7 @@ test('GET /ldap/config route should retrieve current configuration', async () =>
|
||||
|
||||
let response = await authAgent(owner).put('/ldap/config').send(validPayload);
|
||||
expect(response.statusCode).toBe(200);
|
||||
expect(getCurrentAuthenticationMethod()).toBe('ldap');
|
||||
|
||||
response = await authAgent(owner).get('/ldap/config');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user