mirror of
https://github.com/n8n-io/n8n.git
synced 2025-02-21 02:56:40 -08:00
test(API): Fix issues with Public API tests (#3515)
This commit is contained in:
parent
189009a8b7
commit
c4b63fa999
|
@ -19,6 +19,8 @@ let credentialOwnerRole: Role;
|
||||||
|
|
||||||
let saveCredential: SaveCredentialFunction;
|
let saveCredential: SaveCredentialFunction;
|
||||||
|
|
||||||
|
jest.mock('../../../src/telemetry');
|
||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
app = await utils.initTestServer({ endpointGroups: ['publicApi'], applyAuth: false });
|
app = await utils.initTestServer({ endpointGroups: ['publicApi'], applyAuth: false });
|
||||||
const initResult = await testDb.init();
|
const initResult = await testDb.init();
|
||||||
|
|
|
@ -8,6 +8,8 @@ import { randomApiKey } from '../shared/random';
|
||||||
import * as utils from '../shared/utils';
|
import * as utils from '../shared/utils';
|
||||||
import * as testDb from '../shared/testDb';
|
import * as testDb from '../shared/testDb';
|
||||||
|
|
||||||
|
jest.mock('../../../src/telemetry');
|
||||||
|
|
||||||
let app: express.Application;
|
let app: express.Application;
|
||||||
let testDbName = '';
|
let testDbName = '';
|
||||||
let globalOwnerRole: Role;
|
let globalOwnerRole: Role;
|
||||||
|
|
|
@ -16,6 +16,8 @@ let globalMemberRole: Role;
|
||||||
let workflowOwnerRole: Role;
|
let workflowOwnerRole: Role;
|
||||||
let workflowRunner: ActiveWorkflowRunner.ActiveWorkflowRunner;
|
let workflowRunner: ActiveWorkflowRunner.ActiveWorkflowRunner;
|
||||||
|
|
||||||
|
jest.mock('../../../src/telemetry');
|
||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
app = await utils.initTestServer({ endpointGroups: ['publicApi'], applyAuth: false });
|
app = await utils.initTestServer({ endpointGroups: ['publicApi'], applyAuth: false });
|
||||||
const initResult = await testDb.init();
|
const initResult = await testDb.init();
|
||||||
|
@ -34,6 +36,7 @@ beforeAll(async () => {
|
||||||
utils.initTestTelemetry();
|
utils.initTestTelemetry();
|
||||||
utils.initTestLogger();
|
utils.initTestLogger();
|
||||||
await utils.initNodeTypes();
|
await utils.initNodeTypes();
|
||||||
|
await utils.initConfigFile();
|
||||||
workflowRunner = await utils.initActiveWorkflowRunner();
|
workflowRunner = await utils.initActiveWorkflowRunner();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -648,7 +651,7 @@ test('POST /workflows/:id/activate should fail due to trying to activate a workf
|
||||||
expect(response.statusCode).toBe(400);
|
expect(response.statusCode).toBe(400);
|
||||||
});
|
});
|
||||||
|
|
||||||
test.skip('POST /workflows/:id/activate should set workflow as active', async () => {
|
test('POST /workflows/:id/activate should set workflow as active', async () => {
|
||||||
const member = await testDb.createUser({ globalRole: globalMemberRole, apiKey: randomApiKey() });
|
const member = await testDb.createUser({ globalRole: globalMemberRole, apiKey: randomApiKey() });
|
||||||
|
|
||||||
const authAgent = utils.createAgent(app, {
|
const authAgent = utils.createAgent(app, {
|
||||||
|
@ -692,7 +695,7 @@ test.skip('POST /workflows/:id/activate should set workflow as active', async ()
|
||||||
expect(await workflowRunner.isActive(workflow.id.toString())).toBe(true);
|
expect(await workflowRunner.isActive(workflow.id.toString())).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
test.skip('POST /workflows/:id/activate should set non-owned workflow as active when owner', async () => {
|
test('POST /workflows/:id/activate should set non-owned workflow as active when owner', async () => {
|
||||||
const owner = await testDb.createUser({ globalRole: globalOwnerRole, apiKey: randomApiKey() });
|
const owner = await testDb.createUser({ globalRole: globalOwnerRole, apiKey: randomApiKey() });
|
||||||
const member = await testDb.createUser({ globalRole: globalMemberRole });
|
const member = await testDb.createUser({ globalRole: globalMemberRole });
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue