|
@@ -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,
|