Changed actions API endpoints urls to follow Kibana STYLEGUIDE (#65936) (#67360)

* Changed actions API endpoints urls to follow Kibana STYLEGUIDE

* Fixed tests

* fixed test

* fixed test

* resolved conflicts

* Fixed siem tests

* Fixed failing test

* fixed readme and test

* Changed actions api urls to follow the template 'api/{plugin}/{type}/{id}

* Fixed type checks

* Fixed tests and API

* fixed tests

* Fixed type checks

* fixed type check
This commit is contained in:
Yuliia Naumenko 2020-05-26 11:04:13 -07:00 committed by GitHub
parent 0f0dc3f403
commit 61b98931a5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
93 changed files with 395 additions and 384 deletions

View file

@ -27,12 +27,12 @@ Table of Contents
- [Example](#example)
- [RESTful API](#restful-api)
- [`POST /api/action`: Create action](#post-apiaction-create-action)
- [`DELETE /api/action/{id}`: Delete action](#delete-apiactionid-delete-action)
- [`GET /api/action/_getAll`: Get all actions](#get-apiactiongetall-get-all-actions)
- [`GET /api/action/{id}`: Get action](#get-apiactionid-get-action)
- [`GET /api/action/types`: List action types](#get-apiactiontypes-list-action-types)
- [`PUT /api/action/{id}`: Update action](#put-apiactionid-update-action)
- [`POST /api/action/{id}/_execute`: Execute action](#post-apiactionidexecute-execute-action)
- [`DELETE /api/actions/action/{id}`: Delete action](#delete-apiactionid-delete-action)
- [`GET /api/actions`: Get all actions](#get-apiactiongetall-get-all-actions)
- [`GET /api/actions/action/{id}`: Get action](#get-apiactionid-get-action)
- [`GET /api/actions/list_action_types`: List action types](#get-apiactiontypes-list-action-types)
- [`PUT /api/actions/action/{id}`: Update action](#put-apiactionid-update-action)
- [`POST /api/actions/action/{id}/_execute`: Execute action](#post-apiactionidexecute-execute-action)
- [Firing actions](#firing-actions)
- [Example](#example-1)
- [Built-in Action Types](#built-in-action-types)
@ -174,7 +174,7 @@ Payload:
| config | The configuration the action type expects. See related action type to see what attributes are expected. This will also validate against the action type if config validation is defined. | object |
| secrets | The secrets the action type expects. See related action type to see what attributes are expected. This will also validate against the action type if secrets validation is defined. | object |
### `DELETE /api/action/{id}`: Delete action
### `DELETE /api/actions/action/{id}`: Delete action
Params:
@ -182,7 +182,7 @@ Params:
| -------- | --------------------------------------------- | ------ |
| id | The id of the action you're trying to delete. | string |
### `GET /api/action/_getAll`: Get all actions
### `GET /api/actions`: Get all actions
No parameters.
@ -190,7 +190,7 @@ Return all actions from saved objects merged with predefined list.
Use the [saved objects API for find](https://www.elastic.co/guide/en/kibana/master/saved-objects-api-find.html) with the proprties: `type: 'action'` and `perPage: 10000`.
List of predefined actions should be set up in Kibana.yaml.
### `GET /api/action/{id}`: Get action
### `GET /api/actions/action/{id}`: Get action
Params:
@ -198,11 +198,11 @@ Params:
| -------- | ------------------------------------------ | ------ |
| id | The id of the action you're trying to get. | string |
### `GET /api/action/types`: List action types
### `GET /api/actions/list_action_types`: List action types
No parameters.
### `PUT /api/action/{id}`: Update action
### `PUT /api/actions/action/{id}`: Update action
Params:
@ -218,7 +218,7 @@ Payload:
| config | The configuration the action type expects. See related action type to see what attributes are expected. This will also validate against the action type if config validation is defined. | object |
| secrets | The secrets the action type expects. See related action type to see what attributes are expected. This will also validate against the action type if secrets validation is defined. | object |
### `POST /api/action/{id}/_execute`: Execute action
### `POST /api/actions/action/{id}/_execute`: Execute action
Params:

View file

@ -6,4 +6,4 @@
export * from './types';
export const BASE_ACTION_API_PATH = '/api/action';
export const BASE_ACTION_API_PATH = '/api/actions';

View file

@ -27,7 +27,7 @@ describe('createActionRoute', () => {
const [config, handler] = router.post.mock.calls[0];
expect(config.path).toMatchInlineSnapshot(`"/api/action"`);
expect(config.path).toMatchInlineSnapshot(`"/api/actions/action"`);
expect(config.options).toMatchInlineSnapshot(`
Object {
"tags": Array [

View file

@ -26,7 +26,7 @@ export const bodySchema = schema.object({
export const createActionRoute = (router: IRouter, licenseState: ILicenseState) => {
router.post(
{
path: BASE_ACTION_API_PATH,
path: `${BASE_ACTION_API_PATH}/action`,
validate: {
body: bodySchema,
},

View file

@ -27,7 +27,7 @@ describe('deleteActionRoute', () => {
const [config, handler] = router.delete.mock.calls[0];
expect(config.path).toMatchInlineSnapshot(`"/api/action/{id}"`);
expect(config.path).toMatchInlineSnapshot(`"/api/actions/action/{id}"`);
expect(config.options).toMatchInlineSnapshot(`
Object {
"tags": Array [

View file

@ -27,7 +27,7 @@ const paramSchema = schema.object({
export const deleteActionRoute = (router: IRouter, licenseState: ILicenseState) => {
router.delete(
{
path: `${BASE_ACTION_API_PATH}/{id}`,
path: `${BASE_ACTION_API_PATH}/action/{id}`,
validate: {
params: paramSchema,
},

View file

@ -53,7 +53,7 @@ describe('executeActionRoute', () => {
const [config, handler] = router.post.mock.calls[0];
expect(config.path).toMatchInlineSnapshot(`"/api/action/{id}/_execute"`);
expect(config.path).toMatchInlineSnapshot(`"/api/actions/action/{id}/_execute"`);
expect(config.options).toMatchInlineSnapshot(`
Object {
"tags": Array [

View file

@ -32,7 +32,7 @@ export const executeActionRoute = (
) => {
router.post(
{
path: `${BASE_ACTION_API_PATH}/{id}/_execute`,
path: `${BASE_ACTION_API_PATH}/action/{id}/_execute`,
validate: {
body: bodySchema,
params: paramSchema,

View file

@ -28,7 +28,7 @@ describe('getActionRoute', () => {
const [config, handler] = router.get.mock.calls[0];
expect(config.path).toMatchInlineSnapshot(`"/api/action/{id}"`);
expect(config.path).toMatchInlineSnapshot(`"/api/actions/action/{id}"`);
expect(config.options).toMatchInlineSnapshot(`
Object {
"tags": Array [

View file

@ -22,7 +22,7 @@ const paramSchema = schema.object({
export const getActionRoute = (router: IRouter, licenseState: ILicenseState) => {
router.get(
{
path: `${BASE_ACTION_API_PATH}/{id}`,
path: `${BASE_ACTION_API_PATH}/action/{id}`,
validate: {
params: paramSchema,
},

View file

@ -28,7 +28,7 @@ describe('getAllActionRoute', () => {
const [config, handler] = router.get.mock.calls[0];
expect(config.path).toMatchInlineSnapshot(`"/api/action/_getAll"`);
expect(config.path).toMatchInlineSnapshot(`"/api/actions"`);
expect(config.options).toMatchInlineSnapshot(`
Object {
"tags": Array [
@ -63,7 +63,7 @@ describe('getAllActionRoute', () => {
const [config, handler] = router.get.mock.calls[0];
expect(config.path).toMatchInlineSnapshot(`"/api/action/_getAll"`);
expect(config.path).toMatchInlineSnapshot(`"/api/actions"`);
expect(config.options).toMatchInlineSnapshot(`
Object {
"tags": Array [
@ -94,7 +94,7 @@ describe('getAllActionRoute', () => {
const [config, handler] = router.get.mock.calls[0];
expect(config.path).toMatchInlineSnapshot(`"/api/action/_getAll"`);
expect(config.path).toMatchInlineSnapshot(`"/api/actions"`);
expect(config.options).toMatchInlineSnapshot(`
Object {
"tags": Array [

View file

@ -17,7 +17,7 @@ import { BASE_ACTION_API_PATH } from '../../common';
export const getAllActionRoute = (router: IRouter, licenseState: ILicenseState) => {
router.get(
{
path: `${BASE_ACTION_API_PATH}/_getAll`,
path: `${BASE_ACTION_API_PATH}`,
validate: {},
options: {
tags: ['access:actions-read'],

View file

@ -28,7 +28,7 @@ describe('listActionTypesRoute', () => {
const [config, handler] = router.get.mock.calls[0];
expect(config.path).toMatchInlineSnapshot(`"/api/action/types"`);
expect(config.path).toMatchInlineSnapshot(`"/api/actions/list_action_types"`);
expect(config.options).toMatchInlineSnapshot(`
Object {
"tags": Array [
@ -80,7 +80,7 @@ describe('listActionTypesRoute', () => {
const [config, handler] = router.get.mock.calls[0];
expect(config.path).toMatchInlineSnapshot(`"/api/action/types"`);
expect(config.path).toMatchInlineSnapshot(`"/api/actions/list_action_types"`);
expect(config.options).toMatchInlineSnapshot(`
Object {
"tags": Array [
@ -125,7 +125,7 @@ describe('listActionTypesRoute', () => {
const [config, handler] = router.get.mock.calls[0];
expect(config.path).toMatchInlineSnapshot(`"/api/action/types"`);
expect(config.path).toMatchInlineSnapshot(`"/api/actions/list_action_types"`);
expect(config.options).toMatchInlineSnapshot(`
Object {
"tags": Array [

View file

@ -17,7 +17,7 @@ import { BASE_ACTION_API_PATH } from '../../common';
export const listActionTypesRoute = (router: IRouter, licenseState: ILicenseState) => {
router.get(
{
path: `${BASE_ACTION_API_PATH}/types`,
path: `${BASE_ACTION_API_PATH}/list_action_types`,
validate: {},
options: {
tags: ['access:actions-read'],

View file

@ -27,7 +27,7 @@ describe('updateActionRoute', () => {
const [config, handler] = router.put.mock.calls[0];
expect(config.path).toMatchInlineSnapshot(`"/api/action/{id}"`);
expect(config.path).toMatchInlineSnapshot(`"/api/actions/action/{id}"`);
expect(config.options).toMatchInlineSnapshot(`
Object {
"tags": Array [

View file

@ -28,7 +28,7 @@ const bodySchema = schema.object({
export const updateActionRoute = (router: IRouter, licenseState: ILicenseState) => {
router.put(
{
path: `${BASE_ACTION_API_PATH}/{id}`,
path: `${BASE_ACTION_API_PATH}/action/{id}`,
validate: {
body: bodySchema,
params: paramSchema,

View file

@ -25,7 +25,7 @@ export const CASE_USER_ACTIONS_URL = `${CASE_DETAILS_URL}/user_actions`;
* Action routes
*/
export const ACTION_URL = '/api/action';
export const ACTION_TYPES_URL = '/api/action/types';
export const ACTION_URL = '/api/actions';
export const ACTION_TYPES_URL = '/api/actions/list_action_types';
export const SUPPORTED_CONNECTORS = ['.servicenow', '.jira'];

View file

@ -61,7 +61,7 @@ export const AlertsConfiguration: React.FC<AlertsConfigurationProps> = (
async function fetchEmailActions() {
const kibanaActions = await Legacy.shims.kfetch({
method: 'GET',
pathname: `/api/action/_getAll`,
pathname: `/api/actions`,
});
const actions = kibanaActions.data.filter(

View file

@ -135,7 +135,7 @@ describe('Step1', () => {
expect(kfetch).toHaveBeenCalledWith({
method: 'POST',
pathname: `/api/action`,
pathname: `/api/actions/action`,
body: JSON.stringify({
name: 'Email action for Stack Monitoring alerts',
actionTypeId: ALERT_ACTION_TYPE_EMAIL,
@ -193,7 +193,7 @@ describe('Step1', () => {
expect(kfetch).toHaveBeenCalledWith({
method: 'PUT',
pathname: `/api/action/${emailActions[0].id}`,
pathname: `/api/actions/action/${emailActions[0].id}`,
body: JSON.stringify({
name: emailActions[0].name,
config: omit(data, ['user', 'password']),
@ -210,7 +210,7 @@ describe('Step1', () => {
Legacy: {
shims: {
kfetch: jest.fn().mockImplementation((arg) => {
if (arg.pathname === '/api/action/1/_execute') {
if (arg.pathname === '/api/actions/action/1/_execute') {
return { status: 'ok' };
}
return {};
@ -236,7 +236,7 @@ describe('Step1', () => {
Legacy: {
shims: {
kfetch: (arg: any) => {
if (arg.pathname === '/api/action/1/_execute') {
if (arg.pathname === '/api/actions/action/1/_execute') {
return { status: 'ok' };
}
return {};
@ -260,7 +260,7 @@ describe('Step1', () => {
Legacy: {
shims: {
kfetch: (arg: any) => {
if (arg.pathname === '/api/action/1/_execute') {
if (arg.pathname === '/api/actions/action/1/_execute') {
return { message: 'Very detailed error message' };
}
return {};
@ -320,7 +320,7 @@ describe('Step1', () => {
expect(kfetch).toHaveBeenCalledWith({
method: 'DELETE',
pathname: `/api/action/${emailActions[0].id}`,
pathname: `/api/actions/action/${emailActions[0].id}`,
});
expect(customProps.setSelectedEmailActionId).toHaveBeenCalledWith('');

View file

@ -44,7 +44,7 @@ export const Step1: React.FC<GetStep1Props> = (props: GetStep1Props) => {
if (props.editAction) {
await Legacy.shims.kfetch({
method: 'PUT',
pathname: `${BASE_ACTION_API_PATH}/${props.editAction.id}`,
pathname: `${BASE_ACTION_API_PATH}/action/${props.editAction.id}`,
body: JSON.stringify({
name: props.editAction.name,
config: omit(data, ['user', 'password']),
@ -55,7 +55,7 @@ export const Step1: React.FC<GetStep1Props> = (props: GetStep1Props) => {
} else {
await Legacy.shims.kfetch({
method: 'POST',
pathname: BASE_ACTION_API_PATH,
pathname: `${BASE_ACTION_API_PATH}/action`,
body: JSON.stringify({
name: i18n.translate('xpack.monitoring.alerts.configuration.emailAction.name', {
defaultMessage: 'Email action for Stack Monitoring alerts',
@ -75,7 +75,7 @@ export const Step1: React.FC<GetStep1Props> = (props: GetStep1Props) => {
await Legacy.shims.kfetch({
method: 'DELETE',
pathname: `${BASE_ACTION_API_PATH}/${id}`,
pathname: `${BASE_ACTION_API_PATH}/action/${id}`,
});
if (props.editAction && props.editAction.id === id) {
@ -101,7 +101,7 @@ export const Step1: React.FC<GetStep1Props> = (props: GetStep1Props) => {
const result = await Legacy.shims.kfetch({
method: 'POST',
pathname: `${BASE_ACTION_API_PATH}/${props.selectedEmailActionId}/_execute`,
pathname: `${BASE_ACTION_API_PATH}/action/${props.selectedEmailActionId}/_execute`,
body: JSON.stringify({ params }),
});
if (result.status === 'ok') {

View file

@ -21,7 +21,7 @@ import { CASES } from '../urls/navigation';
describe.skip('Cases connectors', () => {
before(() => {
cy.server();
cy.route('POST', '**/api/action').as('createConnector');
cy.route('POST', '**/api/actions/action').as('createConnector');
cy.route('POST', '**/api/cases/configure').as('saveConnector');
});

View file

@ -88,7 +88,7 @@ describe('Case Configuration API', () => {
});
test('check url, method, signal', async () => {
await getActionLicense(abortCtrl.signal);
expect(fetchMock).toHaveBeenCalledWith(`/api/action/types`, {
expect(fetchMock).toHaveBeenCalledWith(`/api/actions/list_action_types`, {
method: 'GET',
signal: abortCtrl.signal,
});
@ -416,7 +416,7 @@ describe('Case Configuration API', () => {
const connectorId = 'connectorId';
test('check url, method, signal', async () => {
await pushToService(connectorId, casePushParams, abortCtrl.signal);
expect(fetchMock).toHaveBeenCalledWith(`/api/action/${connectorId}/_execute`, {
expect(fetchMock).toHaveBeenCalledWith(`/api/actions/action/${connectorId}/_execute`, {
method: 'POST',
body: JSON.stringify({
params: { subAction: 'pushToService', subActionParams: casePushParams },

View file

@ -242,7 +242,7 @@ export const pushToService = async (
signal: AbortSignal
): Promise<ServiceConnectorCaseResponse> => {
const response = await KibanaServices.get().http.fetch<ActionTypeExecutorResult>(
`${ACTION_URL}/${connectorId}/_execute`,
`${ACTION_URL}/action/${connectorId}/_execute`,
{
method: 'POST',
body: JSON.stringify({

View file

@ -13,5 +13,5 @@ set -e
# https://github.com/elastic/kibana/blob/master/x-pack/plugins/actions/README.md#get-apiaction_find-find-actions
curl -s -k \
-u ${ELASTICSEARCH_USERNAME}:${ELASTICSEARCH_PASSWORD} \
-X GET ${KIBANA_URL}${SPACE_URL}/api/action/_getAll \
-X GET ${KIBANA_URL}${SPACE_URL}/api/actions \
| jq .

View file

@ -13,5 +13,5 @@ set -e
# https://github.com/elastic/kibana/blob/master/x-pack/plugins/actions/README.md
curl -s -k \
-u ${ELASTICSEARCH_USERNAME}:${ELASTICSEARCH_PASSWORD} \
-X GET ${KIBANA_URL}${SPACE_URL}/api/action/types \
-X GET ${KIBANA_URL}${SPACE_URL}/api/actions/list_action_types \
| jq .

View file

@ -36,7 +36,7 @@ describe('loadActionTypes', () => {
expect(result).toEqual(resolvedValue);
expect(http.get.mock.calls[0]).toMatchInlineSnapshot(`
Array [
"/api/action/types",
"/api/actions/list_action_types",
]
`);
});
@ -50,7 +50,7 @@ describe('loadAllActions', () => {
expect(result).toEqual([]);
expect(http.get.mock.calls[0]).toMatchInlineSnapshot(`
Array [
"/api/action/_getAll",
"/api/actions",
]
`);
});
@ -72,7 +72,7 @@ describe('createActionConnector', () => {
expect(result).toEqual(resolvedValue);
expect(http.post.mock.calls[0]).toMatchInlineSnapshot(`
Array [
"/api/action",
"/api/actions/action",
Object {
"body": "{\\"actionTypeId\\":\\"test\\",\\"isPreconfigured\\":false,\\"name\\":\\"My test\\",\\"config\\":{},\\"secrets\\":{}}",
},
@ -98,7 +98,7 @@ describe('updateActionConnector', () => {
expect(result).toEqual(resolvedValue);
expect(http.put.mock.calls[0]).toMatchInlineSnapshot(`
Array [
"/api/action/123",
"/api/actions/action/123",
Object {
"body": "{\\"name\\":\\"My test\\",\\"config\\":{},\\"secrets\\":{}}",
},
@ -116,13 +116,13 @@ describe('deleteActions', () => {
expect(http.delete.mock.calls).toMatchInlineSnapshot(`
Array [
Array [
"/api/action/1",
"/api/actions/action/1",
],
Array [
"/api/action/2",
"/api/actions/action/2",
],
Array [
"/api/action/3",
"/api/actions/action/3",
],
]
`);

View file

@ -9,11 +9,11 @@ import { BASE_ACTION_API_PATH } from '../constants';
import { ActionConnector, ActionConnectorWithoutId, ActionType } from '../../types';
export async function loadActionTypes({ http }: { http: HttpSetup }): Promise<ActionType[]> {
return await http.get(`${BASE_ACTION_API_PATH}/types`);
return await http.get(`${BASE_ACTION_API_PATH}/list_action_types`);
}
export async function loadAllActions({ http }: { http: HttpSetup }): Promise<ActionConnector[]> {
return await http.get(`${BASE_ACTION_API_PATH}/_getAll`);
return await http.get(`${BASE_ACTION_API_PATH}`);
}
export async function createActionConnector({
@ -23,7 +23,7 @@ export async function createActionConnector({
http: HttpSetup;
connector: Omit<ActionConnectorWithoutId, 'referencedByCount'>;
}): Promise<ActionConnector> {
return await http.post(`${BASE_ACTION_API_PATH}`, {
return await http.post(`${BASE_ACTION_API_PATH}/action`, {
body: JSON.stringify(connector),
});
}
@ -37,7 +37,7 @@ export async function updateActionConnector({
connector: Pick<ActionConnectorWithoutId, 'name' | 'config' | 'secrets'>;
id: string;
}): Promise<ActionConnector> {
return await http.put(`${BASE_ACTION_API_PATH}/${id}`, {
return await http.put(`${BASE_ACTION_API_PATH}/action/${id}`, {
body: JSON.stringify({
name: connector.name,
config: connector.config,
@ -55,7 +55,7 @@ export async function deleteActions({
}): Promise<{ successes: string[]; errors: string[] }> {
const successes: string[] = [];
const errors: string[] = [];
await Promise.all(ids.map((id) => http.delete(`${BASE_ACTION_API_PATH}/${id}`))).then(
await Promise.all(ids.map((id) => http.delete(`${BASE_ACTION_API_PATH}/action/${id}`))).then(
function (fulfilled) {
successes.push(...fulfilled);
},

View file

@ -13,7 +13,7 @@ export default function emailTest({ getService }: FtrProviderContext) {
describe('create email action', () => {
it('should return 403 when creating an email action', async () => {
await supertest
.post('/api/action')
.post('/api/actions/action')
.set('kbn-xsrf', 'foo')
.send({
name: 'An email action',

View file

@ -14,7 +14,7 @@ export default function indexTest({ getService }: FtrProviderContext) {
it('should return 200 when creating an index action', async () => {
// create action with no config
await supertest
.post('/api/action')
.post('/api/actions/action')
.set('kbn-xsrf', 'foo')
.send({
name: 'An index action',

View file

@ -13,7 +13,7 @@ export default function pagerdutyTest({ getService }: FtrProviderContext) {
describe('pagerduty action', () => {
it('should return 403 when creating a pagerduty action', async () => {
await supertest
.post('/api/action')
.post('/api/actions/action')
.set('kbn-xsrf', 'foo')
.send({
name: 'A pagerduty action',

View file

@ -16,7 +16,7 @@ export default function serverLogTest({ getService }: FtrProviderContext) {
it('should return 200 when creating a server-log action', async () => {
await supertest
.post('/api/action')
.post('/api/actions/action')
.set('kbn-xsrf', 'foo')
.send({
name: 'A server.log action',

View file

@ -61,7 +61,7 @@ export default function servicenowTest({ getService }: FtrProviderContext) {
it('should return 403 when creating a servicenow action', async () => {
await supertest
.post('/api/action')
.post('/api/actions/action')
.set('kbn-xsrf', 'foo')
.send({
name: 'A servicenow action',

View file

@ -28,7 +28,7 @@ export default function slackTest({ getService }: FtrProviderContext) {
it('should return 403 when creating a slack action', async () => {
await supertest
.post('/api/action')
.post('/api/actions/action')
.set('kbn-xsrf', 'foo')
.send({
name: 'A slack action',

View file

@ -27,7 +27,7 @@ export default function webhookTest({ getService }: FtrProviderContext) {
it('should return 403 when creating a webhook action', async () => {
await supertest
.post('/api/action')
.post('/api/actions/action')
.set('kbn-xsrf', 'test')
.send({
name: 'A generic Webhook action',

View file

@ -187,7 +187,7 @@ export class AlertUtils {
const alertBody = getDefaultAlwaysFiringAlertData(reference, actionId);
const response = await request.send({ ...alertBody, ...overwrites });
if (response.statusCode === 200) {
objRemover.add(this.space.id, response.body.id, 'alert');
objRemover.add(this.space.id, response.body.id, 'alert', undefined);
}
return response;
}
@ -257,7 +257,7 @@ export class AlertUtils {
...overwrites,
});
if (response.statusCode === 200) {
objRemover.add(this.space.id, response.body.id, 'alert');
objRemover.add(this.space.id, response.body.id, 'alert', undefined);
}
return response;
}

View file

@ -10,6 +10,7 @@ interface ObjectToRemove {
spaceId: string;
id: string;
type: string;
plugin?: string;
}
export class ObjectRemover {
@ -20,15 +21,21 @@ export class ObjectRemover {
this.supertest = supertest;
}
add(spaceId: ObjectToRemove['spaceId'], id: ObjectToRemove['id'], type: ObjectToRemove['type']) {
this.objectsToRemove.push({ spaceId, id, type });
add(
spaceId: ObjectToRemove['spaceId'],
id: ObjectToRemove['id'],
type: ObjectToRemove['type'],
plugin: ObjectToRemove['plugin']
) {
this.objectsToRemove.push({ spaceId, id, type, plugin });
}
async removeAll() {
await Promise.all(
this.objectsToRemove.map(({ spaceId, id, type }) => {
this.objectsToRemove.map(({ spaceId, id, type, plugin }) => {
const pluginPath = plugin ? `/${plugin}` : '';
return this.supertest
.delete(`${getUrlPrefix(spaceId)}/api/${type}/${id}`)
.delete(`${getUrlPrefix(spaceId)}/api${pluginPath}/${type}/${id}`)
.set('kbn-xsrf', 'foo')
.expect(204);
})

View file

@ -20,7 +20,7 @@ export default function emailTest({ getService }: FtrProviderContext) {
it('should return 200 when creating an email action successfully', async () => {
const { body: createdAction } = await supertest
.post('/api/action')
.post('/api/actions/action')
.set('kbn-xsrf', 'foo')
.send({
name: 'An email action',
@ -54,7 +54,7 @@ export default function emailTest({ getService }: FtrProviderContext) {
expect(typeof createdActionId).to.be('string');
const { body: fetchedAction } = await supertest
.get(`/api/action/${createdActionId}`)
.get(`/api/actions/action/${createdActionId}`)
.expect(200);
expect(fetchedAction).to.eql({
@ -74,7 +74,7 @@ export default function emailTest({ getService }: FtrProviderContext) {
it('should return the message data when firing the __json service', async () => {
await supertest
.post(`/api/action/${createdActionId}/_execute`)
.post(`/api/actions/action/${createdActionId}/_execute`)
.set('kbn-xsrf', 'foo')
.send({
params: {
@ -117,7 +117,7 @@ export default function emailTest({ getService }: FtrProviderContext) {
it('should render html from markdown', async () => {
await supertest
.post(`/api/action/${createdActionId}/_execute`)
.post(`/api/actions/action/${createdActionId}/_execute`)
.set('kbn-xsrf', 'foo')
.send({
params: {
@ -138,7 +138,7 @@ export default function emailTest({ getService }: FtrProviderContext) {
it('should respond with a 400 Bad Request when creating an email action with an invalid config', async () => {
await supertest
.post('/api/action')
.post('/api/actions/action')
.set('kbn-xsrf', 'foo')
.send({
name: 'An email action',
@ -158,7 +158,7 @@ export default function emailTest({ getService }: FtrProviderContext) {
it('should respond with a 400 Bad Request when creating an email action with non-whitelisted server', async () => {
await supertest
.post('/api/action')
.post('/api/actions/action')
.set('kbn-xsrf', 'foo')
.send({
name: 'An email action',
@ -183,7 +183,7 @@ export default function emailTest({ getService }: FtrProviderContext) {
});
await supertest
.post('/api/action')
.post('/api/actions/action')
.set('kbn-xsrf', 'foo')
.send({
name: 'An email action',
@ -211,7 +211,7 @@ export default function emailTest({ getService }: FtrProviderContext) {
it('should handle creating an email action with a whitelisted server', async () => {
const { body: createdAction } = await supertest
.post('/api/action')
.post('/api/actions/action')
.set('kbn-xsrf', 'foo')
.send({
name: 'An email action',
@ -232,7 +232,7 @@ export default function emailTest({ getService }: FtrProviderContext) {
it('should handle an email action with no auth', async () => {
const { body: createdAction } = await supertest
.post('/api/action')
.post('/api/actions/action')
.set('kbn-xsrf', 'foo')
.send({
name: 'An email action with no auth',
@ -245,7 +245,7 @@ export default function emailTest({ getService }: FtrProviderContext) {
.expect(200);
await supertest
.post(`/api/action/${createdAction.id}/_execute`)
.post(`/api/actions/action/${createdAction.id}/_execute`)
.set('kbn-xsrf', 'foo')
.send({
params: {

View file

@ -26,7 +26,7 @@ export default function indexTest({ getService }: FtrProviderContext) {
it('should be created successfully', async () => {
// create action with no config
const { body: createdAction } = await supertest
.post('/api/action')
.post('/api/actions/action')
.set('kbn-xsrf', 'foo')
.send({
name: 'An index action',
@ -53,7 +53,7 @@ export default function indexTest({ getService }: FtrProviderContext) {
expect(typeof createdActionID).to.be('string');
const { body: fetchedAction } = await supertest
.get(`/api/action/${createdActionID}`)
.get(`/api/actions/action/${createdActionID}`)
.expect(200);
expect(fetchedAction).to.eql({
@ -66,7 +66,7 @@ export default function indexTest({ getService }: FtrProviderContext) {
// create action with all config props
const { body: createdActionWithIndex } = await supertest
.post('/api/action')
.post('/api/actions/action')
.set('kbn-xsrf', 'foo')
.send({
name: 'An index action with index config',
@ -94,7 +94,7 @@ export default function indexTest({ getService }: FtrProviderContext) {
expect(typeof createdActionIDWithIndex).to.be('string');
const { body: fetchedActionWithIndex } = await supertest
.get(`/api/action/${createdActionIDWithIndex}`)
.get(`/api/actions/action/${createdActionIDWithIndex}`)
.expect(200);
expect(fetchedActionWithIndex).to.eql({
@ -112,7 +112,7 @@ export default function indexTest({ getService }: FtrProviderContext) {
it('should respond with error when creation unsuccessful', async () => {
await supertest
.post('/api/action')
.post('/api/actions/action')
.set('kbn-xsrf', 'foo')
.send({
name: 'An index action',
@ -132,7 +132,7 @@ export default function indexTest({ getService }: FtrProviderContext) {
it('should execute successly when expected for a single body', async () => {
const { body: createdAction } = await supertest
.post('/api/action')
.post('/api/actions/action')
.set('kbn-xsrf', 'foo')
.send({
name: 'An index action',
@ -145,7 +145,7 @@ export default function indexTest({ getService }: FtrProviderContext) {
})
.expect(200);
const { body: result } = await supertest
.post(`/api/action/${createdAction.id}/_execute`)
.post(`/api/actions/action/${createdAction.id}/_execute`)
.set('kbn-xsrf', 'foo')
.send({
params: {
@ -162,7 +162,7 @@ export default function indexTest({ getService }: FtrProviderContext) {
it('should execute successly when expected for with multiple bodies', async () => {
const { body: createdAction } = await supertest
.post('/api/action')
.post('/api/actions/action')
.set('kbn-xsrf', 'foo')
.send({
name: 'An index action',
@ -175,7 +175,7 @@ export default function indexTest({ getService }: FtrProviderContext) {
})
.expect(200);
const { body: result } = await supertest
.post(`/api/action/${createdAction.id}/_execute`)
.post(`/api/actions/action/${createdAction.id}/_execute`)
.set('kbn-xsrf', 'foo')
.send({
params: {
@ -206,7 +206,7 @@ export default function indexTest({ getService }: FtrProviderContext) {
it('should execute successly with refresh false', async () => {
const { body: createdAction } = await supertest
.post('/api/action')
.post('/api/actions/action')
.set('kbn-xsrf', 'foo')
.send({
name: 'An index action',
@ -220,7 +220,7 @@ export default function indexTest({ getService }: FtrProviderContext) {
})
.expect(200);
const { body: result } = await supertest
.post(`/api/action/${createdAction.id}/_execute`)
.post(`/api/actions/action/${createdAction.id}/_execute`)
.set('kbn-xsrf', 'foo')
.send({
params: {
@ -235,7 +235,7 @@ export default function indexTest({ getService }: FtrProviderContext) {
expect(items.length).to.be.lessThan(2);
const { body: createdActionWithRefresh } = await supertest
.post('/api/action')
.post('/api/actions/action')
.set('kbn-xsrf', 'foo')
.send({
name: 'An index action',
@ -248,7 +248,7 @@ export default function indexTest({ getService }: FtrProviderContext) {
})
.expect(200);
const { body: result2 } = await supertest
.post(`/api/action/${createdActionWithRefresh.id}/_execute`)
.post(`/api/actions/action/${createdActionWithRefresh.id}/_execute`)
.set('kbn-xsrf', 'foo')
.send({
params: {

View file

@ -24,7 +24,7 @@ export default function indexTest({ getService }: FtrProviderContext) {
it('should execute successfully when expected for a single body', async () => {
const { body: result } = await supertest
.post(`/api/action/${ACTION_ID}/_execute`)
.post(`/api/actions/action/${ACTION_ID}/_execute`)
.set('kbn-xsrf', 'foo')
.send({
params: {

View file

@ -87,7 +87,7 @@ export default function jiraTest({ getService }: FtrProviderContext) {
describe('Jira - Action Creation', () => {
it('should return 200 when creating a jira action successfully', async () => {
const { body: createdAction } = await supertest
.post('/api/action')
.post('/api/actions/action')
.set('kbn-xsrf', 'foo')
.send({
name: 'A jira action',
@ -113,7 +113,7 @@ export default function jiraTest({ getService }: FtrProviderContext) {
});
const { body: fetchedAction } = await supertest
.get(`/api/action/${createdAction.id}`)
.get(`/api/actions/action/${createdAction.id}`)
.expect(200);
expect(fetchedAction).to.eql({
@ -131,7 +131,7 @@ export default function jiraTest({ getService }: FtrProviderContext) {
it('should respond with a 400 Bad Request when creating a jira action with no apiUrl', async () => {
await supertest
.post('/api/action')
.post('/api/actions/action')
.set('kbn-xsrf', 'foo')
.send({
name: 'A jira action',
@ -151,7 +151,7 @@ export default function jiraTest({ getService }: FtrProviderContext) {
it('should respond with a 400 Bad Request when creating a jira action with no projectKey', async () => {
await supertest
.post('/api/action')
.post('/api/actions/action')
.set('kbn-xsrf', 'foo')
.send({
name: 'A jira action',
@ -171,7 +171,7 @@ export default function jiraTest({ getService }: FtrProviderContext) {
it('should respond with a 400 Bad Request when creating a jira action with a non whitelisted apiUrl', async () => {
await supertest
.post('/api/action')
.post('/api/actions/action')
.set('kbn-xsrf', 'foo')
.send({
name: 'A jira action',
@ -196,7 +196,7 @@ export default function jiraTest({ getService }: FtrProviderContext) {
it('should respond with a 400 Bad Request when creating a jira action without secrets', async () => {
await supertest
.post('/api/action')
.post('/api/actions/action')
.set('kbn-xsrf', 'foo')
.send({
name: 'A jira action',
@ -220,7 +220,7 @@ export default function jiraTest({ getService }: FtrProviderContext) {
it('should respond with a 400 Bad Request when creating a jira action without casesConfiguration', async () => {
await supertest
.post('/api/action')
.post('/api/actions/action')
.set('kbn-xsrf', 'foo')
.send({
name: 'A jira action',
@ -244,7 +244,7 @@ export default function jiraTest({ getService }: FtrProviderContext) {
it('should respond with a 400 Bad Request when creating a jira action with empty mapping', async () => {
await supertest
.post('/api/action')
.post('/api/actions/action')
.set('kbn-xsrf', 'foo')
.send({
name: 'A jira action',
@ -269,7 +269,7 @@ export default function jiraTest({ getService }: FtrProviderContext) {
it('should respond with a 400 Bad Request when creating a jira action with wrong actionType', async () => {
await supertest
.post('/api/action')
.post('/api/actions/action')
.set('kbn-xsrf', 'foo')
.send({
name: 'A jira action',
@ -297,7 +297,7 @@ export default function jiraTest({ getService }: FtrProviderContext) {
let simulatedActionId: string;
before(async () => {
const { body } = await supertest
.post('/api/action')
.post('/api/actions/action')
.set('kbn-xsrf', 'foo')
.send({
name: 'A jira simulator',
@ -315,7 +315,7 @@ export default function jiraTest({ getService }: FtrProviderContext) {
describe('Validation', () => {
it('should handle failing with a simulated success without action', async () => {
await supertest
.post(`/api/action/${simulatedActionId}/_execute`)
.post(`/api/actions/action/${simulatedActionId}/_execute`)
.set('kbn-xsrf', 'foo')
.send({
params: {},
@ -332,7 +332,7 @@ export default function jiraTest({ getService }: FtrProviderContext) {
it('should handle failing with a simulated success without unsupported action', async () => {
await supertest
.post(`/api/action/${simulatedActionId}/_execute`)
.post(`/api/actions/action/${simulatedActionId}/_execute`)
.set('kbn-xsrf', 'foo')
.send({
params: { subAction: 'non-supported' },
@ -350,7 +350,7 @@ export default function jiraTest({ getService }: FtrProviderContext) {
it('should handle failing with a simulated success without subActionParams', async () => {
await supertest
.post(`/api/action/${simulatedActionId}/_execute`)
.post(`/api/actions/action/${simulatedActionId}/_execute`)
.set('kbn-xsrf', 'foo')
.send({
params: { subAction: 'pushToService' },
@ -368,7 +368,7 @@ export default function jiraTest({ getService }: FtrProviderContext) {
it('should handle failing with a simulated success without caseId', async () => {
await supertest
.post(`/api/action/${simulatedActionId}/_execute`)
.post(`/api/actions/action/${simulatedActionId}/_execute`)
.set('kbn-xsrf', 'foo')
.send({
params: { subAction: 'pushToService', subActionParams: {} },
@ -386,7 +386,7 @@ export default function jiraTest({ getService }: FtrProviderContext) {
it('should handle failing with a simulated success without title', async () => {
await supertest
.post(`/api/action/${simulatedActionId}/_execute`)
.post(`/api/actions/action/${simulatedActionId}/_execute`)
.set('kbn-xsrf', 'foo')
.send({
params: {
@ -409,7 +409,7 @@ export default function jiraTest({ getService }: FtrProviderContext) {
it('should handle failing with a simulated success without createdAt', async () => {
await supertest
.post(`/api/action/${simulatedActionId}/_execute`)
.post(`/api/actions/action/${simulatedActionId}/_execute`)
.set('kbn-xsrf', 'foo')
.send({
params: {
@ -433,7 +433,7 @@ export default function jiraTest({ getService }: FtrProviderContext) {
it('should handle failing with a simulated success without commentId', async () => {
await supertest
.post(`/api/action/${simulatedActionId}/_execute`)
.post(`/api/actions/action/${simulatedActionId}/_execute`)
.set('kbn-xsrf', 'foo')
.send({
params: {
@ -461,7 +461,7 @@ export default function jiraTest({ getService }: FtrProviderContext) {
it('should handle failing with a simulated success without comment message', async () => {
await supertest
.post(`/api/action/${simulatedActionId}/_execute`)
.post(`/api/actions/action/${simulatedActionId}/_execute`)
.set('kbn-xsrf', 'foo')
.send({
params: {
@ -489,7 +489,7 @@ export default function jiraTest({ getService }: FtrProviderContext) {
it('should handle failing with a simulated success without comment.createdAt', async () => {
await supertest
.post(`/api/action/${simulatedActionId}/_execute`)
.post(`/api/actions/action/${simulatedActionId}/_execute`)
.set('kbn-xsrf', 'foo')
.send({
params: {
@ -519,7 +519,7 @@ export default function jiraTest({ getService }: FtrProviderContext) {
describe('Execution', () => {
it('should handle creating an incident without comments', async () => {
const { body } = await supertest
.post(`/api/action/${simulatedActionId}/_execute`)
.post(`/api/actions/action/${simulatedActionId}/_execute`)
.set('kbn-xsrf', 'foo')
.send({
params: {

View file

@ -34,7 +34,7 @@ export default function pagerdutyTest({ getService }: FtrProviderContext) {
it('should return successfully when passed valid create parameters', async () => {
const { body: createdAction } = await supertest
.post('/api/action')
.post('/api/actions/action')
.set('kbn-xsrf', 'foo')
.send({
name: 'A pagerduty action',
@ -61,7 +61,7 @@ export default function pagerdutyTest({ getService }: FtrProviderContext) {
expect(typeof createdAction.id).to.be('string');
const { body: fetchedAction } = await supertest
.get(`/api/action/${createdAction.id}`)
.get(`/api/actions/action/${createdAction.id}`)
.expect(200);
expect(fetchedAction).to.eql({
@ -77,7 +77,7 @@ export default function pagerdutyTest({ getService }: FtrProviderContext) {
it('should return unsuccessfully when passed invalid create parameters', async () => {
await supertest
.post('/api/action')
.post('/api/actions/action')
.set('kbn-xsrf', 'foo')
.send({
name: 'A pagerduty action',
@ -100,7 +100,7 @@ export default function pagerdutyTest({ getService }: FtrProviderContext) {
it('should return unsuccessfully when default pagerduty url is not whitelisted', async () => {
await supertest
.post('/api/action')
.post('/api/actions/action')
.set('kbn-xsrf', 'foo')
.send({
name: 'A pagerduty action',
@ -120,7 +120,7 @@ export default function pagerdutyTest({ getService }: FtrProviderContext) {
it('should create pagerduty simulator action successfully', async () => {
const { body: createdSimulatedAction } = await supertest
.post('/api/action')
.post('/api/actions/action')
.set('kbn-xsrf', 'foo')
.send({
name: 'A pagerduty simulator',
@ -139,7 +139,7 @@ export default function pagerdutyTest({ getService }: FtrProviderContext) {
it('should handle executing with a simulated success', async () => {
const { body: result } = await supertest
.post(`/api/action/${simulatedActionId}/_execute`)
.post(`/api/actions/action/${simulatedActionId}/_execute`)
.set('kbn-xsrf', 'foo')
.send({
params: {
@ -160,7 +160,7 @@ export default function pagerdutyTest({ getService }: FtrProviderContext) {
it('should handle a 40x pagerduty error', async () => {
const { body: result } = await supertest
.post(`/api/action/${simulatedActionId}/_execute`)
.post(`/api/actions/action/${simulatedActionId}/_execute`)
.set('kbn-xsrf', 'foo')
.send({
params: {
@ -174,7 +174,7 @@ export default function pagerdutyTest({ getService }: FtrProviderContext) {
it('should handle a 429 pagerduty error', async () => {
const { body: result } = await supertest
.post(`/api/action/${simulatedActionId}/_execute`)
.post(`/api/actions/action/${simulatedActionId}/_execute`)
.set('kbn-xsrf', 'foo')
.send({
params: {
@ -192,7 +192,7 @@ export default function pagerdutyTest({ getService }: FtrProviderContext) {
it('should handle a 500 pagerduty error', async () => {
const { body: result } = await supertest
.post(`/api/action/${simulatedActionId}/_execute`)
.post(`/api/actions/action/${simulatedActionId}/_execute`)
.set('kbn-xsrf', 'foo')
.send({
params: {

View file

@ -20,7 +20,7 @@ export default function serverLogTest({ getService }: FtrProviderContext) {
it('should return 200 when creating a builtin server-log action', async () => {
const { body: createdAction } = await supertest
.post('/api/action')
.post('/api/actions/action')
.set('kbn-xsrf', 'foo')
.send({
name: 'A server.log action',
@ -40,7 +40,7 @@ export default function serverLogTest({ getService }: FtrProviderContext) {
expect(typeof createdAction.id).to.be('string');
const { body: fetchedAction } = await supertest
.get(`/api/action/${createdAction.id}`)
.get(`/api/actions/action/${createdAction.id}`)
.expect(200);
expect(fetchedAction).to.eql({
@ -54,7 +54,7 @@ export default function serverLogTest({ getService }: FtrProviderContext) {
it('should handle firing the action', async () => {
const { body: result } = await supertest
.post(`/api/action/${serverLogActionId}/_execute`)
.post(`/api/actions/action/${serverLogActionId}/_execute`)
.set('kbn-xsrf', 'foo')
.send({
params: {

View file

@ -86,7 +86,7 @@ export default function servicenowTest({ getService }: FtrProviderContext) {
describe('ServiceNow - Action Creation', () => {
it('should return 200 when creating a servicenow action successfully', async () => {
const { body: createdAction } = await supertest
.post('/api/action')
.post('/api/actions/action')
.set('kbn-xsrf', 'foo')
.send({
name: 'A servicenow action',
@ -111,7 +111,7 @@ export default function servicenowTest({ getService }: FtrProviderContext) {
});
const { body: fetchedAction } = await supertest
.get(`/api/action/${createdAction.id}`)
.get(`/api/actions/action/${createdAction.id}`)
.expect(200);
expect(fetchedAction).to.eql({
@ -128,7 +128,7 @@ export default function servicenowTest({ getService }: FtrProviderContext) {
it('should respond with a 400 Bad Request when creating a servicenow action with no apiUrl', async () => {
await supertest
.post('/api/action')
.post('/api/actions/action')
.set('kbn-xsrf', 'foo')
.send({
name: 'A servicenow action',
@ -148,7 +148,7 @@ export default function servicenowTest({ getService }: FtrProviderContext) {
it('should respond with a 400 Bad Request when creating a servicenow action with a non whitelisted apiUrl', async () => {
await supertest
.post('/api/action')
.post('/api/actions/action')
.set('kbn-xsrf', 'foo')
.send({
name: 'A servicenow action',
@ -172,7 +172,7 @@ export default function servicenowTest({ getService }: FtrProviderContext) {
it('should respond with a 400 Bad Request when creating a servicenow action without secrets', async () => {
await supertest
.post('/api/action')
.post('/api/actions/action')
.set('kbn-xsrf', 'foo')
.send({
name: 'A servicenow action',
@ -195,7 +195,7 @@ export default function servicenowTest({ getService }: FtrProviderContext) {
it('should respond with a 400 Bad Request when creating a servicenow action without casesConfiguration', async () => {
await supertest
.post('/api/action')
.post('/api/actions/action')
.set('kbn-xsrf', 'foo')
.send({
name: 'A servicenow action',
@ -218,7 +218,7 @@ export default function servicenowTest({ getService }: FtrProviderContext) {
it('should respond with a 400 Bad Request when creating a servicenow action with empty mapping', async () => {
await supertest
.post('/api/action')
.post('/api/actions/action')
.set('kbn-xsrf', 'foo')
.send({
name: 'A servicenow action',
@ -242,7 +242,7 @@ export default function servicenowTest({ getService }: FtrProviderContext) {
it('should respond with a 400 Bad Request when creating a servicenow action with wrong actionType', async () => {
await supertest
.post('/api/action')
.post('/api/actions/action')
.set('kbn-xsrf', 'foo')
.send({
name: 'A servicenow action',
@ -269,7 +269,7 @@ export default function servicenowTest({ getService }: FtrProviderContext) {
let simulatedActionId: string;
before(async () => {
const { body } = await supertest
.post('/api/action')
.post('/api/actions/action')
.set('kbn-xsrf', 'foo')
.send({
name: 'A servicenow simulator',
@ -286,7 +286,7 @@ export default function servicenowTest({ getService }: FtrProviderContext) {
describe('Validation', () => {
it('should handle failing with a simulated success without action', async () => {
await supertest
.post(`/api/action/${simulatedActionId}/_execute`)
.post(`/api/actions/action/${simulatedActionId}/_execute`)
.set('kbn-xsrf', 'foo')
.send({
params: {},
@ -303,7 +303,7 @@ export default function servicenowTest({ getService }: FtrProviderContext) {
it('should handle failing with a simulated success without unsupported action', async () => {
await supertest
.post(`/api/action/${simulatedActionId}/_execute`)
.post(`/api/actions/action/${simulatedActionId}/_execute`)
.set('kbn-xsrf', 'foo')
.send({
params: { subAction: 'non-supported' },
@ -321,7 +321,7 @@ export default function servicenowTest({ getService }: FtrProviderContext) {
it('should handle failing with a simulated success without subActionParams', async () => {
await supertest
.post(`/api/action/${simulatedActionId}/_execute`)
.post(`/api/actions/action/${simulatedActionId}/_execute`)
.set('kbn-xsrf', 'foo')
.send({
params: { subAction: 'pushToService' },
@ -339,7 +339,7 @@ export default function servicenowTest({ getService }: FtrProviderContext) {
it('should handle failing with a simulated success without caseId', async () => {
await supertest
.post(`/api/action/${simulatedActionId}/_execute`)
.post(`/api/actions/action/${simulatedActionId}/_execute`)
.set('kbn-xsrf', 'foo')
.send({
params: { subAction: 'pushToService', subActionParams: {} },
@ -357,7 +357,7 @@ export default function servicenowTest({ getService }: FtrProviderContext) {
it('should handle failing with a simulated success without title', async () => {
await supertest
.post(`/api/action/${simulatedActionId}/_execute`)
.post(`/api/actions/action/${simulatedActionId}/_execute`)
.set('kbn-xsrf', 'foo')
.send({
params: {
@ -380,7 +380,7 @@ export default function servicenowTest({ getService }: FtrProviderContext) {
it('should handle failing with a simulated success without createdAt', async () => {
await supertest
.post(`/api/action/${simulatedActionId}/_execute`)
.post(`/api/actions/action/${simulatedActionId}/_execute`)
.set('kbn-xsrf', 'foo')
.send({
params: {
@ -404,7 +404,7 @@ export default function servicenowTest({ getService }: FtrProviderContext) {
it('should handle failing with a simulated success without commentId', async () => {
await supertest
.post(`/api/action/${simulatedActionId}/_execute`)
.post(`/api/actions/action/${simulatedActionId}/_execute`)
.set('kbn-xsrf', 'foo')
.send({
params: {
@ -432,7 +432,7 @@ export default function servicenowTest({ getService }: FtrProviderContext) {
it('should handle failing with a simulated success without comment message', async () => {
await supertest
.post(`/api/action/${simulatedActionId}/_execute`)
.post(`/api/actions/action/${simulatedActionId}/_execute`)
.set('kbn-xsrf', 'foo')
.send({
params: {
@ -460,7 +460,7 @@ export default function servicenowTest({ getService }: FtrProviderContext) {
it('should handle failing with a simulated success without comment.createdAt', async () => {
await supertest
.post(`/api/action/${simulatedActionId}/_execute`)
.post(`/api/actions/action/${simulatedActionId}/_execute`)
.set('kbn-xsrf', 'foo')
.send({
params: {
@ -490,7 +490,7 @@ export default function servicenowTest({ getService }: FtrProviderContext) {
describe('Execution', () => {
it('should handle creating an incident without comments', async () => {
const { body: result } = await supertest
.post(`/api/action/${simulatedActionId}/_execute`)
.post(`/api/actions/action/${simulatedActionId}/_execute`)
.set('kbn-xsrf', 'foo')
.send({
params: {

View file

@ -34,7 +34,7 @@ export default function slackTest({ getService }: FtrProviderContext) {
it('should return 200 when creating a slack action successfully', async () => {
const { body: createdAction } = await supertest
.post('/api/action')
.post('/api/actions/action')
.set('kbn-xsrf', 'foo')
.send({
name: 'A slack action',
@ -56,7 +56,7 @@ export default function slackTest({ getService }: FtrProviderContext) {
expect(typeof createdAction.id).to.be('string');
const { body: fetchedAction } = await supertest
.get(`/api/action/${createdAction.id}`)
.get(`/api/actions/action/${createdAction.id}`)
.expect(200);
expect(fetchedAction).to.eql({
@ -70,7 +70,7 @@ export default function slackTest({ getService }: FtrProviderContext) {
it('should respond with a 400 Bad Request when creating a slack action with no webhookUrl', async () => {
await supertest
.post('/api/action')
.post('/api/actions/action')
.set('kbn-xsrf', 'foo')
.send({
name: 'A slack action',
@ -90,7 +90,7 @@ export default function slackTest({ getService }: FtrProviderContext) {
it('should respond with a 400 Bad Request when creating a slack action with a non whitelisted webhookUrl', async () => {
await supertest
.post('/api/action')
.post('/api/actions/action')
.set('kbn-xsrf', 'foo')
.send({
name: 'A slack action',
@ -112,7 +112,7 @@ export default function slackTest({ getService }: FtrProviderContext) {
it('should respond with a 400 Bad Request when creating a slack action with a webhookUrl with no hostname', async () => {
await supertest
.post('/api/action')
.post('/api/actions/action')
.set('kbn-xsrf', 'foo')
.send({
name: 'A slack action',
@ -134,7 +134,7 @@ export default function slackTest({ getService }: FtrProviderContext) {
it('should create our slack simulator action successfully', async () => {
const { body: createdSimulatedAction } = await supertest
.post('/api/action')
.post('/api/actions/action')
.set('kbn-xsrf', 'foo')
.send({
name: 'A slack simulator',
@ -150,7 +150,7 @@ export default function slackTest({ getService }: FtrProviderContext) {
it('should handle firing with a simulated success', async () => {
const { body: result } = await supertest
.post(`/api/action/${simulatedActionId}/_execute`)
.post(`/api/actions/action/${simulatedActionId}/_execute`)
.set('kbn-xsrf', 'foo')
.send({
params: {
@ -163,7 +163,7 @@ export default function slackTest({ getService }: FtrProviderContext) {
it('should handle an empty message error', async () => {
const { body: result } = await supertest
.post(`/api/action/${simulatedActionId}/_execute`)
.post(`/api/actions/action/${simulatedActionId}/_execute`)
.set('kbn-xsrf', 'foo')
.send({
params: {
@ -177,7 +177,7 @@ export default function slackTest({ getService }: FtrProviderContext) {
it('should handle a 40x slack error', async () => {
const { body: result } = await supertest
.post(`/api/action/${simulatedActionId}/_execute`)
.post(`/api/actions/action/${simulatedActionId}/_execute`)
.set('kbn-xsrf', 'foo')
.send({
params: {
@ -192,7 +192,7 @@ export default function slackTest({ getService }: FtrProviderContext) {
it('should handle a 429 slack error', async () => {
const dateStart = new Date().getTime();
const { body: result } = await supertest
.post(`/api/action/${simulatedActionId}/_execute`)
.post(`/api/actions/action/${simulatedActionId}/_execute`)
.set('kbn-xsrf', 'foo')
.send({
params: {
@ -210,7 +210,7 @@ export default function slackTest({ getService }: FtrProviderContext) {
it('should handle a 500 slack error', async () => {
const { body: result } = await supertest
.post(`/api/action/${simulatedActionId}/_execute`)
.post(`/api/actions/action/${simulatedActionId}/_execute`)
.set('kbn-xsrf', 'foo')
.send({
params: {

View file

@ -45,7 +45,7 @@ export default function webhookTest({ getService }: FtrProviderContext) {
};
const { body: createdAction } = await supertest
.post('/api/action')
.post('/api/actions/action')
.set('kbn-xsrf', 'test')
.send({
name: 'A generic Webhook action',
@ -75,7 +75,7 @@ export default function webhookTest({ getService }: FtrProviderContext) {
it('should return 200 when creating a webhook action successfully', async () => {
const { body: createdAction } = await supertest
.post('/api/action')
.post('/api/actions/action')
.set('kbn-xsrf', 'test')
.send({
name: 'A generic Webhook action',
@ -104,7 +104,7 @@ export default function webhookTest({ getService }: FtrProviderContext) {
expect(typeof createdAction.id).to.be('string');
const { body: fetchedAction } = await supertest
.get(`/api/action/${createdAction.id}`)
.get(`/api/actions/action/${createdAction.id}`)
.expect(200);
expect(fetchedAction).to.eql({
@ -122,7 +122,7 @@ export default function webhookTest({ getService }: FtrProviderContext) {
it('should send authentication to the webhook target', async () => {
const webhookActionId = await createWebhookAction(webhookSimulatorURL);
const { body: result } = await supertest
.post(`/api/action/${webhookActionId}/_execute`)
.post(`/api/actions/action/${webhookActionId}/_execute`)
.set('kbn-xsrf', 'test')
.send({
params: {
@ -137,7 +137,7 @@ export default function webhookTest({ getService }: FtrProviderContext) {
it('should support the POST method against webhook target', async () => {
const webhookActionId = await createWebhookAction(webhookSimulatorURL, { method: 'post' });
const { body: result } = await supertest
.post(`/api/action/${webhookActionId}/_execute`)
.post(`/api/actions/action/${webhookActionId}/_execute`)
.set('kbn-xsrf', 'test')
.send({
params: {
@ -152,7 +152,7 @@ export default function webhookTest({ getService }: FtrProviderContext) {
it('should support the PUT method against webhook target', async () => {
const webhookActionId = await createWebhookAction(webhookSimulatorURL, { method: 'put' });
const { body: result } = await supertest
.post(`/api/action/${webhookActionId}/_execute`)
.post(`/api/actions/action/${webhookActionId}/_execute`)
.set('kbn-xsrf', 'test')
.send({
params: {
@ -166,7 +166,7 @@ export default function webhookTest({ getService }: FtrProviderContext) {
it('should handle target webhooks that are not whitelisted', async () => {
const { body: result } = await supertest
.post('/api/action')
.post('/api/actions/action')
.set('kbn-xsrf', 'test')
.send({
name: 'A generic Webhook action',
@ -188,7 +188,7 @@ export default function webhookTest({ getService }: FtrProviderContext) {
it('should handle unreachable webhook targets', async () => {
const webhookActionId = await createWebhookAction('http://some.non.existent.com/endpoint');
const { body: result } = await supertest
.post(`/api/action/${webhookActionId}/_execute`)
.post(`/api/actions/action/${webhookActionId}/_execute`)
.set('kbn-xsrf', 'test')
.send({
params: {
@ -204,7 +204,7 @@ export default function webhookTest({ getService }: FtrProviderContext) {
it('should handle failing webhook targets', async () => {
const webhookActionId = await createWebhookAction(webhookSimulatorURL);
const { body: result } = await supertest
.post(`/api/action/${webhookActionId}/_execute`)
.post(`/api/actions/action/${webhookActionId}/_execute`)
.set('kbn-xsrf', 'test')
.send({
params: {

View file

@ -24,7 +24,7 @@ export default function createActionTests({ getService }: FtrProviderContext) {
describe(scenario.id, () => {
it('should handle create action request appropriately', async () => {
const response = await supertestWithoutAuth
.post(`${getUrlPrefix(space.id)}/api/action`)
.post(`${getUrlPrefix(space.id)}/api/actions/action`)
.auth(user.username, user.password)
.set('kbn-xsrf', 'foo')
.send({
@ -52,7 +52,7 @@ export default function createActionTests({ getService }: FtrProviderContext) {
case 'superuser at space1':
case 'space_1_all at space1':
expect(response.statusCode).to.eql(200);
objectRemover.add(space.id, response.body.id, 'action');
objectRemover.add(space.id, response.body.id, 'action', 'actions');
expect(response.body).to.eql({
id: response.body.id,
isPreconfigured: false,
@ -78,7 +78,7 @@ export default function createActionTests({ getService }: FtrProviderContext) {
it(`should handle create action request appropriately when action type isn't registered`, async () => {
const response = await supertestWithoutAuth
.post(`${getUrlPrefix(space.id)}/api/action`)
.post(`${getUrlPrefix(space.id)}/api/actions/action`)
.set('kbn-xsrf', 'foo')
.auth(user.username, user.password)
.send({
@ -114,7 +114,7 @@ export default function createActionTests({ getService }: FtrProviderContext) {
it('should handle create action request appropriately when payload is empty and invalid', async () => {
const response = await supertestWithoutAuth
.post(`${getUrlPrefix(space.id)}/api/action`)
.post(`${getUrlPrefix(space.id)}/api/actions/action`)
.set('kbn-xsrf', 'foo')
.auth(user.username, user.password)
.send({});
@ -146,7 +146,7 @@ export default function createActionTests({ getService }: FtrProviderContext) {
it(`should handle create action request appropriately when config isn't valid`, async () => {
const response = await supertestWithoutAuth
.post(`${getUrlPrefix(space.id)}/api/action`)
.post(`${getUrlPrefix(space.id)}/api/actions/action`)
.set('kbn-xsrf', 'foo')
.auth(user.username, user.password)
.send({
@ -185,7 +185,7 @@ export default function createActionTests({ getService }: FtrProviderContext) {
it(`should handle create action requests for action types that are not enabled`, async () => {
const response = await supertestWithoutAuth
.post(`${getUrlPrefix(space.id)}/api/action`)
.post(`${getUrlPrefix(space.id)}/api/actions/action`)
.set('kbn-xsrf', 'foo')
.auth(user.username, user.password)
.send({

View file

@ -25,7 +25,7 @@ export default function deleteActionTests({ getService }: FtrProviderContext) {
describe(scenario.id, () => {
it('should handle delete action request appropriately', async () => {
const { body: createdAction } = await supertest
.post(`${getUrlPrefix(space.id)}/api/action`)
.post(`${getUrlPrefix(space.id)}/api/actions/action`)
.set('kbn-xsrf', 'foo')
.send({
name: 'My action',
@ -40,7 +40,7 @@ export default function deleteActionTests({ getService }: FtrProviderContext) {
.expect(200);
const response = await supertestWithoutAuth
.delete(`${getUrlPrefix(space.id)}/api/action/${createdAction.id}`)
.delete(`${getUrlPrefix(space.id)}/api/actions/action/${createdAction.id}`)
.auth(user.username, user.password)
.set('kbn-xsrf', 'foo');
@ -54,7 +54,7 @@ export default function deleteActionTests({ getService }: FtrProviderContext) {
error: 'Not Found',
message: 'Not Found',
});
objectRemover.add(space.id, createdAction.id, 'action');
objectRemover.add(space.id, createdAction.id, 'action', 'actions');
break;
case 'superuser at space1':
case 'space_1_all at space1':
@ -68,7 +68,7 @@ export default function deleteActionTests({ getService }: FtrProviderContext) {
it(`shouldn't delete action from another space`, async () => {
const { body: createdAction } = await supertest
.post(`${getUrlPrefix(space.id)}/api/action`)
.post(`${getUrlPrefix(space.id)}/api/actions/action`)
.set('kbn-xsrf', 'foo')
.send({
name: 'My action',
@ -81,10 +81,10 @@ export default function deleteActionTests({ getService }: FtrProviderContext) {
},
})
.expect(200);
objectRemover.add(space.id, createdAction.id, 'action');
objectRemover.add(space.id, createdAction.id, 'action', 'actions');
const response = await supertestWithoutAuth
.delete(`${getUrlPrefix('other')}/api/action/${createdAction.id}`)
.delete(`${getUrlPrefix('other')}/api/actions/action/${createdAction.id}`)
.auth(user.username, user.password)
.set('kbn-xsrf', 'foo');
@ -114,7 +114,7 @@ export default function deleteActionTests({ getService }: FtrProviderContext) {
it(`should handle delete request appropriately when action doesn't exist`, async () => {
const response = await supertestWithoutAuth
.delete(`${getUrlPrefix(space.id)}/api/action/2`)
.delete(`${getUrlPrefix(space.id)}/api/actions/action/2`)
.set('kbn-xsrf', 'foo')
.auth(user.username, user.password);
@ -140,7 +140,7 @@ export default function deleteActionTests({ getService }: FtrProviderContext) {
it(`shouldn't delete action from preconfigured list`, async () => {
const response = await supertestWithoutAuth
.delete(`${getUrlPrefix(space.id)}/api/action/my-slack1`)
.delete(`${getUrlPrefix(space.id)}/api/actions/action/my-slack1`)
.auth(user.username, user.password)
.set('kbn-xsrf', 'foo');

View file

@ -43,7 +43,7 @@ export default function ({ getService }: FtrProviderContext) {
describe(scenario.id, () => {
it('should handle execute request appropriately', async () => {
const { body: createdAction } = await supertest
.post(`${getUrlPrefix(space.id)}/api/action`)
.post(`${getUrlPrefix(space.id)}/api/actions/action`)
.set('kbn-xsrf', 'foo')
.send({
name: 'My action',
@ -56,11 +56,11 @@ export default function ({ getService }: FtrProviderContext) {
},
})
.expect(200);
objectRemover.add(space.id, createdAction.id, 'action');
objectRemover.add(space.id, createdAction.id, 'action', 'actions');
const reference = `actions-execute-1:${user.username}`;
const response = await supertestWithoutAuth
.post(`${getUrlPrefix(space.id)}/api/action/${createdAction.id}/_execute`)
.post(`${getUrlPrefix(space.id)}/api/actions/action/${createdAction.id}/_execute`)
.auth(user.username, user.password)
.set('kbn-xsrf', 'foo')
.send({
@ -115,7 +115,7 @@ export default function ({ getService }: FtrProviderContext) {
it(`shouldn't execute an action from another space`, async () => {
const { body: createdAction } = await supertest
.post(`${getUrlPrefix(space.id)}/api/action`)
.post(`${getUrlPrefix(space.id)}/api/actions/action`)
.set('kbn-xsrf', 'foo')
.send({
name: 'My action',
@ -128,11 +128,11 @@ export default function ({ getService }: FtrProviderContext) {
},
})
.expect(200);
objectRemover.add(space.id, createdAction.id, 'action');
objectRemover.add(space.id, createdAction.id, 'action', 'actions');
const reference = `actions-execute-4:${user.username}`;
const response = await supertestWithoutAuth
.post(`${getUrlPrefix('other')}/api/action/${createdAction.id}/_execute`)
.post(`${getUrlPrefix('other')}/api/actions/action/${createdAction.id}/_execute`)
.auth(user.username, user.password)
.set('kbn-xsrf', 'foo')
.send({
@ -169,7 +169,7 @@ export default function ({ getService }: FtrProviderContext) {
it('should handle execute request appropriately after action is updated', async () => {
const { body: createdAction } = await supertest
.post(`${getUrlPrefix(space.id)}/api/action`)
.post(`${getUrlPrefix(space.id)}/api/actions/action`)
.set('kbn-xsrf', 'foo')
.send({
name: 'My action',
@ -182,10 +182,10 @@ export default function ({ getService }: FtrProviderContext) {
},
})
.expect(200);
objectRemover.add(space.id, createdAction.id, 'action');
objectRemover.add(space.id, createdAction.id, 'action', 'actions');
await supertest
.put(`${getUrlPrefix(space.id)}/api/action/${createdAction.id}`)
.put(`${getUrlPrefix(space.id)}/api/actions/action/${createdAction.id}`)
.set('kbn-xsrf', 'foo')
.send({
name: 'My action updated',
@ -200,7 +200,7 @@ export default function ({ getService }: FtrProviderContext) {
const reference = `actions-execute-2:${user.username}`;
const response = await supertestWithoutAuth
.post(`${getUrlPrefix(space.id)}/api/action/${createdAction.id}/_execute`)
.post(`${getUrlPrefix(space.id)}/api/actions/action/${createdAction.id}/_execute`)
.auth(user.username, user.password)
.set('kbn-xsrf', 'foo')
.send({
@ -255,7 +255,7 @@ export default function ({ getService }: FtrProviderContext) {
it(`should handle execute request appropriately when action doesn't exist`, async () => {
const response = await supertestWithoutAuth
.post(`${getUrlPrefix(space.id)}/api/action/1/_execute`)
.post(`${getUrlPrefix(space.id)}/api/actions/action/1/_execute`)
.auth(user.username, user.password)
.set('kbn-xsrf', 'foo')
.send({
@ -289,7 +289,7 @@ export default function ({ getService }: FtrProviderContext) {
it('should handle execute request appropriately when payload is empty and invalid', async () => {
const response = await supertestWithoutAuth
.post(`${getUrlPrefix(space.id)}/api/action/1/_execute`)
.post(`${getUrlPrefix(space.id)}/api/actions/action/1/_execute`)
.auth(user.username, user.password)
.set('kbn-xsrf', 'foo')
.send({});
@ -322,7 +322,7 @@ export default function ({ getService }: FtrProviderContext) {
it('should handle execute request appropriately after changing config properties', async () => {
const { body: createdAction } = await supertest
.post(`${getUrlPrefix(space.id)}/api/action`)
.post(`${getUrlPrefix(space.id)}/api/actions/action`)
.set('kbn-xsrf', 'foo')
.send({
name: 'test email action',
@ -340,10 +340,10 @@ export default function ({ getService }: FtrProviderContext) {
},
})
.expect(200);
objectRemover.add(space.id, createdAction.id, 'action');
objectRemover.add(space.id, createdAction.id, 'action', 'actions');
await supertest
.put(`${getUrlPrefix(space.id)}/api/action/${createdAction.id}`)
.put(`${getUrlPrefix(space.id)}/api/actions/action/${createdAction.id}`)
.set('kbn-xsrf', 'foo')
.send({
name: 'a test email action 2',
@ -359,7 +359,7 @@ export default function ({ getService }: FtrProviderContext) {
.expect(200);
const response = await supertestWithoutAuth
.post(`${getUrlPrefix(space.id)}/api/action/${createdAction.id}/_execute`)
.post(`${getUrlPrefix(space.id)}/api/actions/action/${createdAction.id}/_execute`)
.auth(user.username, user.password)
.set('kbn-xsrf', 'foo')
.send({
@ -395,17 +395,17 @@ export default function ({ getService }: FtrProviderContext) {
let searchResult: any;
const reference = `actions-execute-3:${user.username}`;
const { body: createdAction } = await supertest
.post(`${getUrlPrefix(space.id)}/api/action`)
.post(`${getUrlPrefix(space.id)}/api/actions/action`)
.set('kbn-xsrf', 'foo')
.send({
name: 'My action',
actionTypeId: 'test.authorization',
})
.expect(200);
objectRemover.add(space.id, createdAction.id, 'action');
objectRemover.add(space.id, createdAction.id, 'action', 'actions');
const response = await supertestWithoutAuth
.post(`${getUrlPrefix(space.id)}/api/action/${createdAction.id}/_execute`)
.post(`${getUrlPrefix(space.id)}/api/actions/action/${createdAction.id}/_execute`)
.auth(user.username, user.password)
.set('kbn-xsrf', 'foo')
.send({

View file

@ -24,7 +24,7 @@ export default function getActionTests({ getService }: FtrProviderContext) {
describe(scenario.id, () => {
it('should handle get action request appropriately', async () => {
const { body: createdAction } = await supertest
.post(`${getUrlPrefix(space.id)}/api/action`)
.post(`${getUrlPrefix(space.id)}/api/actions/action`)
.set('kbn-xsrf', 'foo')
.send({
name: 'My action',
@ -37,10 +37,10 @@ export default function getActionTests({ getService }: FtrProviderContext) {
},
})
.expect(200);
objectRemover.add(space.id, createdAction.id, 'action');
objectRemover.add(space.id, createdAction.id, 'action', 'actions');
const response = await supertestWithoutAuth
.get(`${getUrlPrefix(space.id)}/api/action/${createdAction.id}`)
.get(`${getUrlPrefix(space.id)}/api/actions/action/${createdAction.id}`)
.auth(user.username, user.password);
switch (scenario.id) {
@ -74,7 +74,7 @@ export default function getActionTests({ getService }: FtrProviderContext) {
it(`action shouldn't be acessible from another space`, async () => {
const { body: createdAction } = await supertest
.post(`${getUrlPrefix(space.id)}/api/action`)
.post(`${getUrlPrefix(space.id)}/api/actions/action`)
.set('kbn-xsrf', 'foo')
.send({
name: 'My action',
@ -87,10 +87,10 @@ export default function getActionTests({ getService }: FtrProviderContext) {
},
})
.expect(200);
objectRemover.add(space.id, createdAction.id, 'action');
objectRemover.add(space.id, createdAction.id, 'action', 'actions');
const response = await supertestWithoutAuth
.get(`${getUrlPrefix('other')}/api/action/${createdAction.id}`)
.get(`${getUrlPrefix('other')}/api/actions/action/${createdAction.id}`)
.auth(user.username, user.password);
expect(response.statusCode).to.eql(404);
@ -119,7 +119,7 @@ export default function getActionTests({ getService }: FtrProviderContext) {
it('should handle get preconfigured action request appropriately', async () => {
const response = await supertestWithoutAuth
.get(`${getUrlPrefix(space.id)}/api/action/my-slack1`)
.get(`${getUrlPrefix(space.id)}/api/actions/action/my-slack1`)
.auth(user.username, user.password);
switch (scenario.id) {

View file

@ -24,7 +24,7 @@ export default function getAllActionTests({ getService }: FtrProviderContext) {
describe(scenario.id, () => {
it('should handle get all action request appropriately', async () => {
const { body: createdAction } = await supertest
.post(`${getUrlPrefix(space.id)}/api/action`)
.post(`${getUrlPrefix(space.id)}/api/actions/action`)
.set('kbn-xsrf', 'foo')
.send({
name: 'My action',
@ -37,10 +37,10 @@ export default function getAllActionTests({ getService }: FtrProviderContext) {
},
})
.expect(200);
objectRemover.add(space.id, createdAction.id, 'action');
objectRemover.add(space.id, createdAction.id, 'action', 'actions');
const response = await supertestWithoutAuth
.get(`${getUrlPrefix(space.id)}/api/action/_getAll`)
.get(`${getUrlPrefix(space.id)}/api/actions`)
.auth(user.username, user.password);
switch (scenario.id) {
@ -105,7 +105,7 @@ export default function getAllActionTests({ getService }: FtrProviderContext) {
it('should handle get all request appropriately with proper referencedByCount', async () => {
const { body: createdAction } = await supertest
.post(`${getUrlPrefix(space.id)}/api/action`)
.post(`${getUrlPrefix(space.id)}/api/actions/action`)
.set('kbn-xsrf', 'foo')
.send({
name: 'My action',
@ -118,7 +118,7 @@ export default function getAllActionTests({ getService }: FtrProviderContext) {
},
})
.expect(200);
objectRemover.add(space.id, createdAction.id, 'action');
objectRemover.add(space.id, createdAction.id, 'action', 'actions');
const { body: createdAlert } = await supertest
.post(`${getUrlPrefix(space.id)}/api/alert`)
@ -142,10 +142,10 @@ export default function getAllActionTests({ getService }: FtrProviderContext) {
})
)
.expect(200);
objectRemover.add(space.id, createdAlert.id, 'alert');
objectRemover.add(space.id, createdAlert.id, 'alert', undefined);
const response = await supertestWithoutAuth
.get(`${getUrlPrefix(space.id)}/api/action/_getAll`)
.get(`${getUrlPrefix(space.id)}/api/actions`)
.auth(user.username, user.password);
switch (scenario.id) {
@ -210,7 +210,7 @@ export default function getAllActionTests({ getService }: FtrProviderContext) {
it(`shouldn't get actions from another space`, async () => {
const { body: createdAction } = await supertest
.post(`${getUrlPrefix(space.id)}/api/action`)
.post(`${getUrlPrefix(space.id)}/api/actions/action`)
.set('kbn-xsrf', 'foo')
.send({
name: 'My action',
@ -223,10 +223,10 @@ export default function getAllActionTests({ getService }: FtrProviderContext) {
},
})
.expect(200);
objectRemover.add(space.id, createdAction.id, 'action');
objectRemover.add(space.id, createdAction.id, 'action', 'actions');
const response = await supertestWithoutAuth
.get(`${getUrlPrefix('other')}/api/action/_getAll`)
.get(`${getUrlPrefix('other')}/api/actions`)
.auth(user.username, user.password);
switch (scenario.id) {

View file

@ -19,7 +19,7 @@ export default function listActionTypesTests({ getService }: FtrProviderContext)
describe(scenario.id, () => {
it('should return 200 with list of action types containing defaults', async () => {
const response = await supertestWithoutAuth
.get(`${getUrlPrefix(space.id)}/api/action/types`)
.get(`${getUrlPrefix(space.id)}/api/actions/list_action_types`)
.auth(user.username, user.password);
function createActionTypeMatcher(id: string, name: string) {

View file

@ -15,7 +15,7 @@ if (require.main === module) main();
async function main() {
let response;
response = await httpPost('api/action', {
response = await httpPost('api/actions/action', {
actionTypeId: '.email',
name: 'an email action',
config: {
@ -33,10 +33,10 @@ async function main() {
const actionId = response.id;
response = await httpGet(`api/action/${actionId}`);
response = await httpGet(`api/actions/${actionId}`);
console.log(`action after create: ${JSON.stringify(response, null, 4)}`);
response = await httpPut(`api/action/${actionId}`, {
response = await httpPut(`api/actions/action/${actionId}`, {
name: 'an email action',
config: {
from: 'patrick.mueller@elastic.co',
@ -50,10 +50,10 @@ async function main() {
console.log(`response from update: ${JSON.stringify(response, null, 4)}`);
response = await httpGet(`api/action/${actionId}`);
response = await httpGet(`api/actions/${actionId}`);
console.log(`action after update: ${JSON.stringify(response, null, 4)}`);
response = await httpPost(`api/action/${actionId}/_execute`, {
response = await httpPost(`api/actions/action/${actionId}/_execute`, {
params: {
to: ['patrick.mueller@elastic.co'],
subject: 'the email subject',

View file

@ -24,7 +24,7 @@ export default function updateActionTests({ getService }: FtrProviderContext) {
describe(scenario.id, () => {
it('should handle update action request appropriately', async () => {
const { body: createdAction } = await supertest
.post(`${getUrlPrefix(space.id)}/api/action`)
.post(`${getUrlPrefix(space.id)}/api/actions/action`)
.set('kbn-xsrf', 'foo')
.send({
name: 'My action',
@ -37,10 +37,10 @@ export default function updateActionTests({ getService }: FtrProviderContext) {
},
})
.expect(200);
objectRemover.add(space.id, createdAction.id, 'action');
objectRemover.add(space.id, createdAction.id, 'action', 'actions');
const response = await supertestWithoutAuth
.put(`${getUrlPrefix(space.id)}/api/action/${createdAction.id}`)
.put(`${getUrlPrefix(space.id)}/api/actions/action/${createdAction.id}`)
.auth(user.username, user.password)
.set('kbn-xsrf', 'foo')
.send({
@ -91,7 +91,7 @@ export default function updateActionTests({ getService }: FtrProviderContext) {
it(`shouldn't update action from another space`, async () => {
const { body: createdAction } = await supertest
.post(`${getUrlPrefix(space.id)}/api/action`)
.post(`${getUrlPrefix(space.id)}/api/actions/action`)
.set('kbn-xsrf', 'foo')
.send({
name: 'My action',
@ -104,10 +104,10 @@ export default function updateActionTests({ getService }: FtrProviderContext) {
},
})
.expect(200);
objectRemover.add(space.id, createdAction.id, 'action');
objectRemover.add(space.id, createdAction.id, 'action', 'actions');
const response = await supertestWithoutAuth
.put(`${getUrlPrefix('other')}/api/action/${createdAction.id}`)
.put(`${getUrlPrefix('other')}/api/actions/action/${createdAction.id}`)
.auth(user.username, user.password)
.set('kbn-xsrf', 'foo')
.send({
@ -146,7 +146,7 @@ export default function updateActionTests({ getService }: FtrProviderContext) {
it('should handle update action request appropriately when passing a null config', async () => {
const response = await supertestWithoutAuth
.put(`${getUrlPrefix(space.id)}/api/action/1`)
.put(`${getUrlPrefix(space.id)}/api/actions/action/1`)
.set('kbn-xsrf', 'foo')
.auth(user.username, user.password)
.send({
@ -181,7 +181,7 @@ export default function updateActionTests({ getService }: FtrProviderContext) {
it(`should handle update action request appropriately when action doesn't exist`, async () => {
const response = await supertestWithoutAuth
.put(`${getUrlPrefix(space.id)}/api/action/1`)
.put(`${getUrlPrefix(space.id)}/api/actions/action/1`)
.set('kbn-xsrf', 'foo')
.auth(user.username, user.password)
.send({
@ -221,7 +221,7 @@ export default function updateActionTests({ getService }: FtrProviderContext) {
it('should handle update action request appropriately when payload is empty and invalid', async () => {
const response = await supertestWithoutAuth
.put(`${getUrlPrefix(space.id)}/api/action/1`)
.put(`${getUrlPrefix(space.id)}/api/actions/action/1`)
.set('kbn-xsrf', 'foo')
.auth(user.username, user.password)
.send({});
@ -254,7 +254,7 @@ export default function updateActionTests({ getService }: FtrProviderContext) {
it('should handle update action request appropriately when secrets are not valid', async () => {
const { body: createdAction } = await supertest
.post(`${getUrlPrefix(space.id)}/api/action`)
.post(`${getUrlPrefix(space.id)}/api/actions/action`)
.set('kbn-xsrf', 'foo')
.send({
name: 'My action',
@ -267,10 +267,10 @@ export default function updateActionTests({ getService }: FtrProviderContext) {
},
})
.expect(200);
objectRemover.add(space.id, createdAction.id, 'action');
objectRemover.add(space.id, createdAction.id, 'action', 'actions');
const response = await supertestWithoutAuth
.put(`${getUrlPrefix(space.id)}/api/action/${createdAction.id}`)
.put(`${getUrlPrefix(space.id)}/api/actions/action/${createdAction.id}`)
.set('kbn-xsrf', 'foo')
.auth(user.username, user.password)
.send({
@ -311,7 +311,7 @@ export default function updateActionTests({ getService }: FtrProviderContext) {
it(`shouldn't update action from preconfigured list`, async () => {
const response = await supertestWithoutAuth
.put(`${getUrlPrefix(space.id)}/api/action/custom-system-abc-connector`)
.put(`${getUrlPrefix(space.id)}/api/actions/action/custom-system-abc-connector`)
.auth(user.username, user.password)
.set('kbn-xsrf', 'foo')
.send({

View file

@ -50,7 +50,7 @@ export default function alertTests({ getService }: FtrProviderContext) {
before(async () => {
const { body: createdAction } = await supertest
.post(`${getUrlPrefix(space.id)}/api/action`)
.post(`${getUrlPrefix(space.id)}/api/actions/action`)
.set('kbn-xsrf', 'foo')
.send({
name: 'My action',
@ -72,7 +72,7 @@ export default function alertTests({ getService }: FtrProviderContext) {
objectRemover,
});
});
after(() => objectRemover.add(space.id, indexRecordActionId, 'action'));
after(() => objectRemover.add(space.id, indexRecordActionId, 'action', 'actions'));
it('should schedule task, run alert and schedule actions when appropriate', async () => {
const testStart = new Date();
@ -324,7 +324,7 @@ instanceStateValue: true
const retryDate = new Date(Date.now() + 60000);
const { body: createdAction } = await supertest
.post(`${getUrlPrefix(space.id)}/api/action`)
.post(`${getUrlPrefix(space.id)}/api/actions/action`)
.set('kbn-xsrf', 'foo')
.send({
name: 'Test rate limit',
@ -332,7 +332,7 @@ instanceStateValue: true
config: {},
})
.expect(200);
objectRemover.add(space.id, createdAction.id, 'action');
objectRemover.add(space.id, createdAction.id, 'action', 'actions');
const reference = alertUtils.generateReference();
const response = await supertestWithoutAuth
@ -374,7 +374,7 @@ instanceStateValue: true
case 'superuser at space1':
case 'space_1_all at space1':
expect(response.statusCode).to.eql(200);
objectRemover.add(space.id, response.body.id, 'alert');
objectRemover.add(space.id, response.body.id, 'alert', undefined);
// Wait for the task to be attempted once and idle
const scheduledActionTask = await retry.try(async () => {
@ -457,7 +457,7 @@ instanceStateValue: true
break;
case 'space_1_all at space1':
expect(response.statusCode).to.eql(200);
objectRemover.add(space.id, response.body.id, 'alert');
objectRemover.add(space.id, response.body.id, 'alert', undefined);
// Wait for test.authorization to index a document before disabling the alert and waiting for tasks to finish
await esTestIndexTool.waitForDocs('alert:test.authorization', reference);
@ -490,7 +490,7 @@ instanceStateValue: true
break;
case 'superuser at space1':
expect(response.statusCode).to.eql(200);
objectRemover.add(space.id, response.body.id, 'alert');
objectRemover.add(space.id, response.body.id, 'alert', undefined);
// Wait for test.authorization to index a document before disabling the alert and waiting for tasks to finish
await esTestIndexTool.waitForDocs('alert:test.authorization', reference);
@ -523,14 +523,14 @@ instanceStateValue: true
const testStart = new Date();
const reference = alertUtils.generateReference();
const { body: createdAction } = await supertest
.post(`${getUrlPrefix(space.id)}/api/action`)
.post(`${getUrlPrefix(space.id)}/api/actions/action`)
.set('kbn-xsrf', 'foo')
.send({
name: 'My action',
actionTypeId: 'test.authorization',
})
.expect(200);
objectRemover.add(space.id, createdAction.id, 'action');
objectRemover.add(space.id, createdAction.id, 'action', 'actions');
const response = await supertestWithoutAuth
.post(`${getUrlPrefix(space.id)}/api/alert`)
.set('kbn-xsrf', 'foo')
@ -571,7 +571,7 @@ instanceStateValue: true
break;
case 'space_1_all at space1':
expect(response.statusCode).to.eql(200);
objectRemover.add(space.id, response.body.id, 'alert');
objectRemover.add(space.id, response.body.id, 'alert', undefined);
// Ensure test.authorization indexed 1 document before disabling the alert and waiting for tasks to finish
await esTestIndexTool.waitForDocs('action:test.authorization', reference);
@ -604,7 +604,7 @@ instanceStateValue: true
break;
case 'superuser at space1':
expect(response.statusCode).to.eql(200);
objectRemover.add(space.id, response.body.id, 'alert');
objectRemover.add(space.id, response.body.id, 'alert', undefined);
// Ensure test.authorization indexed 1 document before disabling the alert and waiting for tasks to finish
await esTestIndexTool.waitForDocs('action:test.authorization', reference);

View file

@ -32,7 +32,7 @@ export default function createAlertTests({ getService }: FtrProviderContext) {
describe(scenario.id, () => {
it('should handle create alert request appropriately', async () => {
const { body: createdAction } = await supertest
.post(`${getUrlPrefix(space.id)}/api/action`)
.post(`${getUrlPrefix(space.id)}/api/actions/action`)
.set('kbn-xsrf', 'foo')
.send({
name: 'MY action',
@ -72,7 +72,7 @@ export default function createAlertTests({ getService }: FtrProviderContext) {
case 'superuser at space1':
case 'space_1_all at space1':
expect(response.statusCode).to.eql(200);
objectRemover.add(space.id, response.body.id, 'alert');
objectRemover.add(space.id, response.body.id, 'alert', undefined);
expect(response.body).to.eql({
id: response.body.id,
name: 'abc',
@ -145,7 +145,7 @@ export default function createAlertTests({ getService }: FtrProviderContext) {
case 'superuser at space1':
case 'space_1_all at space1':
expect(response.statusCode).to.eql(200);
objectRemover.add(space.id, response.body.id, 'alert');
objectRemover.add(space.id, response.body.id, 'alert', undefined);
expect(response.body.scheduledTaskId).to.eql(undefined);
break;
default:

View file

@ -52,7 +52,7 @@ export default function createDeleteTests({ getService }: FtrProviderContext) {
error: 'Not Found',
message: 'Not Found',
});
objectRemover.add(space.id, createdAlert.id, 'alert');
objectRemover.add(space.id, createdAlert.id, 'alert', undefined);
// Ensure task still exists
await getScheduledTask(createdAlert.scheduledTaskId);
break;
@ -78,7 +78,7 @@ export default function createDeleteTests({ getService }: FtrProviderContext) {
.set('kbn-xsrf', 'foo')
.send(getTestAlertData())
.expect(200);
objectRemover.add(space.id, createdAlert.id, 'alert');
objectRemover.add(space.id, createdAlert.id, 'alert', undefined);
const response = await supertestWithoutAuth
.delete(`${getUrlPrefix('other')}/api/alert/${createdAlert.id}`)
@ -143,7 +143,7 @@ export default function createDeleteTests({ getService }: FtrProviderContext) {
error: 'Not Found',
message: 'Not Found',
});
objectRemover.add(space.id, createdAlert.id, 'alert');
objectRemover.add(space.id, createdAlert.id, 'alert', undefined);
// Ensure task still exists
await getScheduledTask(createdAlert.scheduledTaskId);
break;

View file

@ -44,7 +44,7 @@ export default function createDisableAlertTests({ getService }: FtrProviderConte
.set('kbn-xsrf', 'foo')
.send(getTestAlertData({ enabled: true }))
.expect(200);
objectRemover.add(space.id, createdAlert.id, 'alert');
objectRemover.add(space.id, createdAlert.id, 'alert', undefined);
const response = await alertUtils.getDisableRequest(createdAlert.id);
@ -90,7 +90,7 @@ export default function createDisableAlertTests({ getService }: FtrProviderConte
.set('kbn-xsrf', 'foo')
.send(getTestAlertData({ enabled: true }))
.expect(200);
objectRemover.add(space.id, createdAlert.id, 'alert');
objectRemover.add(space.id, createdAlert.id, 'alert', undefined);
await supertest
.put(
@ -148,7 +148,7 @@ export default function createDisableAlertTests({ getService }: FtrProviderConte
.set('kbn-xsrf', 'foo')
.send(getTestAlertData({ enabled: true }))
.expect(200);
objectRemover.add('other', createdAlert.id, 'alert');
objectRemover.add('other', createdAlert.id, 'alert', undefined);
const response = await alertUtils.getDisableRequest(createdAlert.id);

View file

@ -44,7 +44,7 @@ export default function createEnableAlertTests({ getService }: FtrProviderContex
.set('kbn-xsrf', 'foo')
.send(getTestAlertData({ enabled: false }))
.expect(200);
objectRemover.add(space.id, createdAlert.id, 'alert');
objectRemover.add(space.id, createdAlert.id, 'alert', undefined);
const response = await alertUtils.getEnableRequest(createdAlert.id);
@ -95,7 +95,7 @@ export default function createEnableAlertTests({ getService }: FtrProviderContex
.set('kbn-xsrf', 'foo')
.send(getTestAlertData({ enabled: false }))
.expect(200);
objectRemover.add(space.id, createdAlert.id, 'alert');
objectRemover.add(space.id, createdAlert.id, 'alert', undefined);
await supertest
.put(
@ -158,7 +158,7 @@ export default function createEnableAlertTests({ getService }: FtrProviderContex
.set('kbn-xsrf', 'foo')
.send(getTestAlertData({ enabled: false }))
.expect(200);
objectRemover.add('other', createdAlert.id, 'alert');
objectRemover.add('other', createdAlert.id, 'alert', undefined);
const response = await alertUtils.getEnableRequest(createdAlert.id);

View file

@ -28,7 +28,7 @@ export default function createFindTests({ getService }: FtrProviderContext) {
.set('kbn-xsrf', 'foo')
.send(getTestAlertData())
.expect(200);
objectRemover.add(space.id, createdAlert.id, 'alert');
objectRemover.add(space.id, createdAlert.id, 'alert', undefined);
const response = await supertestWithoutAuth
.get(
@ -84,7 +84,7 @@ export default function createFindTests({ getService }: FtrProviderContext) {
it('should handle find alert request with filter appropriately', async () => {
const { body: createdAction } = await supertest
.post(`${getUrlPrefix(space.id)}/api/action`)
.post(`${getUrlPrefix(space.id)}/api/actions/action`)
.set('kbn-xsrf', 'foo')
.send({
name: 'My action',
@ -110,7 +110,7 @@ export default function createFindTests({ getService }: FtrProviderContext) {
})
)
.expect(200);
objectRemover.add(space.id, createdAlert.id, 'alert');
objectRemover.add(space.id, createdAlert.id, 'alert', undefined);
const response = await supertestWithoutAuth
.get(
@ -178,7 +178,7 @@ export default function createFindTests({ getService }: FtrProviderContext) {
.set('kbn-xsrf', 'foo')
.send(getTestAlertData())
.expect(200);
objectRemover.add(space.id, createdAlert.id, 'alert');
objectRemover.add(space.id, createdAlert.id, 'alert', undefined);
const response = await supertestWithoutAuth
.get(

View file

@ -28,7 +28,7 @@ export default function createGetTests({ getService }: FtrProviderContext) {
.set('kbn-xsrf', 'foo')
.send(getTestAlertData())
.expect(200);
objectRemover.add(space.id, createdAlert.id, 'alert');
objectRemover.add(space.id, createdAlert.id, 'alert', undefined);
const response = await supertestWithoutAuth
.get(`${getUrlPrefix(space.id)}/api/alert/${createdAlert.id}`)
@ -82,7 +82,7 @@ export default function createGetTests({ getService }: FtrProviderContext) {
.set('kbn-xsrf', 'foo')
.send(getTestAlertData())
.expect(200);
objectRemover.add(space.id, createdAlert.id, 'alert');
objectRemover.add(space.id, createdAlert.id, 'alert', undefined);
const response = await supertestWithoutAuth
.get(`${getUrlPrefix('other')}/api/alert/${createdAlert.id}`)

View file

@ -28,7 +28,7 @@ export default function createGetAlertStateTests({ getService }: FtrProviderCont
.set('kbn-xsrf', 'foo')
.send(getTestAlertData())
.expect(200);
objectRemover.add(space.id, createdAlert.id, 'alert');
objectRemover.add(space.id, createdAlert.id, 'alert', undefined);
const response = await supertestWithoutAuth
.get(`${getUrlPrefix(space.id)}/api/alert/${createdAlert.id}/state`)
@ -61,7 +61,7 @@ export default function createGetAlertStateTests({ getService }: FtrProviderCont
.set('kbn-xsrf', 'foo')
.send(getTestAlertData())
.expect(200);
objectRemover.add(space.id, createdAlert.id, 'alert');
objectRemover.add(space.id, createdAlert.id, 'alert', undefined);
const response = await supertestWithoutAuth
.get(`${getUrlPrefix('other')}/api/alert/${createdAlert.id}/state`)

View file

@ -36,7 +36,7 @@ export default function createMuteAlertTests({ getService }: FtrProviderContext)
.set('kbn-xsrf', 'foo')
.send(getTestAlertData({ enabled: false }))
.expect(200);
objectRemover.add(space.id, createdAlert.id, 'alert');
objectRemover.add(space.id, createdAlert.id, 'alert', undefined);
const response = await alertUtils.getMuteAllRequest(createdAlert.id);

View file

@ -36,7 +36,7 @@ export default function createMuteAlertInstanceTests({ getService }: FtrProvider
.set('kbn-xsrf', 'foo')
.send(getTestAlertData({ enabled: false }))
.expect(200);
objectRemover.add(space.id, createdAlert.id, 'alert');
objectRemover.add(space.id, createdAlert.id, 'alert', undefined);
const response = await alertUtils.getMuteInstanceRequest(createdAlert.id, '1');
@ -80,7 +80,7 @@ export default function createMuteAlertInstanceTests({ getService }: FtrProvider
.set('kbn-xsrf', 'foo')
.send(getTestAlertData({ enabled: false }))
.expect(200);
objectRemover.add(space.id, createdAlert.id, 'alert');
objectRemover.add(space.id, createdAlert.id, 'alert', undefined);
await supertest
.post(`${getUrlPrefix(space.id)}/api/alert/${createdAlert.id}/alert_instance/1/_mute`)

View file

@ -36,7 +36,7 @@ export default function createUnmuteAlertTests({ getService }: FtrProviderContex
.set('kbn-xsrf', 'foo')
.send(getTestAlertData({ enabled: false }))
.expect(200);
objectRemover.add(space.id, createdAlert.id, 'alert');
objectRemover.add(space.id, createdAlert.id, 'alert', undefined);
await supertest
.post(`${getUrlPrefix(space.id)}/api/alert/${createdAlert.id}/_mute_all`)

View file

@ -36,7 +36,7 @@ export default function createMuteAlertInstanceTests({ getService }: FtrProvider
.set('kbn-xsrf', 'foo')
.send(getTestAlertData({ enabled: false }))
.expect(200);
objectRemover.add(space.id, createdAlert.id, 'alert');
objectRemover.add(space.id, createdAlert.id, 'alert', undefined);
await supertest
.post(`${getUrlPrefix(space.id)}/api/alert/${createdAlert.id}/alert_instance/1/_mute`)

View file

@ -43,7 +43,7 @@ export default function createUpdateTests({ getService }: FtrProviderContext) {
.set('kbn-xsrf', 'foo')
.send(getTestAlertData())
.expect(200);
objectRemover.add(space.id, createdAlert.id, 'alert');
objectRemover.add(space.id, createdAlert.id, 'alert', undefined);
const updatedData = {
name: 'bcd',
@ -114,7 +114,7 @@ export default function createUpdateTests({ getService }: FtrProviderContext) {
.set('kbn-xsrf', 'foo')
.send(getTestAlertData())
.expect(200);
objectRemover.add(space.id, createdAlert.id, 'alert');
objectRemover.add(space.id, createdAlert.id, 'alert', undefined);
await supertest
.put(
@ -197,7 +197,7 @@ export default function createUpdateTests({ getService }: FtrProviderContext) {
.set('kbn-xsrf', 'foo')
.send(getTestAlertData())
.expect(200);
objectRemover.add(space.id, createdAlert.id, 'alert');
objectRemover.add(space.id, createdAlert.id, 'alert', undefined);
const response = await supertestWithoutAuth
.put(`${getUrlPrefix('other')}/api/alert/${createdAlert.id}`)
@ -244,7 +244,7 @@ export default function createUpdateTests({ getService }: FtrProviderContext) {
.set('kbn-xsrf', 'foo')
.send(getTestAlertData())
.expect(200);
objectRemover.add(space.id, createdAlert.id, 'alert');
objectRemover.add(space.id, createdAlert.id, 'alert', undefined);
const response = await supertestWithoutAuth
.put(`${getUrlPrefix(space.id)}/api/alert/${createdAlert.id}`)
@ -332,7 +332,7 @@ export default function createUpdateTests({ getService }: FtrProviderContext) {
})
)
.expect(200);
objectRemover.add(space.id, createdAlert.id, 'alert');
objectRemover.add(space.id, createdAlert.id, 'alert', undefined);
const response = await supertestWithoutAuth
.put(`${getUrlPrefix(space.id)}/api/alert/${createdAlert.id}`)
@ -421,7 +421,7 @@ export default function createUpdateTests({ getService }: FtrProviderContext) {
})
)
.expect(200);
objectRemover.add(space.id, createdAlert.id, 'alert');
objectRemover.add(space.id, createdAlert.id, 'alert', undefined);
await retry.try(async () => {
const alertTask = (await getAlertingTaskById(createdAlert.scheduledTaskId)).docs[0];

View file

@ -36,7 +36,7 @@ export default function createUpdateApiKeyTests({ getService }: FtrProviderConte
.set('kbn-xsrf', 'foo')
.send(getTestAlertData())
.expect(200);
objectRemover.add(space.id, createdAlert.id, 'alert');
objectRemover.add(space.id, createdAlert.id, 'alert', undefined);
const response = await alertUtils.getUpdateApiKeyRequest(createdAlert.id);
@ -80,7 +80,7 @@ export default function createUpdateApiKeyTests({ getService }: FtrProviderConte
.set('kbn-xsrf', 'foo')
.send(getTestAlertData())
.expect(200);
objectRemover.add(space.id, createdAlert.id, 'alert');
objectRemover.add(space.id, createdAlert.id, 'alert', undefined);
await supertest
.put(
@ -136,7 +136,7 @@ export default function createUpdateApiKeyTests({ getService }: FtrProviderConte
.set('kbn-xsrf', 'foo')
.send(getTestAlertData())
.expect(200);
objectRemover.add('other', createdAlert.id, 'alert');
objectRemover.add('other', createdAlert.id, 'alert', undefined);
const response = await alertUtils.getUpdateApiKeyRequest(createdAlert.id);

View file

@ -26,7 +26,7 @@ export default function indexTest({ getService }: FtrProviderContext) {
it('should be created successfully', async () => {
// create action with no config
const { body: createdAction } = await supertest
.post('/api/action')
.post('/api/actions/action')
.set('kbn-xsrf', 'foo')
.send({
name: 'An index action',
@ -51,7 +51,7 @@ export default function indexTest({ getService }: FtrProviderContext) {
expect(typeof createdActionID).to.be('string');
const { body: fetchedAction } = await supertest
.get(`/api/action/${createdActionID}`)
.get(`/api/actions/action/${createdActionID}`)
.expect(200);
expect(fetchedAction).to.eql({
@ -64,7 +64,7 @@ export default function indexTest({ getService }: FtrProviderContext) {
// create action with all config props
const { body: createdActionWithIndex } = await supertest
.post('/api/action')
.post('/api/actions/action')
.set('kbn-xsrf', 'foo')
.send({
name: 'An index action with index config',
@ -92,7 +92,7 @@ export default function indexTest({ getService }: FtrProviderContext) {
expect(typeof createdActionIDWithIndex).to.be('string');
const { body: fetchedActionWithIndex } = await supertest
.get(`/api/action/${createdActionIDWithIndex}`)
.get(`/api/actions/action/${createdActionIDWithIndex}`)
.expect(200);
expect(fetchedActionWithIndex).to.eql({
@ -110,7 +110,7 @@ export default function indexTest({ getService }: FtrProviderContext) {
it('should execute successly when expected for a single body', async () => {
const { body: createdAction } = await supertest
.post('/api/action')
.post('/api/actions/action')
.set('kbn-xsrf', 'foo')
.send({
name: 'An index action',
@ -123,7 +123,7 @@ export default function indexTest({ getService }: FtrProviderContext) {
})
.expect(200);
const { body: result } = await supertest
.post(`/api/action/${createdAction.id}/_execute`)
.post(`/api/actions/action/${createdAction.id}/_execute`)
.set('kbn-xsrf', 'foo')
.send({
params: {

View file

@ -32,7 +32,7 @@ export default function webhookTest({ getService }: FtrProviderContext) {
};
const { body: createdAction } = await supertest
.post('/api/action')
.post('/api/actions/action')
.set('kbn-xsrf', 'test')
.send({
name: 'A generic Webhook action',
@ -60,7 +60,7 @@ export default function webhookTest({ getService }: FtrProviderContext) {
it('webhook can be executed without username and password', async () => {
const webhookActionId = await createWebhookAction(webhookSimulatorURL);
const { body: result } = await supertest
.post(`/api/action/${webhookActionId}/_execute`)
.post(`/api/actions/action/${webhookActionId}/_execute`)
.set('kbn-xsrf', 'test')
.send({
params: {

View file

@ -20,7 +20,7 @@ export default function createActionTests({ getService }: FtrProviderContext) {
it('should handle create action request appropriately', async () => {
const response = await supertest
.post(`${getUrlPrefix(Spaces.space1.id)}/api/action`)
.post(`${getUrlPrefix(Spaces.space1.id)}/api/actions/action`)
.set('kbn-xsrf', 'foo')
.send({
name: 'My action',
@ -34,7 +34,7 @@ export default function createActionTests({ getService }: FtrProviderContext) {
});
expect(response.status).to.eql(200);
objectRemover.add(Spaces.space1.id, response.body.id, 'action');
objectRemover.add(Spaces.space1.id, response.body.id, 'action', 'actions');
expect(response.body).to.eql({
id: response.body.id,
isPreconfigured: false,

View file

@ -19,7 +19,7 @@ export default function deleteActionTests({ getService }: FtrProviderContext) {
it('should handle delete action request appropriately', async () => {
const { body: createdAction } = await supertest
.post(`${getUrlPrefix(Spaces.space1.id)}/api/action`)
.post(`${getUrlPrefix(Spaces.space1.id)}/api/actions/action`)
.set('kbn-xsrf', 'foo')
.send({
name: 'My action',
@ -34,14 +34,14 @@ export default function deleteActionTests({ getService }: FtrProviderContext) {
.expect(200);
await supertest
.delete(`${getUrlPrefix(Spaces.space1.id)}/api/action/${createdAction.id}`)
.delete(`${getUrlPrefix(Spaces.space1.id)}/api/actions/action/${createdAction.id}`)
.set('kbn-xsrf', 'foo')
.expect(204, '');
});
it(`shouldn't delete action from another space`, async () => {
const { body: createdAction } = await supertest
.post(`${getUrlPrefix(Spaces.space1.id)}/api/action`)
.post(`${getUrlPrefix(Spaces.space1.id)}/api/actions/action`)
.set('kbn-xsrf', 'foo')
.send({
name: 'My action',
@ -54,10 +54,10 @@ export default function deleteActionTests({ getService }: FtrProviderContext) {
},
})
.expect(200);
objectRemover.add(Spaces.space1.id, createdAction.id, 'action');
objectRemover.add(Spaces.space1.id, createdAction.id, 'action', 'actions');
await supertest
.delete(`${getUrlPrefix(Spaces.other.id)}/api/action/${createdAction.id}`)
.delete(`${getUrlPrefix(Spaces.other.id)}/api/actions/action/${createdAction.id}`)
.set('kbn-xsrf', 'foo')
.expect(404, {
statusCode: 404,
@ -68,7 +68,7 @@ export default function deleteActionTests({ getService }: FtrProviderContext) {
it(`should handle delete request appropriately when action doesn't exist`, async () => {
await supertest
.delete(`${getUrlPrefix(Spaces.space1.id)}/api/action/2`)
.delete(`${getUrlPrefix(Spaces.space1.id)}/api/actions/action/2`)
.set('kbn-xsrf', 'foo')
.expect(404, {
statusCode: 404,
@ -79,7 +79,7 @@ export default function deleteActionTests({ getService }: FtrProviderContext) {
it(`shouldn't delete action from preconfigured list`, async () => {
await supertest
.delete(`${getUrlPrefix(Spaces.space1.id)}/api/action/my-slack1`)
.delete(`${getUrlPrefix(Spaces.space1.id)}/api/actions/action/my-slack1`)
.set('kbn-xsrf', 'foo')
.expect(400, {
statusCode: 400,

View file

@ -39,7 +39,7 @@ export default function ({ getService }: FtrProviderContext) {
it('should handle execute request appropriately', async () => {
const { body: createdAction } = await supertest
.post(`${getUrlPrefix(Spaces.space1.id)}/api/action`)
.post(`${getUrlPrefix(Spaces.space1.id)}/api/actions/action`)
.set('kbn-xsrf', 'foo')
.send({
name: 'My action',
@ -52,11 +52,11 @@ export default function ({ getService }: FtrProviderContext) {
},
})
.expect(200);
objectRemover.add(Spaces.space1.id, createdAction.id, 'action');
objectRemover.add(Spaces.space1.id, createdAction.id, 'action', 'actions');
const reference = `actions-execute-1:${Spaces.space1.id}`;
const response = await supertest
.post(`${getUrlPrefix(Spaces.space1.id)}/api/action/${createdAction.id}/_execute`)
.post(`${getUrlPrefix(Spaces.space1.id)}/api/actions/action/${createdAction.id}/_execute`)
.set('kbn-xsrf', 'foo')
.send({
params: {
@ -90,18 +90,18 @@ export default function ({ getService }: FtrProviderContext) {
it('should handle failed executions', async () => {
const { body: createdAction } = await supertest
.post(`${getUrlPrefix(Spaces.space1.id)}/api/action`)
.post(`${getUrlPrefix(Spaces.space1.id)}/api/actions/action`)
.set('kbn-xsrf', 'foo')
.send({
name: 'failing action',
actionTypeId: 'test.failing',
})
.expect(200);
objectRemover.add(Spaces.space1.id, createdAction.id, 'action');
objectRemover.add(Spaces.space1.id, createdAction.id, 'action', 'actions');
const reference = `actions-failure-1:${Spaces.space1.id}`;
const response = await supertest
.post(`${getUrlPrefix(Spaces.space1.id)}/api/action/${createdAction.id}/_execute`)
.post(`${getUrlPrefix(Spaces.space1.id)}/api/actions/action/${createdAction.id}/_execute`)
.set('kbn-xsrf', 'foo')
.send({
params: {
@ -122,7 +122,7 @@ export default function ({ getService }: FtrProviderContext) {
it(`shouldn't execute an action from another space`, async () => {
const { body: createdAction } = await supertest
.post(`${getUrlPrefix(Spaces.space1.id)}/api/action`)
.post(`${getUrlPrefix(Spaces.space1.id)}/api/actions/action`)
.set('kbn-xsrf', 'foo')
.send({
name: 'My action',
@ -135,11 +135,11 @@ export default function ({ getService }: FtrProviderContext) {
},
})
.expect(200);
objectRemover.add(Spaces.space1.id, createdAction.id, 'action');
objectRemover.add(Spaces.space1.id, createdAction.id, 'action', 'actions');
const reference = `actions-execute-2:${Spaces.space1.id}`;
await supertest
.post(`${getUrlPrefix(Spaces.other.id)}/api/action/${createdAction.id}/_execute`)
.post(`${getUrlPrefix(Spaces.other.id)}/api/actions/action/${createdAction.id}/_execute`)
.set('kbn-xsrf', 'foo')
.send({
params: {
@ -158,17 +158,17 @@ export default function ({ getService }: FtrProviderContext) {
it('should handle execute request appropriately and have proper callCluster and savedObjectsClient authorization', async () => {
const reference = `actions-execute-3:${Spaces.space1.id}`;
const { body: createdAction } = await supertest
.post(`${getUrlPrefix(Spaces.space1.id)}/api/action`)
.post(`${getUrlPrefix(Spaces.space1.id)}/api/actions/action`)
.set('kbn-xsrf', 'foo')
.send({
name: 'My action',
actionTypeId: 'test.authorization',
})
.expect(200);
objectRemover.add(Spaces.space1.id, createdAction.id, 'action');
objectRemover.add(Spaces.space1.id, createdAction.id, 'action', 'actions');
const response = await supertest
.post(`${getUrlPrefix(Spaces.space1.id)}/api/action/${createdAction.id}/_execute`)
.post(`${getUrlPrefix(Spaces.space1.id)}/api/actions/action/${createdAction.id}/_execute`)
.set('kbn-xsrf', 'foo')
.send({
params: {

View file

@ -19,7 +19,7 @@ export default function getActionTests({ getService }: FtrProviderContext) {
it('should handle get action request appropriately', async () => {
const { body: createdAction } = await supertest
.post(`${getUrlPrefix(Spaces.space1.id)}/api/action`)
.post(`${getUrlPrefix(Spaces.space1.id)}/api/actions/action`)
.set('kbn-xsrf', 'foo')
.send({
name: 'My action',
@ -32,10 +32,10 @@ export default function getActionTests({ getService }: FtrProviderContext) {
},
})
.expect(200);
objectRemover.add(Spaces.space1.id, createdAction.id, 'action');
objectRemover.add(Spaces.space1.id, createdAction.id, 'action', 'actions');
await supertest
.get(`${getUrlPrefix(Spaces.space1.id)}/api/action/${createdAction.id}`)
.get(`${getUrlPrefix(Spaces.space1.id)}/api/actions/action/${createdAction.id}`)
.expect(200, {
id: createdAction.id,
isPreconfigured: false,
@ -49,7 +49,7 @@ export default function getActionTests({ getService }: FtrProviderContext) {
it(`action should't be acessible from another space`, async () => {
const { body: createdAction } = await supertest
.post(`${getUrlPrefix(Spaces.space1.id)}/api/action`)
.post(`${getUrlPrefix(Spaces.space1.id)}/api/actions/action`)
.set('kbn-xsrf', 'foo')
.send({
name: 'My action',
@ -62,10 +62,10 @@ export default function getActionTests({ getService }: FtrProviderContext) {
},
})
.expect(200);
objectRemover.add(Spaces.space1.id, createdAction.id, 'action');
objectRemover.add(Spaces.space1.id, createdAction.id, 'action', 'actions');
await supertest
.get(`${getUrlPrefix(Spaces.other.id)}/api/action/${createdAction.id}`)
.get(`${getUrlPrefix(Spaces.other.id)}/api/actions/action/${createdAction.id}`)
.expect(404, {
statusCode: 404,
error: 'Not Found',
@ -74,12 +74,14 @@ export default function getActionTests({ getService }: FtrProviderContext) {
});
it('should handle get action request from preconfigured list', async () => {
await supertest.get(`${getUrlPrefix(Spaces.space1.id)}/api/action/my-slack1`).expect(200, {
id: 'my-slack1',
isPreconfigured: true,
actionTypeId: '.slack',
name: 'Slack#xyz',
});
await supertest
.get(`${getUrlPrefix(Spaces.space1.id)}/api/actions/action/my-slack1`)
.expect(200, {
id: 'my-slack1',
isPreconfigured: true,
actionTypeId: '.slack',
name: 'Slack#xyz',
});
});
});
}

View file

@ -19,7 +19,7 @@ export default function getAllActionTests({ getService }: FtrProviderContext) {
it('should handle get all action request appropriately', async () => {
const { body: createdAction } = await supertest
.post(`${getUrlPrefix(Spaces.space1.id)}/api/action`)
.post(`${getUrlPrefix(Spaces.space1.id)}/api/actions/action`)
.set('kbn-xsrf', 'foo')
.send({
name: 'My action',
@ -32,9 +32,9 @@ export default function getAllActionTests({ getService }: FtrProviderContext) {
},
})
.expect(200);
objectRemover.add(Spaces.space1.id, createdAction.id, 'action');
objectRemover.add(Spaces.space1.id, createdAction.id, 'action', 'actions');
await supertest.get(`${getUrlPrefix(Spaces.space1.id)}/api/action/_getAll`).expect(200, [
await supertest.get(`${getUrlPrefix(Spaces.space1.id)}/api/actions`).expect(200, [
{
id: createdAction.id,
isPreconfigured: false,
@ -78,7 +78,7 @@ export default function getAllActionTests({ getService }: FtrProviderContext) {
it(`shouldn't get all action from another space`, async () => {
const { body: createdAction } = await supertest
.post(`${getUrlPrefix(Spaces.space1.id)}/api/action`)
.post(`${getUrlPrefix(Spaces.space1.id)}/api/actions/action`)
.set('kbn-xsrf', 'foo')
.send({
name: 'My action',
@ -91,9 +91,9 @@ export default function getAllActionTests({ getService }: FtrProviderContext) {
},
})
.expect(200);
objectRemover.add(Spaces.space1.id, createdAction.id, 'action');
objectRemover.add(Spaces.space1.id, createdAction.id, 'action', 'actions');
await supertest.get(`${getUrlPrefix(Spaces.other.id)}/api/action/_getAll`).expect(200, [
await supertest.get(`${getUrlPrefix(Spaces.other.id)}/api/actions`).expect(200, [
{
id: 'preconfigured-es-index-action',
isPreconfigured: true,

View file

@ -15,7 +15,9 @@ export default function listActionTypesTests({ getService }: FtrProviderContext)
describe('list_action_types', () => {
it('should return 200 with list of action types containing defaults', async () => {
const response = await supertest.get(`${getUrlPrefix(Spaces.space1.id)}/api/action/types`);
const response = await supertest.get(
`${getUrlPrefix(Spaces.space1.id)}/api/actions/list_action_types`
);
function createActionTypeMatcher(id: string, name: string) {
return (actionType: { id: string; name: string }) => {

View file

@ -21,7 +21,7 @@ export default function typeNotEnabledTests({ getService }: FtrProviderContext)
after(() => esArchiver.unload('alerting'));
it('should handle create action with disabled actionType request appropriately', async () => {
const response = await supertest.post(`/api/action`).set('kbn-xsrf', 'foo').send({
const response = await supertest.post(`/api/actions/action`).set('kbn-xsrf', 'foo').send({
name: 'My action',
actionTypeId: DISABLED_ACTION_TYPE,
});
@ -37,7 +37,7 @@ export default function typeNotEnabledTests({ getService }: FtrProviderContext)
it(`should handle execute request with disabled actionType appropriately`, async () => {
const response = await supertest
.post(`/api/action/${PREWRITTEN_ACTION_ID}/_execute`)
.post(`/api/actions/action/${PREWRITTEN_ACTION_ID}/_execute`)
.set('kbn-xsrf', 'foo')
.send({
params: {},
@ -53,7 +53,7 @@ export default function typeNotEnabledTests({ getService }: FtrProviderContext)
});
it('should handle get action request with disabled actionType appropriately', async () => {
const response = await supertest.get(`/api/action/${PREWRITTEN_ACTION_ID}`);
const response = await supertest.get(`/api/actions/action/${PREWRITTEN_ACTION_ID}`);
expect(response.status).to.eql(200);
expect(response.body).to.eql({
@ -67,7 +67,7 @@ export default function typeNotEnabledTests({ getService }: FtrProviderContext)
it('should handle update action request with disabled actionType appropriately', async () => {
const responseUpdate = await supertest
.put(`/api/action/${PREWRITTEN_ACTION_ID}`)
.put(`/api/actions/action/${PREWRITTEN_ACTION_ID}`)
.set('kbn-xsrf', 'foo')
.send({
name: 'an action created before test.not-enabled was disabled (updated)',
@ -81,7 +81,7 @@ export default function typeNotEnabledTests({ getService }: FtrProviderContext)
'action type "test.not-enabled" is not enabled in the Kibana config xpack.actions.enabledActionTypes',
});
const response = await supertest.get(`/api/action/${PREWRITTEN_ACTION_ID}`);
const response = await supertest.get(`/api/actions/action/${PREWRITTEN_ACTION_ID}`);
expect(response.status).to.eql(200);
expect(response.body).to.eql({
actionTypeId: 'test.not-enabled',
@ -96,11 +96,11 @@ export default function typeNotEnabledTests({ getService }: FtrProviderContext)
let response;
response = await supertest
.delete(`/api/action/${PREWRITTEN_ACTION_ID}`)
.delete(`/api/actions/action/${PREWRITTEN_ACTION_ID}`)
.set('kbn-xsrf', 'foo');
expect(response.status).to.eql(204);
response = await supertest.get(`/api/action/${PREWRITTEN_ACTION_ID}`);
response = await supertest.get(`/api/actions/action/${PREWRITTEN_ACTION_ID}`);
expect(response.status).to.eql(404);
});
});

View file

@ -19,7 +19,7 @@ export default function updateActionTests({ getService }: FtrProviderContext) {
it('should handle update action request appropriately', async () => {
const { body: createdAction } = await supertest
.post(`${getUrlPrefix(Spaces.space1.id)}/api/action`)
.post(`${getUrlPrefix(Spaces.space1.id)}/api/actions/action`)
.set('kbn-xsrf', 'foo')
.send({
name: 'My action',
@ -32,10 +32,10 @@ export default function updateActionTests({ getService }: FtrProviderContext) {
},
})
.expect(200);
objectRemover.add(Spaces.space1.id, createdAction.id, 'action');
objectRemover.add(Spaces.space1.id, createdAction.id, 'action', 'actions');
await supertest
.put(`${getUrlPrefix(Spaces.space1.id)}/api/action/${createdAction.id}`)
.put(`${getUrlPrefix(Spaces.space1.id)}/api/actions/action/${createdAction.id}`)
.set('kbn-xsrf', 'foo')
.send({
name: 'My action updated',
@ -67,7 +67,7 @@ export default function updateActionTests({ getService }: FtrProviderContext) {
it(`shouldn't update action from another space`, async () => {
const { body: createdAction } = await supertest
.post(`${getUrlPrefix(Spaces.space1.id)}/api/action`)
.post(`${getUrlPrefix(Spaces.space1.id)}/api/actions/action`)
.set('kbn-xsrf', 'foo')
.send({
name: 'My action',
@ -80,10 +80,10 @@ export default function updateActionTests({ getService }: FtrProviderContext) {
},
})
.expect(200);
objectRemover.add(Spaces.space1.id, createdAction.id, 'action');
objectRemover.add(Spaces.space1.id, createdAction.id, 'action', 'actions');
await supertest
.put(`${getUrlPrefix(Spaces.other.id)}/api/action/${createdAction.id}`)
.put(`${getUrlPrefix(Spaces.other.id)}/api/actions/action/${createdAction.id}`)
.set('kbn-xsrf', 'foo')
.send({
name: 'My action updated',
@ -103,7 +103,7 @@ export default function updateActionTests({ getService }: FtrProviderContext) {
it(`shouldn't update action from preconfigured list`, async () => {
await supertest
.put(`${getUrlPrefix(Spaces.space1.id)}/api/action/custom-system-abc-connector`)
.put(`${getUrlPrefix(Spaces.space1.id)}/api/actions/action/custom-system-abc-connector`)
.set('kbn-xsrf', 'foo')
.send({
name: 'My action updated',

View file

@ -45,7 +45,7 @@ export function alertTests({ getService }: FtrProviderContext, space: Space) {
await esTestIndexTool.setup();
await es.indices.create({ index: authorizationIndex });
const { body: createdAction } = await supertestWithoutAuth
.post(`${getUrlPrefix(space.id)}/api/action`)
.post(`${getUrlPrefix(space.id)}/api/actions/action`)
.set('kbn-xsrf', 'foo')
.send({
name: 'My action',
@ -70,7 +70,7 @@ export function alertTests({ getService }: FtrProviderContext, space: Space) {
after(async () => {
await esTestIndexTool.destroy();
await es.indices.delete({ index: authorizationIndex });
objectRemover.add(space.id, indexRecordActionId, 'action');
objectRemover.add(space.id, indexRecordActionId, 'action', 'actions');
await objectRemover.removeAll();
});
@ -174,7 +174,7 @@ instanceStateValue: true
const retryDate = new Date(Date.now() + 60000);
const { body: createdAction } = await supertestWithoutAuth
.post(`${getUrlPrefix(space.id)}/api/action`)
.post(`${getUrlPrefix(space.id)}/api/actions/action`)
.set('kbn-xsrf', 'foo')
.send({
name: 'Test rate limit',
@ -182,7 +182,7 @@ instanceStateValue: true
config: {},
})
.expect(200);
objectRemover.add(space.id, createdAction.id, 'action');
objectRemover.add(space.id, createdAction.id, 'action', 'actions');
const reference = alertUtils.generateReference();
const response = await supertestWithoutAuth
@ -211,7 +211,7 @@ instanceStateValue: true
);
expect(response.statusCode).to.eql(200);
objectRemover.add(space.id, response.body.id, 'alert');
objectRemover.add(space.id, response.body.id, 'alert', undefined);
const scheduledActionTask = await retry.try(async () => {
const searchResult = await es.search({
index: '.kibana_task_manager',
@ -271,7 +271,7 @@ instanceStateValue: true
);
expect(response.statusCode).to.eql(200);
objectRemover.add(space.id, response.body.id, 'alert');
objectRemover.add(space.id, response.body.id, 'alert', undefined);
const alertTestRecord = (
await esTestIndexTool.waitForDocs('alert:test.authorization', reference)
)[0];
@ -292,14 +292,14 @@ instanceStateValue: true
it('should have proper callCluster and savedObjectsClient authorization for action type executor', async () => {
const reference = alertUtils.generateReference();
const { body: createdAction } = await supertestWithoutAuth
.post(`${getUrlPrefix(space.id)}/api/action`)
.post(`${getUrlPrefix(space.id)}/api/actions/action`)
.set('kbn-xsrf', 'foo')
.send({
name: 'My action',
actionTypeId: 'test.authorization',
})
.expect(200);
objectRemover.add(space.id, createdAction.id, 'action');
objectRemover.add(space.id, createdAction.id, 'action', 'actions');
const response = await supertestWithoutAuth
.post(`${getUrlPrefix(space.id)}/api/alert`)
.set('kbn-xsrf', 'foo')
@ -327,7 +327,7 @@ instanceStateValue: true
);
expect(response.statusCode).to.eql(200);
objectRemover.add(space.id, response.body.id, 'alert');
objectRemover.add(space.id, response.body.id, 'alert', undefined);
const actionTestRecord = (
await esTestIndexTool.waitForDocs('action:test.authorization', reference)
)[0];

View file

@ -372,7 +372,7 @@ export default function alertTests({ getService }: FtrProviderContext) {
expect(status).to.be(200);
const alertId = createdAlert.id;
objectRemover.add(Spaces.space1.id, alertId, 'alert');
objectRemover.add(Spaces.space1.id, alertId, 'alert', undefined);
return alertId;
}
@ -381,7 +381,7 @@ export default function alertTests({ getService }: FtrProviderContext) {
async function createAction(supertest: any, objectRemover: ObjectRemover): Promise<string> {
const { statusCode, body: createdAction } = await supertest
.post(`${getUrlPrefix(Spaces.space1.id)}/api/action`)
.post(`${getUrlPrefix(Spaces.space1.id)}/api/actions/action`)
.set('kbn-xsrf', 'foo')
.send({
name: 'index action for index threshold FT',
@ -398,7 +398,7 @@ async function createAction(supertest: any, objectRemover: ObjectRemover): Promi
expect(statusCode).to.be(200);
const actionId = createdAction.id;
objectRemover.add(Spaces.space1.id, actionId, 'action');
objectRemover.add(Spaces.space1.id, actionId, 'action', 'actions');
return actionId;
}

View file

@ -28,7 +28,7 @@ export default function createAlertTests({ getService }: FtrProviderContext) {
it('should handle create alert request appropriately', async () => {
const { body: createdAction } = await supertest
.post(`${getUrlPrefix(Spaces.space1.id)}/api/action`)
.post(`${getUrlPrefix(Spaces.space1.id)}/api/actions/action`)
.set('kbn-xsrf', 'foo')
.send({
name: 'MY action',
@ -54,7 +54,7 @@ export default function createAlertTests({ getService }: FtrProviderContext) {
);
expect(response.status).to.eql(200);
objectRemover.add(Spaces.space1.id, response.body.id, 'alert');
objectRemover.add(Spaces.space1.id, response.body.id, 'alert', undefined);
expect(response.body).to.eql({
id: response.body.id,
name: 'abc',
@ -109,7 +109,7 @@ export default function createAlertTests({ getService }: FtrProviderContext) {
.send(getTestAlertData({ enabled: false }));
expect(response.status).to.eql(200);
objectRemover.add(Spaces.space1.id, response.body.id, 'alert');
objectRemover.add(Spaces.space1.id, response.body.id, 'alert', undefined);
expect(response.body.scheduledTaskId).to.eql(undefined);
});
});

View file

@ -39,7 +39,7 @@ export default function createDisableAlertTests({ getService }: FtrProviderConte
.set('kbn-xsrf', 'foo')
.send(getTestAlertData({ enabled: true }))
.expect(200);
objectRemover.add(Spaces.space1.id, createdAlert.id, 'alert');
objectRemover.add(Spaces.space1.id, createdAlert.id, 'alert', undefined);
await alertUtils.disable(createdAlert.id);
@ -65,7 +65,7 @@ export default function createDisableAlertTests({ getService }: FtrProviderConte
.set('kbn-xsrf', 'foo')
.send(getTestAlertData({ enabled: true }))
.expect(200);
objectRemover.add(Spaces.other.id, createdAlert.id, 'alert');
objectRemover.add(Spaces.other.id, createdAlert.id, 'alert', undefined);
await alertUtils.getDisableRequest(createdAlert.id).expect(404, {
statusCode: 404,

View file

@ -39,7 +39,7 @@ export default function createEnableAlertTests({ getService }: FtrProviderContex
.set('kbn-xsrf', 'foo')
.send(getTestAlertData({ enabled: false }))
.expect(200);
objectRemover.add(Spaces.space1.id, createdAlert.id, 'alert');
objectRemover.add(Spaces.space1.id, createdAlert.id, 'alert', undefined);
await alertUtils.enable(createdAlert.id);
@ -71,7 +71,7 @@ export default function createEnableAlertTests({ getService }: FtrProviderContex
.set('kbn-xsrf', 'foo')
.send(getTestAlertData({ enabled: false }))
.expect(200);
objectRemover.add(Spaces.other.id, createdAlert.id, 'alert');
objectRemover.add(Spaces.other.id, createdAlert.id, 'alert', undefined);
await alertUtils.getEnableRequest(createdAlert.id).expect(404, {
statusCode: 404,

View file

@ -24,7 +24,7 @@ export default function createFindTests({ getService }: FtrProviderContext) {
.set('kbn-xsrf', 'foo')
.send(getTestAlertData())
.expect(200);
objectRemover.add(Spaces.space1.id, createdAlert.id, 'alert');
objectRemover.add(Spaces.space1.id, createdAlert.id, 'alert', undefined);
const response = await supertest.get(
`${getUrlPrefix(
@ -67,7 +67,7 @@ export default function createFindTests({ getService }: FtrProviderContext) {
.set('kbn-xsrf', 'foo')
.send(getTestAlertData())
.expect(200);
objectRemover.add(Spaces.space1.id, createdAlert.id, 'alert');
objectRemover.add(Spaces.space1.id, createdAlert.id, 'alert', undefined);
await supertest
.get(

View file

@ -24,7 +24,7 @@ export default function createGetTests({ getService }: FtrProviderContext) {
.set('kbn-xsrf', 'foo')
.send(getTestAlertData())
.expect(200);
objectRemover.add(Spaces.space1.id, createdAlert.id, 'alert');
objectRemover.add(Spaces.space1.id, createdAlert.id, 'alert', undefined);
const response = await supertest.get(
`${getUrlPrefix(Spaces.space1.id)}/api/alert/${createdAlert.id}`
@ -61,7 +61,7 @@ export default function createGetTests({ getService }: FtrProviderContext) {
.set('kbn-xsrf', 'foo')
.send(getTestAlertData())
.expect(200);
objectRemover.add(Spaces.space1.id, createdAlert.id, 'alert');
objectRemover.add(Spaces.space1.id, createdAlert.id, 'alert', undefined);
await supertest
.get(`${getUrlPrefix(Spaces.other.id)}/api/alert/${createdAlert.id}`)

View file

@ -25,7 +25,7 @@ export default function createGetAlertStateTests({ getService }: FtrProviderCont
.set('kbn-xsrf', 'foo')
.send(getTestAlertData())
.expect(200);
objectRemover.add(Spaces.space1.id, createdAlert.id, 'alert');
objectRemover.add(Spaces.space1.id, createdAlert.id, 'alert', undefined);
const response = await supertest.get(
`${getUrlPrefix(Spaces.space1.id)}/api/alert/${createdAlert.id}/state`
@ -51,7 +51,7 @@ export default function createGetAlertStateTests({ getService }: FtrProviderCont
params: {},
})
.expect(200);
objectRemover.add(Spaces.space1.id, createdAlert.id, 'alert');
objectRemover.add(Spaces.space1.id, createdAlert.id, 'alert', undefined);
// wait for alert to actually execute
await retry.try(async () => {

View file

@ -31,7 +31,7 @@ export default function createMuteTests({ getService }: FtrProviderContext) {
.set('kbn-xsrf', 'foo')
.send(getTestAlertData({ enabled: false }))
.expect(200);
objectRemover.add(Spaces.space1.id, createdAlert.id, 'alert');
objectRemover.add(Spaces.space1.id, createdAlert.id, 'alert', undefined);
await alertUtils.muteAll(createdAlert.id);

View file

@ -31,7 +31,7 @@ export default function createMuteInstanceTests({ getService }: FtrProviderConte
.set('kbn-xsrf', 'foo')
.send(getTestAlertData({ enabled: false }))
.expect(200);
objectRemover.add(Spaces.space1.id, createdAlert.id, 'alert');
objectRemover.add(Spaces.space1.id, createdAlert.id, 'alert', undefined);
await alertUtils.muteInstance(createdAlert.id, '1');

View file

@ -31,7 +31,7 @@ export default function createUnmuteTests({ getService }: FtrProviderContext) {
.set('kbn-xsrf', 'foo')
.send(getTestAlertData({ enabled: false }))
.expect(200);
objectRemover.add(Spaces.space1.id, createdAlert.id, 'alert');
objectRemover.add(Spaces.space1.id, createdAlert.id, 'alert', undefined);
await alertUtils.muteAll(createdAlert.id);
await alertUtils.unmuteAll(createdAlert.id);

View file

@ -31,7 +31,7 @@ export default function createUnmuteInstanceTests({ getService }: FtrProviderCon
.set('kbn-xsrf', 'foo')
.send(getTestAlertData({ enabled: false }))
.expect(200);
objectRemover.add(Spaces.space1.id, createdAlert.id, 'alert');
objectRemover.add(Spaces.space1.id, createdAlert.id, 'alert', undefined);
await alertUtils.muteInstance(createdAlert.id, '1');
await alertUtils.unmuteInstance(createdAlert.id, '1');

View file

@ -24,7 +24,7 @@ export default function createUpdateTests({ getService }: FtrProviderContext) {
.set('kbn-xsrf', 'foo')
.send(getTestAlertData())
.expect(200);
objectRemover.add(Spaces.space1.id, createdAlert.id, 'alert');
objectRemover.add(Spaces.space1.id, createdAlert.id, 'alert', undefined);
const updatedData = {
name: 'bcd',
@ -79,7 +79,7 @@ export default function createUpdateTests({ getService }: FtrProviderContext) {
.set('kbn-xsrf', 'foo')
.send(getTestAlertData())
.expect(200);
objectRemover.add(Spaces.space1.id, createdAlert.id, 'alert');
objectRemover.add(Spaces.space1.id, createdAlert.id, 'alert', undefined);
await supertest
.put(`${getUrlPrefix(Spaces.other.id)}/api/alert/${createdAlert.id}`)

View file

@ -35,7 +35,7 @@ export default function createUpdateApiKeyTests({ getService }: FtrProviderConte
.set('kbn-xsrf', 'foo')
.send(getTestAlertData())
.expect(200);
objectRemover.add(Spaces.space1.id, createdAlert.id, 'alert');
objectRemover.add(Spaces.space1.id, createdAlert.id, 'alert', undefined);
await alertUtils.updateApiKey(createdAlert.id);
@ -60,7 +60,7 @@ export default function createUpdateApiKeyTests({ getService }: FtrProviderConte
.set('kbn-xsrf', 'foo')
.send(getTestAlertData())
.expect(200);
objectRemover.add(Spaces.other.id, createdAlert.id, 'alert');
objectRemover.add(Spaces.other.id, createdAlert.id, 'alert', undefined);
await alertUtils.getUpdateApiKeyRequest(createdAlert.id).expect(404, {
statusCode: 404,

View file

@ -37,12 +37,12 @@ export default ({ getService }: FtrProviderContext): void => {
it('should push a case', async () => {
const { body: connector } = await supertest
.post('/api/action')
.post('/api/actions/action')
.set('kbn-xsrf', 'true')
.send(getConnector())
.expect(200);
actionsRemover.add('default', connector.id, 'action');
actionsRemover.add('default', connector.id, 'action', 'actions');
const { body: configure } = await supertest
.post(CASE_CONFIGURE_URL)
@ -73,12 +73,12 @@ export default ({ getService }: FtrProviderContext): void => {
it('pushes a comment appropriately', async () => {
const { body: connector } = await supertest
.post('/api/action')
.post('/api/actions/action')
.set('kbn-xsrf', 'true')
.send(getConnector())
.expect(200);
actionsRemover.add('default', connector.id, 'action');
actionsRemover.add('default', connector.id, 'action', 'actions');
const { body: configure } = await supertest
.post(CASE_CONFIGURE_URL)

View file

@ -31,7 +31,7 @@ export class Actions {
this.log.debug(`creating action ${actionParams.name}`);
const { data: action, status: actionStatus, actionStatusText } = await this.axios.post(
`/api/action`,
`/api/actions/action`,
actionParams
);
if (actionStatus !== 200) {