mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Verifies requirement of id in dashboards.
This commit is contained in:
parent
7e96052594
commit
3da2ab61e0
@ -276,7 +276,6 @@ func TestDashboardDataAccess(t *testing.T) {
|
|||||||
cmd := m.SaveDashboardCommand{
|
cmd := m.SaveDashboardCommand{
|
||||||
OrgId: 1,
|
OrgId: 1,
|
||||||
Dashboard: simplejson.NewFromAny(map[string]interface{}{
|
Dashboard: simplejson.NewFromAny(map[string]interface{}{
|
||||||
//"id": 1,
|
|
||||||
"uid": "randomHash",
|
"uid": "randomHash",
|
||||||
"title": "folderId",
|
"title": "folderId",
|
||||||
"style": "light",
|
"style": "light",
|
||||||
@ -306,6 +305,39 @@ func TestDashboardDataAccess(t *testing.T) {
|
|||||||
So(err, ShouldBeNil)
|
So(err, ShouldBeNil)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Convey("Should not be able to update using just uid", func() {
|
||||||
|
cmd := m.SaveDashboardCommand{
|
||||||
|
OrgId: 1,
|
||||||
|
Dashboard: simplejson.NewFromAny(map[string]interface{}{
|
||||||
|
"uid": savedDash.Uid,
|
||||||
|
"title": "folderId",
|
||||||
|
"version": savedDash.Version,
|
||||||
|
"tags": []interface{}{},
|
||||||
|
}),
|
||||||
|
FolderId: savedDash.FolderId,
|
||||||
|
}
|
||||||
|
|
||||||
|
err := SaveDashboard(&cmd)
|
||||||
|
So(err, ShouldEqual, m.ErrDashboardWithSameUIDExists)
|
||||||
|
})
|
||||||
|
|
||||||
|
Convey("Should be able to update using just uid with overwrite", func() {
|
||||||
|
cmd := m.SaveDashboardCommand{
|
||||||
|
OrgId: 1,
|
||||||
|
Dashboard: simplejson.NewFromAny(map[string]interface{}{
|
||||||
|
"uid": savedDash.Uid,
|
||||||
|
"title": "folderId",
|
||||||
|
"version": savedDash.Version,
|
||||||
|
"tags": []interface{}{},
|
||||||
|
}),
|
||||||
|
FolderId: savedDash.FolderId,
|
||||||
|
Overwrite: true,
|
||||||
|
}
|
||||||
|
|
||||||
|
err := SaveDashboard(&cmd)
|
||||||
|
So(err, ShouldBeNil)
|
||||||
|
})
|
||||||
|
|
||||||
Convey("Should be able to update dashboard and remove folderId", func() {
|
Convey("Should be able to update dashboard and remove folderId", func() {
|
||||||
cmd := m.SaveDashboardCommand{
|
cmd := m.SaveDashboardCommand{
|
||||||
OrgId: 1,
|
OrgId: 1,
|
||||||
|
Loading…
Reference in New Issue
Block a user