Reuse core-security-service createMockAuthenticatedUser mock (#187426)

Follow up to https://github.com/elastic/kibana/pull/187318

Implement core `createMockAuthenticatedUser` in the security plugin mock
to avoid divergence.

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This commit is contained in:
Christiane (Tina) Heiligers 2024-07-03 10:43:47 -07:00 committed by GitHub
parent 482f2a9503
commit ee80b740fa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 8 additions and 9 deletions

View file

@ -7,12 +7,12 @@
import { of } from 'rxjs';
import { securityServiceMock } from '@kbn/core-security-server-mocks';
import { authenticationMock, authorizationMock } from './authentication/index.mock';
import { navControlServiceMock } from './nav_control/index.mock';
import { getUiApiMock } from './ui_api/index.mock';
import { licenseMock } from '../common/licensing/index.mock';
import type { MockAuthenticatedUserProps } from '../common/model/authenticated_user.mock';
import { mockAuthenticatedUser } from '../common/model/authenticated_user.mock';
function createSetupMock() {
return {
@ -43,6 +43,5 @@ function createStartMock() {
export const securityMock = {
createSetup: createSetupMock,
createStart: createStartMock,
createMockAuthenticatedUser: (props: MockAuthenticatedUserProps = {}) =>
mockAuthenticatedUser(props),
createMockAuthenticatedUser: securityServiceMock.createMockAuthenticatedUser,
};

View file

@ -7,13 +7,13 @@
import type { TransportResult } from '@elastic/elasticsearch';
import { securityServiceMock } from '@kbn/core-security-server-mocks';
import { auditServiceMock } from './audit/mocks';
import { authenticationServiceMock } from './authentication/authentication_service.mock';
import { authorizationMock } from './authorization/index.mock';
import { userProfileServiceMock } from './user_profile/user_profile_service.mock';
import { licenseMock } from '../common/licensing/index.mock';
import { mockAuthenticatedUser } from '../common/model/authenticated_user.mock';
import type { MockAuthenticatedUserProps } from '../common/model/authenticated_user.mock';
function createSetupMock() {
const mockAuthz = authorizationMock.create();
@ -79,6 +79,5 @@ export const securityMock = {
createSetup: createSetupMock,
createStart: createStartMock,
createApiResponse: createApiResponseMock,
createMockAuthenticatedUser: (props: MockAuthenticatedUserProps = {}) =>
mockAuthenticatedUser(props),
createMockAuthenticatedUser: securityServiceMock.createMockAuthenticatedUser,
};

View file

@ -82,7 +82,8 @@
"@kbn/core-user-profile-server",
"@kbn/core-user-profile-browser",
"@kbn/security-api-key-management",
"@kbn/security-form-components"
"@kbn/security-form-components",
"@kbn/core-security-server-mocks",
],
"exclude": [
"target/**/*",