| 123456789101112131415161718192021222324252627282930313233343536 |
- package notifiers
- import (
- "testing"
- "github.com/grafana/grafana/pkg/components/simplejson"
- m "github.com/grafana/grafana/pkg/models"
- . "github.com/smartystreets/goconvey/convey"
- )
- func TestBaseNotifier(t *testing.T) {
- Convey("Parsing base notification severity", t, func() {
- Convey("matches", func() {
- json := `
- {
- "severityFilter": "critical"
- }`
- settingsJSON, _ := simplejson.NewJson([]byte(json))
- not := NewNotifierBase("ops", "email", settingsJSON)
- So(not.MatchSeverity(m.AlertSeverityCritical), ShouldBeTrue)
- })
- Convey("does not match", func() {
- json := `
- {
- "severityFilter": "critical"
- }`
- settingsJSON, _ := simplejson.NewJson([]byte(json))
- not := NewNotifierBase("ops", "email", settingsJSON)
- So(not.MatchSeverity(m.AlertSeverityWarning), ShouldBeFalse)
- })
- })
- }
|