-
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.
* Added proxy support for action types * Fixed tests * added rejectUnauthorizedCertificates config setting * removed slack not used code * Fixed Slack proxy * fixed typecheck errors * Cleanup code * Fixed slack * Added unit tests * added proxy server for test * Fixed build * Added functional tests * fixed due to comments * Fixed tests and some changes due to comments * Fixed functional tests * fixed circular deps * Added proxy unit test to action type
- Loading branch information
1 parent
64b8b88
commit 52bd6d9
Showing
45 changed files
with
827 additions
and
195 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
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
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 |
---|---|---|
|
@@ -269,6 +269,7 @@ describe('execute()', () => { | |
"message": "a message to you", | ||
"subject": "the subject", | ||
}, | ||
"proxySettings": undefined, | ||
"routing": Object { | ||
"bcc": Array [ | ||
"[email protected]", | ||
|
@@ -326,6 +327,7 @@ describe('execute()', () => { | |
"message": "a message to you", | ||
"subject": "the subject", | ||
}, | ||
"proxySettings": undefined, | ||
"routing": Object { | ||
"bcc": Array [ | ||
"[email protected]", | ||
|
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
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 |
---|---|---|
|
@@ -9,6 +9,9 @@ import axios from 'axios'; | |
import { createExternalService } from './service'; | ||
import * as utils from '../lib/axios_utils'; | ||
import { ExternalService } from '../case/types'; | ||
import { Logger } from '../../../../../../src/core/server'; | ||
import { loggingSystemMock } from '../../../../../../src/core/server/mocks'; | ||
const logger = loggingSystemMock.create().get() as jest.Mocked<Logger>; | ||
|
||
jest.mock('axios'); | ||
jest.mock('../lib/axios_utils', () => { | ||
|
@@ -26,10 +29,13 @@ describe('Jira service', () => { | |
let service: ExternalService; | ||
|
||
beforeAll(() => { | ||
service = createExternalService({ | ||
config: { apiUrl: 'https://siem-kibana.atlassian.net', projectKey: 'CK' }, | ||
secrets: { apiToken: 'token', email: '[email protected]' }, | ||
}); | ||
service = createExternalService( | ||
{ | ||
config: { apiUrl: 'https://siem-kibana.atlassian.net', projectKey: 'CK' }, | ||
secrets: { apiToken: 'token', email: '[email protected]' }, | ||
}, | ||
logger | ||
); | ||
}); | ||
|
||
beforeEach(() => { | ||
|
@@ -39,37 +45,49 @@ describe('Jira service', () => { | |
describe('createExternalService', () => { | ||
test('throws without url', () => { | ||
expect(() => | ||
createExternalService({ | ||
config: { apiUrl: null, projectKey: 'CK' }, | ||
secrets: { apiToken: 'token', email: '[email protected]' }, | ||
}) | ||
createExternalService( | ||
{ | ||
config: { apiUrl: null, projectKey: 'CK' }, | ||
secrets: { apiToken: 'token', email: '[email protected]' }, | ||
}, | ||
logger | ||
) | ||
).toThrow(); | ||
}); | ||
|
||
test('throws without projectKey', () => { | ||
expect(() => | ||
createExternalService({ | ||
config: { apiUrl: 'test.com', projectKey: null }, | ||
secrets: { apiToken: 'token', email: '[email protected]' }, | ||
}) | ||
createExternalService( | ||
{ | ||
config: { apiUrl: 'test.com', projectKey: null }, | ||
secrets: { apiToken: 'token', email: '[email protected]' }, | ||
}, | ||
logger | ||
) | ||
).toThrow(); | ||
}); | ||
|
||
test('throws without username', () => { | ||
expect(() => | ||
createExternalService({ | ||
config: { apiUrl: 'test.com' }, | ||
secrets: { apiToken: '', email: '[email protected]' }, | ||
}) | ||
createExternalService( | ||
{ | ||
config: { apiUrl: 'test.com' }, | ||
secrets: { apiToken: '', email: '[email protected]' }, | ||
}, | ||
logger | ||
) | ||
).toThrow(); | ||
}); | ||
|
||
test('throws without password', () => { | ||
expect(() => | ||
createExternalService({ | ||
config: { apiUrl: 'test.com' }, | ||
secrets: { apiToken: '', email: undefined }, | ||
}) | ||
createExternalService( | ||
{ | ||
config: { apiUrl: 'test.com' }, | ||
secrets: { apiToken: '', email: undefined }, | ||
}, | ||
logger | ||
) | ||
).toThrow(); | ||
}); | ||
}); | ||
|
@@ -92,6 +110,7 @@ describe('Jira service', () => { | |
expect(requestMock).toHaveBeenCalledWith({ | ||
axios, | ||
url: 'https://siem-kibana.atlassian.net/rest/api/2/issue/1', | ||
logger, | ||
}); | ||
}); | ||
|
||
|
@@ -146,6 +165,7 @@ describe('Jira service', () => { | |
expect(requestMock).toHaveBeenCalledWith({ | ||
axios, | ||
url: 'https://siem-kibana.atlassian.net/rest/api/2/issue', | ||
logger, | ||
method: 'post', | ||
data: { | ||
fields: { | ||
|
@@ -210,6 +230,7 @@ describe('Jira service', () => { | |
|
||
expect(requestMock).toHaveBeenCalledWith({ | ||
axios, | ||
logger, | ||
method: 'put', | ||
url: 'https://siem-kibana.atlassian.net/rest/api/2/issue/1', | ||
data: { fields: { summary: 'title', description: 'desc' } }, | ||
|
@@ -272,6 +293,7 @@ describe('Jira service', () => { | |
|
||
expect(requestMock).toHaveBeenCalledWith({ | ||
axios, | ||
logger, | ||
method: 'post', | ||
url: 'https://siem-kibana.atlassian.net/rest/api/2/issue/1/comment', | ||
data: { body: 'comment' }, | ||
|
Oops, something went wrong.