|
@@ -2,7 +2,6 @@ package sqlstore
|
|
|
|
|
|
|
|
import (
|
|
import (
|
|
|
"testing"
|
|
"testing"
|
|
|
-
|
|
|
|
|
"time"
|
|
"time"
|
|
|
|
|
|
|
|
"github.com/grafana/grafana/pkg/components/simplejson"
|
|
"github.com/grafana/grafana/pkg/components/simplejson"
|
|
@@ -110,11 +109,12 @@ func TestAlertingDataAccess(t *testing.T) {
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
Convey("Viewer cannot read alerts", func() {
|
|
Convey("Viewer cannot read alerts", func() {
|
|
|
- alertQuery := m.GetAlertsQuery{DashboardIDs: []int64{testDash.Id}, PanelId: 1, OrgId: 1, User: &m.SignedInUser{OrgRole: m.ROLE_VIEWER}}
|
|
|
|
|
|
|
+ viewerUser := &m.SignedInUser{OrgRole: m.ROLE_VIEWER, OrgId: 1}
|
|
|
|
|
+ alertQuery := m.GetAlertsQuery{DashboardIDs: []int64{testDash.Id}, PanelId: 1, OrgId: 1, User: viewerUser}
|
|
|
err2 := HandleAlertsQuery(&alertQuery)
|
|
err2 := HandleAlertsQuery(&alertQuery)
|
|
|
|
|
|
|
|
So(err2, ShouldBeNil)
|
|
So(err2, ShouldBeNil)
|
|
|
- So(alertQuery.Result, ShouldHaveLength, 0)
|
|
|
|
|
|
|
+ So(alertQuery.Result, ShouldHaveLength, 1)
|
|
|
})
|
|
})
|
|
|
|
|
|
|
|
Convey("Alerts with same dashboard id and panel id should update", func() {
|
|
Convey("Alerts with same dashboard id and panel id should update", func() {
|