mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
test(dashboard): add failing test for deleting dashboards
This commit is contained in:
@@ -11,6 +11,8 @@ func init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func SaveAlerts(cmd *m.SaveAlertsCommand) error {
|
func SaveAlerts(cmd *m.SaveAlertsCommand) error {
|
||||||
|
//this function should be refactored
|
||||||
|
|
||||||
fmt.Printf("Saving alerts for dashboard %v\n", cmd.DashboardId)
|
fmt.Printf("Saving alerts for dashboard %v\n", cmd.DashboardId)
|
||||||
|
|
||||||
alerts, err := GetAlertsByDashboardId(cmd.DashboardId)
|
alerts, err := GetAlertsByDashboardId(cmd.DashboardId)
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import (
|
|||||||
|
|
||||||
. "github.com/smartystreets/goconvey/convey"
|
. "github.com/smartystreets/goconvey/convey"
|
||||||
|
|
||||||
|
"github.com/gosimple/slug"
|
||||||
"github.com/grafana/grafana/pkg/components/simplejson"
|
"github.com/grafana/grafana/pkg/components/simplejson"
|
||||||
m "github.com/grafana/grafana/pkg/models"
|
m "github.com/grafana/grafana/pkg/models"
|
||||||
"github.com/grafana/grafana/pkg/services/search"
|
"github.com/grafana/grafana/pkg/services/search"
|
||||||
@@ -55,6 +56,19 @@ func TestDashboardDataAccess(t *testing.T) {
|
|||||||
So(query.Result.Slug, ShouldEqual, "test-dash-23")
|
So(query.Result.Slug, ShouldEqual, "test-dash-23")
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Convey("Should be able to delete dashboard", func() {
|
||||||
|
insertTestDashboard("delete me", 1, "delete this")
|
||||||
|
|
||||||
|
dashboardSlug := slug.Make("delete me")
|
||||||
|
|
||||||
|
err := DeleteDashboard(&m.DeleteDashboardCommand{
|
||||||
|
Slug: dashboardSlug,
|
||||||
|
OrgId: 1,
|
||||||
|
})
|
||||||
|
|
||||||
|
So(err, ShouldBeNil)
|
||||||
|
})
|
||||||
|
|
||||||
Convey("Should return error if no dashboard is updated", func() {
|
Convey("Should return error if no dashboard is updated", func() {
|
||||||
cmd := m.SaveDashboardCommand{
|
cmd := m.SaveDashboardCommand{
|
||||||
OrgId: 1,
|
OrgId: 1,
|
||||||
|
|||||||
Reference in New Issue
Block a user