chore(core): Use roles from database in global roles (#18768)

This commit is contained in:
Andreas Fitzek
2025-08-26 17:53:46 +02:00
committed by GitHub
parent cff3f4a67e
commit ecad12b77a
117 changed files with 956 additions and 424 deletions

View File

@@ -1,6 +1,11 @@
import { createWorkflow, testDb } from '@n8n/backend-test-utils';
import type { User } from '@n8n/db';
import { ProjectRepository, TestRunRepository } from '@n8n/db';
import {
GLOBAL_MEMBER_ROLE,
GLOBAL_OWNER_ROLE,
ProjectRepository,
TestRunRepository,
} from '@n8n/db';
import { Container } from '@n8n/di';
import { mockInstance } from 'n8n-core/test/utils';
import type { IWorkflowBase } from 'n8n-workflow';
@@ -25,7 +30,7 @@ const testServer = utils.setupTestServer({
});
beforeAll(async () => {
ownerShell = await createUserShell('global:owner');
ownerShell = await createUserShell(GLOBAL_OWNER_ROLE);
authOwnerAgent = testServer.authAgentFor(ownerShell);
});
@@ -113,7 +118,7 @@ describe('GET /workflows/:workflowId/test-runs', () => {
});
test('should retrieve list of test runs for a shared workflow', async () => {
const memberShell = await createUserShell('global:member');
const memberShell = await createUserShell(GLOBAL_MEMBER_ROLE);
const memberAgent = testServer.authAgentFor(memberShell);
const memberPersonalProject = await Container.get(
ProjectRepository,
@@ -171,7 +176,7 @@ describe('GET /workflows/:workflowId/test-runs/:id', () => {
});
test('should retrieve test run of a shared workflow', async () => {
const memberShell = await createUserShell('global:member');
const memberShell = await createUserShell(GLOBAL_MEMBER_ROLE);
const memberAgent = testServer.authAgentFor(memberShell);
const memberPersonalProject = await Container.get(
ProjectRepository,
@@ -345,7 +350,7 @@ describe('GET /workflows/:workflowId/test-runs/:id/test-cases', () => {
});
test('should return test cases for a shared workflow', async () => {
const memberShell = await createUserShell('global:member');
const memberShell = await createUserShell(GLOBAL_MEMBER_ROLE);
const memberAgent = testServer.authAgentFor(memberShell);
const memberPersonalProject = await Container.get(
ProjectRepository,