-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
99 additions
and
142 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -289,6 +289,19 @@ export const getWebhookConnector = () => ({ | |
}, | ||
}); | ||
|
||
export const getEmailConnector = () => ({ | ||
name: 'An email action', | ||
connector_type_id: '.email', | ||
config: { | ||
service: '__json', | ||
from: '[email protected]', | ||
}, | ||
secrets: { | ||
user: 'bob', | ||
password: 'supersecret', | ||
}, | ||
}); | ||
|
||
interface CommonSavedObjectAttributes { | ||
id?: string | null; | ||
created_at?: string | null; | ||
|
20 changes: 0 additions & 20 deletions
20
.../test/cases_api_integration/security_and_spaces/tests/basic/configure/create_connector.ts
This file was deleted.
Oops, something went wrong.
32 changes: 32 additions & 0 deletions
32
...ck/test/cases_api_integration/security_and_spaces/tests/basic/configure/get_connectors.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import expect from '@kbn/expect'; | ||
import { FtrProviderContext } from '../../../../../common/ftr_provider_context'; | ||
|
||
import { getCaseConnectors } from '../../../../common/lib/utils'; | ||
|
||
// eslint-disable-next-line import/no-default-export | ||
export default ({ getService }: FtrProviderContext): void => { | ||
const supertest = getService('supertest'); | ||
|
||
describe('get_connectors', () => { | ||
/** | ||
* A ServiceNow preconfigured connector is registered here | ||
* x-pack/test/cases_api_integration/common/config.ts | ||
* | ||
* The license for this test is set to basic. ServiceNow connectors | ||
* needs license >= platinum. The test below ensures | ||
* that connectors without valid license are being filtered correctly | ||
*/ | ||
it('should return an empty list of connectors', async () => { | ||
const connectors = await getCaseConnectors({ supertest }); | ||
|
||
expect(connectors).to.eql([]); | ||
}); | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 0 additions & 55 deletions
55
...k/test/cases_api_integration/security_and_spaces/tests/common/configure/get_connectors.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,6 @@ | |
*/ | ||
|
||
import expect from '@kbn/expect'; | ||
import { CASE_CONFIGURE_CONNECTORS_URL } from '@kbn/cases-plugin/common/constants'; | ||
import { FtrProviderContext } from '../../../../../common/ftr_provider_context'; | ||
|
||
import { ObjectRemover as ActionsRemover } from '../../../../../alerting_api_integration/common/lib'; | ||
|
@@ -16,6 +15,8 @@ import { | |
getResilientConnector, | ||
createConnector, | ||
getServiceNowSIRConnector, | ||
getEmailConnector, | ||
getCaseConnectors, | ||
} from '../../../../common/lib/utils'; | ||
|
||
// eslint-disable-next-line import/no-default-export | ||
|
@@ -29,41 +30,10 @@ export default ({ getService }: FtrProviderContext): void => { | |
}); | ||
|
||
it('should return the correct connectors', async () => { | ||
const { body: snConnector } = await supertest | ||
.post('/api/actions/connector') | ||
.set('kbn-xsrf', 'true') | ||
.send(getServiceNowConnector()) | ||
.expect(200); | ||
|
||
const { body: emailConnector } = await supertest | ||
.post('/api/actions/connector') | ||
.set('kbn-xsrf', 'true') | ||
.send({ | ||
name: 'An email action', | ||
connector_type_id: '.email', | ||
config: { | ||
service: '__json', | ||
from: '[email protected]', | ||
}, | ||
secrets: { | ||
user: 'bob', | ||
password: 'supersecret', | ||
}, | ||
}) | ||
.expect(200); | ||
|
||
const { body: jiraConnector } = await supertest | ||
.post('/api/actions/connector') | ||
.set('kbn-xsrf', 'true') | ||
.send(getJiraConnector()) | ||
.expect(200); | ||
|
||
const { body: resilientConnector } = await supertest | ||
.post('/api/actions/connector') | ||
.set('kbn-xsrf', 'true') | ||
.send(getResilientConnector()) | ||
.expect(200); | ||
|
||
const snConnector = await createConnector({ supertest, req: getServiceNowConnector() }); | ||
const emailConnector = await createConnector({ supertest, req: getEmailConnector() }); | ||
const jiraConnector = await createConnector({ supertest, req: getJiraConnector() }); | ||
const resilientConnector = await createConnector({ supertest, req: getResilientConnector() }); | ||
const sir = await createConnector({ supertest, req: getServiceNowSIRConnector() }); | ||
|
||
actionsRemover.add('default', sir.id, 'action', 'actions'); | ||
|
@@ -72,11 +42,7 @@ export default ({ getService }: FtrProviderContext): void => { | |
actionsRemover.add('default', jiraConnector.id, 'action', 'actions'); | ||
actionsRemover.add('default', resilientConnector.id, 'action', 'actions'); | ||
|
||
const { body: connectors } = await supertest | ||
.get(`${CASE_CONFIGURE_CONNECTORS_URL}/_find`) | ||
.set('kbn-xsrf', 'true') | ||
.send() | ||
.expect(200); | ||
const connectors = await getCaseConnectors({ supertest }); | ||
|
||
expect(connectors).to.eql([ | ||
{ | ||
|
@@ -91,6 +57,17 @@ export default ({ getService }: FtrProviderContext): void => { | |
isMissingSecrets: false, | ||
referencedByCount: 0, | ||
}, | ||
/** | ||
* Preconfigured connectors are being registered here: | ||
* x-pack/test/cases_api_integration/common/config.ts | ||
*/ | ||
{ | ||
actionTypeId: '.servicenow', | ||
id: 'preconfigured-servicenow', | ||
isPreconfigured: true, | ||
name: 'preconfigured-servicenow', | ||
referencedByCount: 0, | ||
}, | ||
{ | ||
id: resilientConnector.id, | ||
actionTypeId: '.resilient', | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,7 @@ import { | |
getAuthWithSuperUser, | ||
getCaseConnectors, | ||
getActionsSpace, | ||
getEmailConnector, | ||
} from '../../../../common/lib/utils'; | ||
|
||
// eslint-disable-next-line import/no-default-export | ||
|
@@ -38,32 +39,25 @@ export default ({ getService }: FtrProviderContext): void => { | |
req: getServiceNowConnector(), | ||
auth: authSpace1, | ||
}); | ||
|
||
const emailConnector = await createConnector({ | ||
supertest, | ||
req: { | ||
name: 'An email action', | ||
connector_type_id: '.email', | ||
config: { | ||
service: '__json', | ||
from: '[email protected]', | ||
}, | ||
secrets: { | ||
user: 'bob', | ||
password: 'supersecret', | ||
}, | ||
}, | ||
req: getEmailConnector(), | ||
auth: authSpace1, | ||
}); | ||
|
||
const jiraConnector = await createConnector({ | ||
supertest, | ||
req: getJiraConnector(), | ||
auth: authSpace1, | ||
}); | ||
|
||
const resilientConnector = await createConnector({ | ||
supertest, | ||
req: getResilientConnector(), | ||
auth: authSpace1, | ||
}); | ||
|
||
const sir = await createConnector({ | ||
supertest, | ||
req: getServiceNowSIRConnector(), | ||
|
@@ -91,6 +85,17 @@ export default ({ getService }: FtrProviderContext): void => { | |
isMissingSecrets: false, | ||
referencedByCount: 0, | ||
}, | ||
/** | ||
* Preconfigured connectors are being registered here: | ||
* x-pack/test/cases_api_integration/common/config.ts | ||
*/ | ||
{ | ||
actionTypeId: '.servicenow', | ||
id: 'preconfigured-servicenow', | ||
isPreconfigured: true, | ||
name: 'preconfigured-servicenow', | ||
referencedByCount: 0, | ||
}, | ||
{ | ||
id: resilientConnector.id, | ||
actionTypeId: '.resilient', | ||
|
@@ -136,32 +141,25 @@ export default ({ getService }: FtrProviderContext): void => { | |
req: getServiceNowConnector(), | ||
auth: authSpace1, | ||
}); | ||
|
||
const emailConnector = await createConnector({ | ||
supertest, | ||
req: { | ||
name: 'An email action', | ||
connector_type_id: '.email', | ||
config: { | ||
service: '__json', | ||
from: '[email protected]', | ||
}, | ||
secrets: { | ||
user: 'bob', | ||
password: 'supersecret', | ||
}, | ||
}, | ||
req: getEmailConnector(), | ||
auth: authSpace1, | ||
}); | ||
|
||
const jiraConnector = await createConnector({ | ||
supertest, | ||
req: getJiraConnector(), | ||
auth: authSpace1, | ||
}); | ||
|
||
const resilientConnector = await createConnector({ | ||
supertest, | ||
req: getResilientConnector(), | ||
auth: authSpace1, | ||
}); | ||
|
||
const sir = await createConnector({ | ||
supertest, | ||
req: getServiceNowSIRConnector(), | ||
|
@@ -179,7 +177,19 @@ export default ({ getService }: FtrProviderContext): void => { | |
auth: getAuthWithSuperUser('space2'), | ||
}); | ||
|
||
expect(connectors).to.eql([]); | ||
expect(connectors).to.eql([ | ||
/** | ||
* Preconfigured connectors are being registered here: | ||
* x-pack/test/cases_api_integration/common/config.ts | ||
*/ | ||
{ | ||
actionTypeId: '.servicenow', | ||
id: 'preconfigured-servicenow', | ||
isPreconfigured: true, | ||
name: 'preconfigured-servicenow', | ||
referencedByCount: 0, | ||
}, | ||
]); | ||
}); | ||
}); | ||
}; |