forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Alerting] allow email action to not require auth
resolves elastic#57143 Currently, the built-in email action requires user/password properties to be set in it's secrets parameters. This PR changes that requirement, so they are no longer required.
- Loading branch information
Showing
3 changed files
with
78 additions
and
17 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -227,5 +227,61 @@ export default function emailTest({ getService }: FtrProviderContext) { | |
.expect(200); | ||
expect(typeof createdAction.id).to.be('string'); | ||
}); | ||
|
||
it('should handle an email action with no auth', async () => { | ||
const { body: createdAction } = await supertest | ||
.post('/api/action') | ||
.set('kbn-xsrf', 'foo') | ||
.send({ | ||
name: 'An email action with no auth', | ||
actionTypeId: '.email', | ||
config: { | ||
service: '__json', | ||
from: '[email protected]', | ||
}, | ||
}) | ||
.expect(200); | ||
|
||
await supertest | ||
.post(`/api/action/${createdAction.id}/_execute`) | ||
.set('kbn-xsrf', 'foo') | ||
.send({ | ||
params: { | ||
to: ['[email protected]'], | ||
subject: 'email-subject', | ||
message: 'email-message', | ||
}, | ||
}) | ||
.expect(200) | ||
.then((resp: any) => { | ||
expect(resp.body.data.message.messageId).to.be.a('string'); | ||
expect(resp.body.data.messageId).to.be.a('string'); | ||
|
||
delete resp.body.data.message.messageId; | ||
delete resp.body.data.messageId; | ||
|
||
expect(resp.body.data).to.eql({ | ||
envelope: { | ||
from: '[email protected]', | ||
to: ['[email protected]'], | ||
}, | ||
message: { | ||
from: { address: '[email protected]', name: '' }, | ||
to: [ | ||
{ | ||
address: '[email protected]', | ||
name: '', | ||
}, | ||
], | ||
cc: null, | ||
bcc: null, | ||
subject: 'email-subject', | ||
html: '<p>email-message</p>\n', | ||
text: 'email-message', | ||
headers: {}, | ||
}, | ||
}); | ||
}); | ||
}); | ||
}); | ||
} |