Simplified emailing system and combined mailer and notifications packages

This commit is contained in:
Torkel Ödegaard
2015-06-08 16:51:25 +02:00
parent c8bc0b3bf8
commit 42fc68baa5
6 changed files with 54 additions and 66 deletions
@@ -20,17 +20,16 @@ func TestNotifications(t *testing.T) {
err := Init()
So(err, ShouldBeNil)
var sentMail *m.SendEmailCommand
dispatchMail = func(cmd *m.SendEmailCommand) error {
sentMail = cmd
return nil
var sentMsg *Message
addToMailQueue = func(msg *Message) {
sentMsg = msg
}
Convey("When sending reset email password", func() {
sendResetPasswordEmail(&m.SendResetPasswordEmailCommand{User: &m.User{Email: "asd@asd.com"}})
So(sentMail.Body, ShouldContainSubstring, "body")
So(sentMail.Subject, ShouldEqual, "Reset your Grafana password")
So(sentMail.Body, ShouldNotContainSubstring, "Subject")
So(sentMsg.Body, ShouldContainSubstring, "body")
So(sentMsg.Subject, ShouldEqual, "Reset your Grafana password")
So(sentMsg.Body, ShouldNotContainSubstring, "Subject")
})
})