Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
cnasikas committed Jul 2, 2023
1 parent 2ea3c9c commit 7362b97
Show file tree
Hide file tree
Showing 15 changed files with 54 additions and 49 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ describe('loadActionTypes', () => {
enabled_in_license: true,
supported_feature_ids: ['alerting'],
minimum_license_required: 'basic',
is_system_action_type: false,
},
];
http.get.mockResolvedValueOnce(apiResponseValue);
Expand Down Expand Up @@ -60,6 +61,7 @@ describe('loadActionTypes', () => {
enabled_in_license: true,
supported_feature_ids: ['alerting'],
minimum_license_required: 'basic',
is_system_action_type: false,
},
];
http.get.mockResolvedValueOnce(apiResponseValue);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ describe('settings', () => {
minimumLicenseRequired: 'gold',
name: 'Slack',
supportedFeatureIds: ['uptime'],
isSystemActionType: false,
},
]);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,13 +172,15 @@ export const fetchActionTypes = async (): Promise<ActionType[]> => {
enabled_in_license: enabledInLicense,
minimum_license_required: minimumLicenseRequired,
supported_feature_ids: supportedFeatureIds,
is_system_action_type: isSystemActionType,
...res
}: AsApiContract<ActionType>) => ({
...res,
enabledInConfig,
enabledInLicense,
minimumLicenseRequired,
supportedFeatureIds,
isSystemActionType,
})
);
};
2 changes: 1 addition & 1 deletion x-pack/test/alerting_api_integration/common/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const enabledActionTypes = [
'test.throw',
'test.excluded',
'test.capped',
'test-system-action',
'test.system-action',
];

