fix(core): Stop enforcing max numbers of API keys limit (no-changelog) (#13631)

This commit is contained in:
Ricardo Espinoza
2025-03-03 14:32:50 +01:00
committed by GitHub
parent e633e91f69
commit 1909b74350
12 changed files with 2 additions and 55 deletions

View File

@@ -4,7 +4,6 @@ import { Container } from '@n8n/di';
import type { User } from '@/databases/entities/user';
import { ApiKeyRepository } from '@/databases/repositories/api-key.repository';
import { License } from '@/license';
import { PublicApiKeyService } from '@/services/public-api-key.service';
import { mockInstance } from '@test/mocking';
@@ -14,10 +13,6 @@ import * as testDb from './shared/test-db';
import type { SuperAgentTest } from './shared/types';
import * as utils from './shared/utils/';
const license = mockInstance(License);
license.getApiKeysPerUserLimit.mockImplementation(() => 2);
const testServer = utils.setupTestServer({ endpointGroups: ['apiKeys'] });
let publicApiKeyService: PublicApiKeyService;
@@ -119,17 +114,6 @@ describe('Owner shell', () => {
expect(newApiKey.rawApiKey).toBeDefined();
});
test('POST /api-keys should fail if max number of API keys reached', async () => {
await testServer.authAgentFor(ownerShell).post('/api-keys').send({ label: 'My API Key' });
const secondApiKey = await testServer
.authAgentFor(ownerShell)
.post('/api-keys')
.send({ label: 'My API Key' });
expect(secondApiKey.statusCode).toBe(400);
});
test('GET /api-keys should fetch the api key redacted', async () => {
const expirationDateInTheFuture = Date.now() + 1000;