From eca005d6f0f492ccf293012a17fa832a1ddf0221 Mon Sep 17 00:00:00 2001 From: Christos Nasikas Date: Sat, 8 Jul 2023 21:13:26 +0300 Subject: [PATCH] Fix tests --- .../actions/server/actions_client.test.ts | 76 ------------------- 1 file changed, 76 deletions(-) diff --git a/x-pack/plugins/actions/server/actions_client.test.ts b/x-pack/plugins/actions/server/actions_client.test.ts index d4d7c079269e2..bdba86efd47a9 100644 --- a/x-pack/plugins/actions/server/actions_client.test.ts +++ b/x-pack/plugins/actions/server/actions_client.test.ts @@ -928,40 +928,6 @@ describe('get()', () => { expect(authorization.ensureAuthorized).toHaveBeenCalledWith({ operation: 'get' }); }); - test('ensures user is authorised to get a system action', async () => { - actionsClient = new ActionsClient({ - logger, - actionTypeRegistry, - unsecuredSavedObjectsClient, - scopedClusterClient, - kibanaIndices, - actionExecutor, - executionEnqueuer, - ephemeralExecutionEnqueuer, - bulkExecutionEnqueuer, - request, - authorization: authorization as unknown as ActionsAuthorization, - inMemoryConnectors: [ - { - actionTypeId: '.cases', - config: {}, - id: 'system-connector-.cases', - name: 'System action: .cases', - secrets: {}, - isPreconfigured: false, - isDeprecated: false, - isSystemAction: true, - }, - ], - connectorTokenClient: connectorTokenClientMock.create(), - getEventLogClient, - }); - - await actionsClient.get({ id: 'system-connector-.cases' }); - - expect(authorization.ensureAuthorized).toHaveBeenCalledWith('get'); - }); - test('throws when user is not authorised to get the type of action', async () => { unsecuredSavedObjectsClient.get.mockResolvedValueOnce({ id: '1', @@ -1071,48 +1037,6 @@ describe('get()', () => { expect(authorization.ensureAuthorized).toHaveBeenCalledWith({ operation: 'get' }); }); - - test('throws when user is not authorised to get a system action', async () => { - actionsClient = new ActionsClient({ - logger, - actionTypeRegistry, - unsecuredSavedObjectsClient, - scopedClusterClient, - kibanaIndices, - actionExecutor, - executionEnqueuer, - ephemeralExecutionEnqueuer, - bulkExecutionEnqueuer, - request, - authorization: authorization as unknown as ActionsAuthorization, - inMemoryConnectors: [ - { - actionTypeId: '.cases', - config: {}, - id: 'system-connector-.cases', - name: 'System action: .cases', - secrets: {}, - isPreconfigured: false, - isDeprecated: false, - isSystemAction: true, - }, - ], - connectorTokenClient: connectorTokenClientMock.create(), - getEventLogClient, - }); - - authorization.ensureAuthorized.mockRejectedValue( - new Error(`Unauthorized to get a "system-connector-.cases" action`) - ); - - await expect( - actionsClient.get({ id: 'system-connector-.cases' }) - ).rejects.toMatchInlineSnapshot( - `[Error: Unauthorized to get a "system-connector-.cases" action]` - ); - - expect(authorization.ensureAuthorized).toHaveBeenCalledWith('get'); - }); }); describe('auditLogger', () => {