export function createTestConfig(name: string, options: CreateTestConfigOptions) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ function getExcludedActionType() {

function getSystemActionType() {
const result: ActionType<{}, {}, {}> = {
id: 'test-system-action',
id: 'test.system-action',
name: 'Test system action',
minimumLicenseRequired: 'platinum',
supportedFeatureIds: ['alerting'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ export default function createActionTests({ getService }: FtrProviderContext) {
.set('kbn-xsrf', 'foo')
.send({
name: 'My system action',
connector_type_id: 'test-system-action',
connector_type_id: 'test.system-action',
config: {},
secrets: {},
});
Expand All @@ -379,7 +379,7 @@ export default function createActionTests({ getService }: FtrProviderContext) {
expect(response.body).to.eql({
statusCode: 403,
error: 'Forbidden',
message: 'Unauthorized to create a "test-system-action" action',
message: 'Unauthorized to create a "test.system-action" action',
});
break;
case 'superuser at space1':
Expand All @@ -388,7 +388,7 @@ export default function createActionTests({ getService }: FtrProviderContext) {
expect(response.body).to.eql({
statusCode: 400,
error: 'Bad Request',
message: 'System action creation is forbidden. Action type: test-system-action.',
message: 'System action creation is forbidden. Action type: test.system-action.',
});
break;
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ export default function deleteActionTests({ getService }: FtrProviderContext) {
it(`shouldn't delete system action`, async () => {
const response = await supertestWithoutAuth
.delete(
`${getUrlPrefix(space.id)}/api/actions/connector/system-connector-test-system-action`
`${getUrlPrefix(space.id)}/api/actions/connector/system-connector-test.system-action`
)
.auth(user.username, user.password)
.set('kbn-xsrf', 'foo');
Expand All @@ -205,7 +205,7 @@ export default function deleteActionTests({ getService }: FtrProviderContext) {
statusCode: 400,
error: 'Bad Request',
message:
'System action system-connector-test-system-action is not allowed to delete.',
'System action system-connector-test.system-action is not allowed to delete.',
});
break;
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ export default function getActionTests({ getService }: FtrProviderContext) {
it('should handle get system action request appropriately', async () => {
const response = await supertestWithoutAuth
.get(
`${getUrlPrefix(space.id)}/api/actions/connector/system-connector-test-system-action`
`${getUrlPrefix(space.id)}/api/actions/connector/system-connector-test.system-action`
)
.auth(user.username, user.password);

Expand All @@ -185,9 +185,9 @@ export default function getActionTests({ getService }: FtrProviderContext) {
case 'space_1_all_with_restricted_fixture at space1':
expect(response.statusCode).to.eql(200);
expect(response.body).to.eql({
id: 'system-connector-test-system-action',
connector_type_id: 'test-system-action',
name: 'System action: test-system-action',
id: 'system-connector-test.system-action',
connector_type_id: 'test.system-action',
name: 'System action: test.system-action',
is_preconfigured: false,
is_system_action: true,
is_deprecated: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,12 @@ export default function getAllActionTests({ getService }: FtrProviderContext) {
referenced_by_count: 0,
},
{
connector_type_id: 'test-system-action',
id: 'system-connector-test-system-action',
connector_type_id: 'test.system-action',
id: 'system-connector-test.system-action',
is_deprecated: false,
is_preconfigured: false,
is_system_action: true,
name: 'System action: test-system-action',
name: 'System action: test.system-action',
referenced_by_count: 0,
},
{
Expand Down Expand Up @@ -295,12 +295,12 @@ export default function getAllActionTests({ getService }: FtrProviderContext) {
referenced_by_count: 0,
},
{
connector_type_id: 'test-system-action',
id: 'system-connector-test-system-action',
connector_type_id: 'test.system-action',
id: 'system-connector-test.system-action',
is_deprecated: false,
is_preconfigured: false,
is_system_action: true,
name: 'System action: test-system-action',
name: 'System action: test.system-action',
referenced_by_count: 0,
},
{
Expand Down Expand Up @@ -427,12 +427,12 @@ export default function getAllActionTests({ getService }: FtrProviderContext) {
referenced_by_count: 0,
},
{
connector_type_id: 'test-system-action',
id: 'system-connector-test-system-action',
connector_type_id: 'test.system-action',
id: 'system-connector-test.system-action',
is_deprecated: false,
is_preconfigured: false,
is_system_action: true,
name: 'System action: test-system-action',
name: 'System action: test.system-action',
referenced_by_count: 0,
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ export default function updateActionTests({ getService }: FtrProviderContext) {
it(`shouldn't update a system action`, async () => {
const response = await supertestWithoutAuth
.put(
`${getUrlPrefix(space.id)}/api/actions/connector/system-connector-test-system-action`
`${getUrlPrefix(space.id)}/api/actions/connector/system-connector-test.system-action`
)
.auth(user.username, user.password)
.set('kbn-xsrf', 'foo')
Expand Down Expand Up @@ -424,7 +424,7 @@ export default function updateActionTests({ getService }: FtrProviderContext) {
statusCode: 400,
error: 'Bad Request',
message:
'System action system-connector-test-system-action is not allowed to update.',
'System action system-connector-test.system-action is not allowed to update.',
});
break;
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,14 @@ export default function createActionTests({ getService }: FtrProviderContext) {
.set('kbn-xsrf', 'foo')
.send({
name: 'My system action',
connector_type_id: 'test-system-action',
connector_type_id: 'test.system-action',
config: {},
secrets: {},
})
.expect(400, {
statusCode: 400,
error: 'Bad Request',
message: 'System action creation is forbidden. Action type: test-system-action.',
message: 'System action creation is forbidden. Action type: test.system-action.',
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,13 @@ export default function deleteActionTests({ getService }: FtrProviderContext) {
.delete(
`${getUrlPrefix(
Spaces.space1.id
)}/api/actions/connector/system-connector-test-system-action`
)}/api/actions/connector/system-connector-test.system-action`
)
.set('kbn-xsrf', 'foo')
.expect(400, {
statusCode: 400,
error: 'Bad Request',
message: 'System action system-connector-test-system-action is not allowed to delete.',
message: 'System action system-connector-test.system-action is not allowed to delete.',
});
});

Expand Down Expand Up @@ -181,13 +181,13 @@ export default function deleteActionTests({ getService }: FtrProviderContext) {
.delete(
`${getUrlPrefix(
Spaces.space1.id
)}/api/actions/action/system-connector-test-system-action`
)}/api/actions/action/system-connector-test.system-action`
)
.set('kbn-xsrf', 'foo')
.expect(400, {
statusCode: 400,
error: 'Bad Request',
message: 'System action system-connector-test-system-action is not allowed to delete.',
message: 'System action system-connector-test.system-action is not allowed to delete.',
});
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,12 @@ export default function getActionTests({ getService }: FtrProviderContext) {
.get(
`${getUrlPrefix(
Spaces.space1.id
)}/api/actions/connector/system-connector-test-system-action`
)}/api/actions/connector/system-connector-test.system-action`
)
.expect(200, {
id: 'system-connector-test-system-action',
connector_type_id: 'test-system-action',
name: 'System action: test-system-action',
id: 'system-connector-test.system-action',
connector_type_id: 'test.system-action',
name: 'System action: test.system-action',
is_preconfigured: false,
is_system_action: true,
is_deprecated: false,
Expand Down Expand Up @@ -211,12 +211,12 @@ export default function getActionTests({ getService }: FtrProviderContext) {
.get(
`${getUrlPrefix(
Spaces.space1.id
)}/api/actions/action/system-connector-test-system-action`
)}/api/actions/action/system-connector-test.system-action`
)
.expect(200, {
id: 'system-connector-test-system-action',
actionTypeId: 'test-system-action',
name: 'System action: test-system-action',
id: 'system-connector-test.system-action',
actionTypeId: 'test.system-action',
name: 'System action: test.system-action',
isPreconfigured: false,
isSystemAction: true,
isDeprecated: false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,12 @@ export default function getAllActionTests({ getService }: FtrProviderContext) {
referenced_by_count: 0,
},
{
connector_type_id: 'test-system-action',
id: 'system-connector-test-system-action',
connector_type_id: 'test.system-action',
id: 'system-connector-test.system-action',
is_deprecated: false,
is_preconfigured: false,
is_system_action: true,
name: 'System action: test-system-action',
name: 'System action: test.system-action',
referenced_by_count: 0,
},
{
Expand Down Expand Up @@ -236,12 +236,12 @@ export default function getAllActionTests({ getService }: FtrProviderContext) {
referenced_by_count: 0,
},
{
connector_type_id: 'test-system-action',
id: 'system-connector-test-system-action',
connector_type_id: 'test.system-action',
id: 'system-connector-test.system-action',
is_deprecated: false,
is_preconfigured: false,
is_system_action: true,
name: 'System action: test-system-action',
name: 'System action: test.system-action',
referenced_by_count: 0,
},
{
Expand Down Expand Up @@ -371,12 +371,12 @@ export default function getAllActionTests({ getService }: FtrProviderContext) {
referencedByCount: 0,
},
{
actionTypeId: 'test-system-action',
id: 'system-connector-test-system-action',
actionTypeId: 'test.system-action',
id: 'system-connector-test.system-action',
isDeprecated: false,
isPreconfigured: false,
isSystemAction: true,
name: 'System action: test-system-action',
name: 'System action: test.system-action',
referencedByCount: 0,
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ export default function updateActionTests({ getService }: FtrProviderContext) {
.put(
`${getUrlPrefix(
Spaces.space1.id
)}/api/actions/connector/system-connector-test-system-action`
)}/api/actions/connector/system-connector-test.system-action`
)
.set('kbn-xsrf', 'foo')
.send({
Expand All @@ -146,7 +146,7 @@ export default function updateActionTests({ getService }: FtrProviderContext) {
.expect(400, {
statusCode: 400,
error: 'Bad Request',
message: 'System action system-connector-test-system-action is not allowed to update.',
message: 'System action system-connector-test.system-action is not allowed to update.',
});
});

Expand Down Expand Up @@ -319,7 +319,7 @@ export default function updateActionTests({ getService }: FtrProviderContext) {
.put(
`${getUrlPrefix(
Spaces.space1.id
)}/api/actions/action/system-connector-test-system-action`
)}/api/actions/action/system-connector-test.system-action`
)
.set('kbn-xsrf', 'foo')
.send({
Expand All @@ -334,7 +334,7 @@ export default function updateActionTests({ getService }: FtrProviderContext) {
.expect(400, {
statusCode: 400,
error: 'Bad Request',
message: 'System action system-connector-test-system-action is not allowed to update.',
message: 'System action system-connector-test.system-action is not allowed to update.',
});
});

Expand Down

0 comments on commit 7362b97

Please sign in to comment.