|
|
|
@ -7,10 +7,11 @@ import ( |
|
|
|
|
"context" |
|
|
|
|
"testing" |
|
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/require" |
|
|
|
|
|
|
|
|
|
"github.com/grafana/grafana/pkg/components/simplejson" |
|
|
|
|
"github.com/grafana/grafana/pkg/models" |
|
|
|
|
"github.com/grafana/grafana/pkg/services/search" |
|
|
|
|
"github.com/stretchr/testify/require" |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
func TestDashboardFolderDataAccess(t *testing.T) { |
|
|
|
@ -507,6 +508,23 @@ func TestDashboardFolderDataAccess(t *testing.T) { |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
t.Run("Given dashboard and folder with the same title", func(t *testing.T) { |
|
|
|
|
var orgId int64 = 1 |
|
|
|
|
title := "Very Unique Name" |
|
|
|
|
var sqlStore *SQLStore |
|
|
|
|
var folder1, folder2 *models.Dashboard |
|
|
|
|
sqlStore = InitTestDB(t) |
|
|
|
|
folder2 = insertTestDashboard(t, sqlStore, "TEST", orgId, 0, true, "prod") |
|
|
|
|
_ = insertTestDashboard(t, sqlStore, title, orgId, folder2.Id, false, "prod") |
|
|
|
|
folder1 = insertTestDashboard(t, sqlStore, title, orgId, 0, true, "prod") |
|
|
|
|
|
|
|
|
|
t.Run("GetFolderByTitle should find the folder", func(t *testing.T) { |
|
|
|
|
result, err := sqlStore.GetFolderByTitle(orgId, title) |
|
|
|
|
require.NoError(t, err) |
|
|
|
|
require.Equal(t, folder1.Id, result.Id) |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
}) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|