|
|
@@ -32,6 +32,8 @@ func TestDashboardDataAccess(t *testing.T) {
|
|
|
|
|
|
Convey("Given saved dashboard", func() {
|
|
|
savedDash := insertTestDashboard("test dash 23", 1, "prod", "webapp")
|
|
|
+ insertTestDashboard("test dash 45", 1, "prod")
|
|
|
+ insertTestDashboard("test dash 67", 1, "prod", "webapp")
|
|
|
|
|
|
Convey("Should return dashboard model", func() {
|
|
|
So(savedDash.Title, ShouldEqual, "test dash 23")
|
|
|
@@ -87,7 +89,7 @@ func TestDashboardDataAccess(t *testing.T) {
|
|
|
|
|
|
Convey("Should be able to search for dashboard", func() {
|
|
|
query := search.FindPersistedDashboardsQuery{
|
|
|
- Title: "test",
|
|
|
+ Title: "test dash 23",
|
|
|
OrgId: 1,
|
|
|
}
|
|
|
|
|
|
@@ -99,6 +101,37 @@ func TestDashboardDataAccess(t *testing.T) {
|
|
|
So(len(hit.Tags), ShouldEqual, 2)
|
|
|
})
|
|
|
|
|
|
+ Convey("Should be able to search for dashboard by dashboard ids", func() {
|
|
|
+ Convey("should be able to find two dashboards by id", func() {
|
|
|
+ query := search.FindPersistedDashboardsQuery{
|
|
|
+ DashboardIds: []int{1, 2},
|
|
|
+ OrgId: 1,
|
|
|
+ }
|
|
|
+
|
|
|
+ err := SearchDashboards(&query)
|
|
|
+ So(err, ShouldBeNil)
|
|
|
+
|
|
|
+ So(len(query.Result), ShouldEqual, 2)
|
|
|
+
|
|
|
+ hit := query.Result[0]
|
|
|
+ So(len(hit.Tags), ShouldEqual, 2)
|
|
|
+
|
|
|
+ hit2 := query.Result[1]
|
|
|
+ So(len(hit2.Tags), ShouldEqual, 1)
|
|
|
+ })
|
|
|
+
|
|
|
+ Convey("DashboardIds that does not exists should not cause errors", func() {
|
|
|
+ query := search.FindPersistedDashboardsQuery{
|
|
|
+ DashboardIds: []int{1000},
|
|
|
+ OrgId: 1,
|
|
|
+ }
|
|
|
+
|
|
|
+ err := SearchDashboards(&query)
|
|
|
+ So(err, ShouldBeNil)
|
|
|
+ So(len(query.Result), ShouldEqual, 0)
|
|
|
+ })
|
|
|
+ })
|
|
|
+
|
|
|
Convey("Should not be able to save dashboard with same name", func() {
|
|
|
cmd := m.SaveDashboardCommand{
|
|
|
OrgId: 1,
|