mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
feat(alerting): add sql layer for alert notifications
This commit is contained in:
@@ -11,6 +11,7 @@ import (
|
||||
func TestAlertNotificationSQLAccess(t *testing.T) {
|
||||
Convey("Testing Alert notification sql access", t, func() {
|
||||
InitTestDB(t)
|
||||
var err error
|
||||
|
||||
Convey("Alert notifications should be empty", func() {
|
||||
cmd := &m.GetAlertNotificationQuery{
|
||||
@@ -18,19 +19,49 @@ func TestAlertNotificationSQLAccess(t *testing.T) {
|
||||
Name: "email",
|
||||
}
|
||||
|
||||
err := GetAlertNotifications(cmd)
|
||||
err := AlertNotificationQuery(cmd)
|
||||
fmt.Printf("errror %v", err)
|
||||
So(err, ShouldBeNil)
|
||||
So(len(cmd.Result), ShouldEqual, 0)
|
||||
})
|
||||
/*
|
||||
Convey("Can save Alert Notification", func() {
|
||||
cmd := &m.CreateAlertNotificationCommand{}
|
||||
|
||||
var err error
|
||||
err = CreateAlertNotification(cmd)
|
||||
Convey("Can save Alert Notification", func() {
|
||||
cmd := &m.CreateAlertNotificationCommand{
|
||||
Name: "ops",
|
||||
Type: "email",
|
||||
}
|
||||
|
||||
err = CreateAlertNotificationCommand(cmd)
|
||||
So(err, ShouldBeNil)
|
||||
So(cmd.Result.Id, ShouldNotEqual, 0)
|
||||
|
||||
Convey("Cannot save Alert Notification with the same name", func() {
|
||||
err = CreateAlertNotificationCommand(cmd)
|
||||
So(err, ShouldNotBeNil)
|
||||
})
|
||||
|
||||
Convey("Cannot update alert notification that does not exist", func() {
|
||||
newCmd := &m.UpdateAlertNotificationCommand{
|
||||
Name: "NewName",
|
||||
Type: cmd.Result.Type,
|
||||
OrgID: cmd.Result.OrgId,
|
||||
Id: 1337,
|
||||
}
|
||||
err = UpdateAlertNotification(newCmd)
|
||||
So(err, ShouldNotBeNil)
|
||||
})
|
||||
|
||||
Convey("Can update alert notification", func() {
|
||||
newCmd := &m.UpdateAlertNotificationCommand{
|
||||
Name: "NewName",
|
||||
Type: cmd.Result.Type,
|
||||
OrgID: cmd.Result.OrgId,
|
||||
Id: cmd.Result.Id,
|
||||
}
|
||||
err = UpdateAlertNotification(newCmd)
|
||||
So(err, ShouldBeNil)
|
||||
}) */
|
||||
So(newCmd.Result.Name, ShouldEqual, "NewName")
|
||||
})
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user