Skip to content

Commit

Permalink
update test per removal of error catching in the route handler
Browse files Browse the repository at this point in the history
  • Loading branch information
tsullivan committed Dec 21, 2023
1 parent d15c932 commit c6461cf
Showing 1 changed file with 0 additions and 17 deletions.
17 changes: 0 additions & 17 deletions x-pack/plugins/security/server/routes/api_keys/has_active.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import Boom from '@hapi/boom';

import { kibanaResponseFactory } from '@kbn/core/server';
import type { RequestHandler } from '@kbn/core/server';
Expand Down Expand Up @@ -111,20 +110,4 @@ describe('Has API Keys route', () => {
"API keys are disabled in Elasticsearch. To use API keys enable 'xpack.security.authc.api_key.enabled' setting.",
});
});

it('should forward error from Elasticsearch GET API keys endpoint', async () => {
const error = Boom.forbidden('test not acceptable message');
esClientMock.asCurrentUser.security.getApiKey.mockResponseImplementation(() => {
throw error;
});

const response = await routeHandler(
mockContext,
httpServerMock.createKibanaRequest(),
kibanaResponseFactory
);

expect(response.status).toBe(403);
expect(response.payload).toEqual(error);
});
});

0 comments on commit c6461cf

Please sign in to comment.