-
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.
Merge branch 'master' into ingest-manager-setup-test
- Loading branch information
Showing
80 changed files
with
1,097 additions
and
508 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
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.