mirror of
https://github.com/grafana/grafana.git
synced 2024-11-26 19:00:54 -06:00
c38f6ff182
* tech(routines): move the async logic from notification to alerting notifier
* tech(notification): reduce code dupe
* fix(notification): dont touch the response unless its an error
* feat(alerting): make alerting exeuction async but flow sync
* tech(alerting): remove commented code
* tech(alerting): remove unused code
* tech(alerting): fix typo
* tech(alerting): implement Context on EvalContext
* tech(alerting): wait for all alerts to return
* feat(alerting): dont allow alert responses to cancel
* Revert "feat(alerting): dont allow alert responses to cancel"
This reverts commit 324b006c96
.
* feat(alerting): give alerts some time to finish before closing down
44 lines
1.1 KiB
Go
44 lines
1.1 KiB
Go
package notifications
|
|
|
|
import (
|
|
"testing"
|
|
|
|
m "github.com/grafana/grafana/pkg/models"
|
|
"github.com/grafana/grafana/pkg/setting"
|
|
. "github.com/smartystreets/goconvey/convey"
|
|
)
|
|
|
|
type testTriggeredAlert struct {
|
|
ActualValue float64
|
|
Name string
|
|
State string
|
|
}
|
|
|
|
func TestNotifications(t *testing.T) {
|
|
|
|
Convey("Given the notifications service", t, func() {
|
|
//bus.ClearBusHandlers()
|
|
|
|
setting.StaticRootPath = "../../../public/"
|
|
setting.Smtp.Enabled = true
|
|
setting.Smtp.TemplatesPattern = "emails/*.html"
|
|
setting.Smtp.FromAddress = "from@address.com"
|
|
|
|
err := Init()
|
|
So(err, ShouldBeNil)
|
|
|
|
var sentMsg *Message
|
|
addToMailQueue = func(msg *Message) {
|
|
sentMsg = msg
|
|
}
|
|
|
|
Convey("When sending reset email password", func() {
|
|
err := sendResetPasswordEmail(&m.SendResetPasswordEmailCommand{User: &m.User{Email: "asd@asd.com"}})
|
|
So(err, ShouldBeNil)
|
|
So(sentMsg.Body, ShouldContainSubstring, "body")
|
|
So(sentMsg.Subject, ShouldEqual, "Reset your Grafana password - asd@asd.com")
|
|
So(sentMsg.Body, ShouldNotContainSubstring, "Subject")
|
|
})
|
|
})
|
|
}
|