mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-21 11:49:59 +00:00
feat: Add custom data to public API execution endpoints (#9705)
This commit is contained in:
@@ -12,6 +12,7 @@ import {
|
||||
} from '../shared/db/workflows';
|
||||
import {
|
||||
createErrorExecution,
|
||||
createExecution,
|
||||
createManyExecutions,
|
||||
createSuccessfulExecution,
|
||||
createWaitingExecution,
|
||||
@@ -125,6 +126,49 @@ describe('GET /executions/:id', () => {
|
||||
expect(response.statusCode).toBe(200);
|
||||
});
|
||||
|
||||
test('member should not be able to fetch custom data when includeData is not set', async () => {
|
||||
const workflow = await createWorkflow({}, user1);
|
||||
const execution = await createExecution(
|
||||
{
|
||||
finished: true,
|
||||
status: 'success',
|
||||
metadata: [
|
||||
{ key: 'test1', value: 'value1' },
|
||||
{ key: 'test2', value: 'value2' },
|
||||
],
|
||||
},
|
||||
workflow,
|
||||
);
|
||||
|
||||
const response = await authUser1Agent.get(`/executions/${execution.id}`);
|
||||
|
||||
expect(response.statusCode).toBe(200);
|
||||
expect(response.body.customData).toBeUndefined();
|
||||
});
|
||||
|
||||
test('member should be able to fetch custom data when includeData=true', async () => {
|
||||
const workflow = await createWorkflow({}, user1);
|
||||
const execution = await createExecution(
|
||||
{
|
||||
finished: true,
|
||||
status: 'success',
|
||||
metadata: [
|
||||
{ key: 'test1', value: 'value1' },
|
||||
{ key: 'test2', value: 'value2' },
|
||||
],
|
||||
},
|
||||
workflow,
|
||||
);
|
||||
|
||||
const response = await authUser1Agent.get(`/executions/${execution.id}?includeData=true`);
|
||||
|
||||
expect(response.statusCode).toBe(200);
|
||||
expect(response.body.customData).toEqual({
|
||||
test1: 'value1',
|
||||
test2: 'value2',
|
||||
});
|
||||
});
|
||||
|
||||
test('member should not get an execution of another user without the workflow being shared', async () => {
|
||||
const workflow = await createWorkflow({}, owner);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user