feat(test): this plugin is now testable (#9)

See vatesfr/xo-web#1749
This commit is contained in:
badrAZ 2016-11-09 14:55:08 +01:00 committed by Julien Fontanet
parent 588c369615
commit 3c11f0acda

View File

@ -93,6 +93,20 @@ export const configurationSchema = {
required: ['from', 'transport']
}
export const testSchema = {
type: 'object',
properties: {
to: {
type: 'string',
description: 'recipient of the test mail'
}
},
additionalProperties: false,
required: ['to']
}
// ===================================================================
class TransportEmailPlugin {
@ -141,6 +155,16 @@ class TransportEmailPlugin {
this._unset()
}
test ({to}) {
return this._sendEmail({
to,
subject: '[Xen Orchestra] Test of transport-email plugin',
markdown: `Hi there,
The transport-email plugin for Xen Orchestra server seems to be working fine, nicely done :)`
})
}
_sendEmail ({
from = this._conf.from,
to, cc, bcc,