Skip to content
/ qp-n8n Public
forked from n8n-io/n8n

Commit

Permalink
ci: Fix saml.api.test.ts (no-changelog) (n8n-io#5764)
Browse files Browse the repository at this point in the history
  • Loading branch information
netroy authored and sunilrr committed Apr 24, 2023
1 parent 70518ca commit ba6e920
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
1 change: 1 addition & 0 deletions packages/cli/src/sso/ssoHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,6 @@ export async function setCurrentAuthenticationMethod(
await Db.collections.Settings.save({
key: 'userManagement.authenticationMethod',
value: authenticationMethod,
loadOnStartup: true,
});
}
15 changes: 5 additions & 10 deletions packages/cli/test/integration/saml/saml.api.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@ import * as utils from '../shared/utils';
let owner: User;
let authOwnerAgent: SuperAgentTest;

function enableSaml(enable: boolean) {
setSamlLoginEnabled(enable);
setCurrentAuthenticationMethod(enable ? 'saml' : 'email');
async function enableSaml(enable: boolean) {
await setSamlLoginEnabled(enable);
config.set('enterprise.features.saml', enable);
}

Expand All @@ -22,18 +21,14 @@ beforeAll(async () => {
authOwnerAgent = utils.createAuthAgent(app)(owner);
});

// beforeEach(async () => {
// await testDb.truncate(['User']);
// });

afterAll(async () => {
await testDb.terminate();
});

describe('Instance owner', () => {
describe('PATCH /me', () => {
test('should succeed with valid inputs', async () => {
enableSaml(false);
await enableSaml(false);
await authOwnerAgent
.patch('/me')
.send({
Expand All @@ -46,7 +41,7 @@ describe('Instance owner', () => {
});

test('should throw BadRequestError if email is changed when SAML is enabled', async () => {
enableSaml(true);
await enableSaml(true);
await authOwnerAgent
.patch('/me')
.send({
Expand All @@ -60,7 +55,7 @@ describe('Instance owner', () => {

describe('PATCH /password', () => {
test('should throw BadRequestError if password is changed when SAML is enabled', async () => {
enableSaml(true);
await enableSaml(true);
await authOwnerAgent
.patch('/me/password')
.send({
Expand Down

0 comments on commit ba6e920

Please sign in to comment.