Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dhurley14 committed Sep 30, 2020
1 parent 828e8a0 commit c94b7a0
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ jest.mock('../../../../common/lib/kibana', () => ({
services: {
application: {
getUrlForApp: jest.fn(),
capabilities: {
siem: {
crud: true,
},
},
},
triggers_actions_ui: {
actionTypeRegistry: jest.fn(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ describe('usePrivilegeUser', () => {
hasIndexWrite: null,
isAuthenticated: null,
loading: true,
canReadActions: null,
});
});
});
Expand All @@ -40,6 +41,7 @@ describe('usePrivilegeUser', () => {
hasIndexWrite: true,
isAuthenticated: true,
loading: false,
canReadActions: true,
});
});
});
Expand All @@ -61,6 +63,7 @@ describe('usePrivilegeUser', () => {
hasIndexWrite: false,
isAuthenticated: false,
loading: false,
canReadActions: false,
});
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ describe('read_privileges route', () => {

mockSecurity = securityMock.createSetup();
mockSecurity.authc.isAuthenticated.mockReturnValue(false);
mockSecurity.authz.checkPrivilegesDynamicallyWithRequest.mockImplementation(() => () => ({
hasAllRequested: true,
}));
clients.clusterClient.callAsCurrentUser.mockResolvedValue(getMockPrivilegesResult());
readPrivilegesRoute(server.router, mockSecurity, false);
});
Expand All @@ -36,6 +39,7 @@ describe('read_privileges route', () => {
...getMockPrivilegesResult(),
is_authenticated: false,
has_encryption_key: true,
can_read_actions: true,
};
expect(response.status).toEqual(200);
expect(response.body).toEqual(expectedBody);
Expand All @@ -47,6 +51,7 @@ describe('read_privileges route', () => {
...getMockPrivilegesResult(),
is_authenticated: true,
has_encryption_key: true,
can_read_actions: true,
};

const response = await server.inject(getPrivilegeRequest(), context);
Expand Down Expand Up @@ -85,6 +90,7 @@ describe('read_privileges route', () => {
...getMockPrivilegesResult(),
is_authenticated: false,
has_encryption_key: true,
can_read_actions: false,
};

const response = await server.inject(getPrivilegeRequest(), context);
Expand Down

0 comments on commit c94b7a0

Please sign in to comment.