Chore: Use dashboard service to retrieve dashboards (#79020)

This commit is contained in:
Ezequiel Victorero
2023-12-05 18:09:21 -03:00
committed by GitHub
parent 0c9356a3c7
commit 66df17869d
9 changed files with 208 additions and 207 deletions
@@ -25,10 +25,13 @@ import (
"github.com/grafana/grafana/pkg/services/annotations/annotationstest"
"github.com/grafana/grafana/pkg/services/dashboards"
dashboardStore "github.com/grafana/grafana/pkg/services/dashboards/database"
"github.com/grafana/grafana/pkg/services/dashboards/service"
"github.com/grafana/grafana/pkg/services/datasources"
"github.com/grafana/grafana/pkg/services/datasources/guardian"
datasourcesService "github.com/grafana/grafana/pkg/services/datasources/service"
"github.com/grafana/grafana/pkg/services/featuremgmt"
"github.com/grafana/grafana/pkg/services/folder/folderimpl"
"github.com/grafana/grafana/pkg/services/folder/foldertest"
"github.com/grafana/grafana/pkg/services/publicdashboards"
publicdashboardsStore "github.com/grafana/grafana/pkg/services/publicdashboards/database"
. "github.com/grafana/grafana/pkg/services/publicdashboards/models"
@@ -337,15 +340,24 @@ func TestIntegrationUnauthenticatedUserCanGetPubdashPanelQueryData(t *testing.T)
cfg := setting.NewCfg()
ac := acmock.New()
ws := publicdashboardsService.ProvideServiceWrapper(store)
service := publicdashboardsService.ProvideService(cfg, store, qds, annotationsService, ac, ws)
pubdash, err := service.Create(context.Background(), &user.SignedInUser{}, savePubDashboardCmd)
folderStore := folderimpl.ProvideDashboardFolderStore(db)
dashPermissionService := acmock.NewMockedPermissionsService()
dashService, err := service.ProvideDashboardServiceImpl(
cfg, dashboardStoreService, folderStore, nil,
featuremgmt.WithFeatures(), acmock.NewMockedPermissionsService(), dashPermissionService, ac,
foldertest.NewFakeService(), nil,
)
require.NoError(t, err)
pds := publicdashboardsService.ProvideService(cfg, store, qds, annotationsService, ac, ws, dashService)
pubdash, err := pds.Create(context.Background(), &user.SignedInUser{}, savePubDashboardCmd)
require.NoError(t, err)
// setup test server
server := setupTestServer(t,
cfg,
featuremgmt.WithFeatures(featuremgmt.FlagPublicDashboards),
service,
pds,
db,
anonymousUser,
)