Skip to content

Commit

Permalink
Remove references to system_indices_superuser from Synthetics API t…
Browse files Browse the repository at this point in the history
…ests.
  • Loading branch information
justinkambic committed Apr 5, 2024
1 parent 78cc5fd commit 5de4235
Showing 1 changed file with 19 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export default function ({ getService }: FtrProviderContext) {
}

describe('[PUT] /internal/uptime/service/enablement', () => {
const roles: RoleName[] = ['admin', 'editor', 'system_indices_superuser', 'viewer'];
const roles: RoleName[] = ['admin', 'editor', 'viewer'];

roles.forEach((role) => {
it(`${role} role has appropriate permissions for API keys`, async () => {
Expand All @@ -91,7 +91,7 @@ export default function ({ getService }: FtrProviderContext) {

const { body } = await enablementPut(role);

if (['system_indices_superuser', 'admin'].indexOf(role) !== -1) {
if (['admin'].indexOf(role) !== -1) {
expect(body).to.eql(ALL_ENABLED);
} else {
expect(body).to.eql({
Expand Down Expand Up @@ -166,21 +166,21 @@ export default function ({ getService }: FtrProviderContext) {
beforeEach(async () => {
const apiKeys = await getApiKeys();
if (apiKeys.length) {
await enablementDelete('system_indices_superuser');
await enablementDelete();
}
});
it('admin can delete api key', async () => {
await enablementPut('system_indices_superuser');
await enablementPut();

const delResponse = await enablementDelete('system_indices_superuser');
const delResponse = await enablementDelete();

expect(delResponse.body).eql({});
const apiResponse = await enablementPut();

expect(apiResponse.body).eql(ALL_ENABLED);
});

it('with an editor user', async () => {
it('editor user cannot delete API key', async () => {
await enablementPut();
await enablementDelete('editor', 403);
const apiResponse = await enablementPut('editor');
Expand All @@ -192,6 +192,19 @@ export default function ({ getService }: FtrProviderContext) {
isValidApiKey: true,
});
});

it('viewer user cannot delete API key', async () => {
await enablementPut();
await enablementDelete('viewer', 403);
const apiResponse = await enablementPut('viewer');
expect(apiResponse.body).eql({
areApiKeysEnabled: true,
canManageApiKeys: false,
canEnable: false,
isEnabled: true,
isValidApiKey: true,
});
});
});
});
}

0 comments on commit 5de4235

Please sign in to comment.