mirror of
https://github.com/grafana/grafana.git
synced 2025-07-29 16:22:35 +08:00
Implement preference service (#47870)
* Implement preference service * Adjust wire.go * Fix integration test user * Fix api pref tests * Fix a11y error Co-authored-by: Alexandra Vargas <alexa1866@gmail.com> Co-authored-by: Emil Tullstedt <emil.tullstedt@grafana.com>
This commit is contained in:
@ -28,6 +28,8 @@ import (
|
||||
"github.com/grafana/grafana/pkg/services/guardian"
|
||||
"github.com/grafana/grafana/pkg/services/libraryelements"
|
||||
"github.com/grafana/grafana/pkg/services/live"
|
||||
pref "github.com/grafana/grafana/pkg/services/preference"
|
||||
"github.com/grafana/grafana/pkg/services/preference/preftest"
|
||||
"github.com/grafana/grafana/pkg/services/provisioning"
|
||||
"github.com/grafana/grafana/pkg/services/quota"
|
||||
"github.com/grafana/grafana/pkg/services/sqlstore"
|
||||
@ -43,11 +45,13 @@ func TestGetHomeDashboard(t *testing.T) {
|
||||
req := &models.ReqContext{SignedInUser: &models.SignedInUser{}, Context: &web.Context{Req: httpReq}}
|
||||
cfg := setting.NewCfg()
|
||||
cfg.StaticRootPath = "../../public/"
|
||||
prefService := preftest.NewPreferenceServiceFake()
|
||||
|
||||
hs := &HTTPServer{
|
||||
Cfg: cfg,
|
||||
pluginStore: &fakePluginStore{},
|
||||
SQLStore: mockstore.NewSQLStoreMock(),
|
||||
Cfg: cfg,
|
||||
pluginStore: &fakePluginStore{},
|
||||
SQLStore: mockstore.NewSQLStoreMock(),
|
||||
preferenceService: prefService,
|
||||
}
|
||||
|
||||
tests := []struct {
|
||||
@ -71,6 +75,8 @@ func TestGetHomeDashboard(t *testing.T) {
|
||||
bytes, err := simplejson.NewJson(homeDashJSON)
|
||||
require.NoError(t, err, "must be able to encode file as JSON")
|
||||
|
||||
prefService.ExpectedPreference = &pref.Preference{}
|
||||
|
||||
dash.Dashboard = bytes
|
||||
|
||||
b, err := json.Marshal(dash)
|
||||
|
Reference in New Issue
Block a user